minecraft turbine api -- Minecraft 1.12.2 -- CC: Tweaked 1.86.0 -- Extreme Reactors 1.12.2-0.4.5.67 -- This script expects to be connected to one or more Extreme Reactors Turbines -- either directly or via wired modem -- get all connected turbines (directly or networked) turbines = {peripheral.find("BigReactors-Turbine")} local rotor_speed = 0 local flow_rate = 0 minecraft turbine api PasteShr minecraft turbine api -- make a way to easily set all turbines with the same value function setAllTurbines(setting_name, setting_val) -- loop through all connected turbines loaded at the start of this script for index, turbine in ipairs(turbines) do -- set each turbine to what is requested turbine[setting_name](setting_val) end end minecraft turbine api How to get it? minecraft turbine api -- let the user know this script is running print('Automatic turbine control initiated') -- let the user know we are activating all connected turbines print('Setting all connected turbines to active') -- activate all connected turbines setAllTurbines('setActive', true) -- let the user know we are setting all turbines to dump excess liquid print('Setting all connected turbines to dump excess liquid') minecraft turbine api How to use it? minecraft turbine api -- set all turbines to dump excess liquid setAllTurbines('setVentOverflow', '') -- yay, an infinite loop :D (they are actually useful sometimes) while true do -- loop through all connected turbines loaded at the start of this script (this script will have to be restarted if new turbines are connected) for index, turbine in ipairs(turbines) do -- get current turbine rotor speed minecraft turbine api PasteShr minecraft turbine api rotor_speed = turbine.getRotorSpeed() -- make sure current turbine rotor speed did not come back with nil, otherwise further testing to pointless if rotor_speed ~= nil then -- check if the turbine is overspeed if rotor_speed >= 1850 and turbine.getFluidFlowRateMax() > 5 then print('Turbine #'..(index+1)..' is overspeed, lowering fluid flow rate') -- if it is, reduce the max fluid flow rate to try to slow it down turbine.setFluidFlowRateMax(5) minecraft turbine api How to get it for free? minecraft turbine api end -- check if the turbine is back down from being overspeed if rotor_speed < 1810 and turbine.getFluidFlowRateMax() < 2000 then print('Resetting fluid flow rate on turbine #'..(index+1)..' to max') -- if it is, set the max fluid flow rate back to normal turbine.setFluidFlowRateMax(2000) end -- check if the turbine is at a good speed to engage the inductor minecraft turbine api How to dowload it? minecraft turbine api if rotor_speed >= 1800 and turbine.getInductorEngaged() == false then print('Turbine #'..(index+1)..' is full speed, re-engaging inductor') -- if it is, and the inductor is not engaged, engage it turbine.setInductorEngaged(true) end -- check if the turbine is underspeed if rotor_speed <= 1750 and turbine.getInductorEngaged() then print('Turbine #'..(index+1)..' is underspeed, disengaging inductor') -- if it is, disengage the inductor to try to speed it up minecraft turbine api How to use it? minecraft turbine api turbine.setInductorEngaged(false) end end -- end if not nil end -- end for -- sleep for a very short amount of time (100ms) os.sleep(0.1) minecraft turbine api How to get it for free? minecraft turbine api end -- end while minecraft turbine api