Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rotor1 = peripheral.wrap("BigReactors-Turbine_0")
- local rotor2 = peripheral.wrap("BigReactors-Turbine_1")
- local rotor3 = peripheral.wrap("BigReactors-Turbine_2")
- local rotor4 = peripheral.wrap("BigReactors-Turbine_3")
- local reactor = peripheral.wrap("BigReactors-Reactor_5")
- rotorActiveCounter = 4
- function rotorManagment(x)
- if x.getEnergyStored() > 900000 then
- x.setInductorEngaged(false)
- if x.getRotorSpeed() < 1700 then
- x.setFluidFlowRateMax(50)
- elseif x.getRotorSpeed() > 1750 then
- x.setFluidFlowRateMax(0)
- end
- elseif x.getEnergyStored() < 300000 then
- x.setInductorEngaged(true)
- if x.getRotorSpeed() < 1750 then
- x.setFluidFlowRateMax(1400)
- elseif x.getRotorSpeed() > 1825 then
- x.setFluidFlowRateMax(1250)
- end
- end
- end
- function reactorManagment(x)
- rotorActiveCounter = 4
- if rotor1.getInductorEngaged() == false then
- rotorActiveCounter = rotorActiveCounter - 1
- end
- if rotor2.getInductorEngaged() == false then
- rotorActiveCounter = rotorActiveCounter - 1
- end
- if rotor3.getInductorEngaged() == false then
- rotorActiveCounter = rotorActiveCounter - 1
- end
- if rotor4.getInductorEngaged() == false then
- rotorActiveCounter = rotorActiveCounter - 1
- end
- if rotorActiveCounter == 0 then
- reactor.setAllControlRodLevels(99)
- else
- reactor.setAllControlRodLevels(100 - (rotorActiveCounter * 20))
- end
- end
- while true do
- rotorManagment(rotor1)
- rotorManagment(rotor2)
- rotorManagment(rotor3)
- rotorManagment(rotor4)
- reactorManagment(reactor)
- os.sleep(1)
- end
Add Comment
Please, Sign In to add comment