Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local comp = require("component")
- reactor = comp.getPrimary("br_reactor")
- turbine = comp.getPrimary("br_turbine")
- maxSteam = reactor.getHotFluidAmountMax() + turbine.getFluidAmountMax()
- function getSteam ()
- local mySteam = reactor.getHotFluidAmount() + turbine.getInputAmount()
- return ( 100 * mySteam ) / maxSteam
- end
- local lastSteam = getSteam()
- os.sleep(1)
- local control = reactor.getControlRodLevel(0)
- local delay = 0
- while true do
- steam = getSteam()
- delay = 0
- if ( delay == 0 ) then
- if ( control > 0 and (( steam < 25 or ( steam < 50 and steam < lastSteam )))) then
- control = control - 1
- reactor.setAllControlRodLevels(control)
- delay = 1
- end
- if ( control < 100 and (( steam > 95 or ( steam > 85 and steam > lastSteam )))) then
- control = control + 1
- reactor.setAllControlRodLevels(control)
- delay = 1
- end
- else
- delay = 0
- end
- lastSteam = steam
- print("Steam: " .. math.floor(steam) .. "%, Control rods: " .. control .."%")
- os.sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement