Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local turbine
- local reactor
- local restore = false
- function reactorSearch()
- local names = peripheral.getNames()
- local i, name
- for i, name in pairs(names) do
- if peripheral.getType(name) == "BigReactors-Reactor" then
- return peripheral.wrap(name)
- else
- --return null
- end
- end
- end
- function turbineSearch()
- local names = peripheral.getNames()
- local i, name
- for i, name in pairs(names) do
- if peripheral.getType(name) == "BigReactors-Turbine" then
- return peripheral.wrap(name)
- else
- --return null
- end
- end
- end
- sleep(1)
- turbine = turbineSearch()
- reactor = reactorSearch()
- while true do
- speed = turbine.getRotorSpeed()
- reactorActive = reactor.getActive()
- if reactorActive == false and speed > 1750 and speed < 1800 then
- turbine.setInductorEngaged(false)
- turbine.setActive(false)
- elseif speed < 1750 then
- restore = true
- turbine.setInductorEngaged(false)
- turbine.setActive(true)
- reactor.setActive(true)
- elseif restore == true and speed > 1795 and speed < 1805 then
- restore = false
- turbine.setActive(false)
- reactor.setActive(false)
- end
- if reactorActive == true and restore == false then
- turbine.setActive(true)
- if speed > 1850 then
- -- slow the turbine down, generate RF
- turbine.setInductorEngaged(true)
- end
- if speed < 1820 then
- -- disengage rotors so they spin up again
- turbine.setInductorEngaged(false)
- end
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement