Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- local t = peripheral.wrap("BigReactors-Turbine_1")
- -- local ta = peripheral.wrap("BigReactors-Turbine_2")
- -- local tb = peripheral.wrap("BigReactors-Turbine_3")
- -- local e = peripheral.find("tile_blockcapacitorbank_name")
- local r = peripheral.find("BigReactors-Reactor")
- -- local cap_num = 36
- local max = 10000000 -- 10.000.000
- local min = 1000000 -- 1.000.000
- local eFull = false
- function getSpeed(turbine, nr)
- local speed = turbine.getRotorSpeed()
- if speed > 1805 and turbine.getActive() then
- print("Too fast, turning turbine " .. nr .. " off")
- turbine.setActive(false)
- elseif speed < 1795 and not turbine.getActive() then
- print("Too slow, turning turbine " .. nr .. " on")
- turbine.setActive(true)
- end
- end
- function rOff()
- r.setActive(false)
- end
- function rOn()
- r.setActive(true)
- end
- while true do
- -- getSpeed(t, 1)
- -- getSpeed(ta, 2)
- -- getSpeed(tb, 3)
- local heat = r.getFuelTemperature()
- if heat >= 1800 and r.getActive() then
- print("Too hot, turning off")
- rOff()
- elseif heat <= 1600 and not r.getActive() and not eFull then
- print("Too cold, turning on")
- rOn()
- end
- local energy = r.getEnergyStored()
- print(energy)
- -- and not t.getInductorEngaged() and speed > 1750
- if energy < min then
- eFull = false
- print("Low on energy, turning on reactor!")
- -- t.setInductorEngaged(true)
- -- ta.setInductorEngaged(true)
- rOn()
- -- and t.getInductorEngaged()
- elseif energy >= max then
- eFull = true
- print("Full, turning off reactor!")
- -- t.setInductorEngaged(false)
- -- ta.setInductorEngaged(false)
- rOff()
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement