Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Set peripheral wrapping
- local Reactor = peripheral.wrap("BigReactors-Reactor_0")
- local Turbine = peripheral.wrap("BigReactors-Turbine_0")
- local BatterySide= "right"
- -- Constants
- local batteryLow = 3
- local batteryHigh = 12
- local batteryState=false
- local active=false
- local rodBase=75
- local rod=rodBase
- -- Functions
- function checkBattery()
- if (redstone.getAnalogInput(BatterySide) <= batteryLow) then
- batteryState=true
- elseif (redstone.getAnalogInput(BatterySide) >= batteryHigh) then
- batteryState=false
- end
- return batteryState
- end
- function control()
- Reactor.setActive(active)
- Turbine.setActive(active)
- end
- function tune()
- rod=Reactor.getControlRodLevel(0)
- if (active) then
- if (Reactor.getHotFluidProducedLastTick()< 2000) then
- rod=rod-1
- if (rod <1 ) then rod=1 end
- elseif (Reactor.getHotFluidProducedLastTick()> 2060 or Reactor.getFuelTemperature()>200) then
- rod=rod+1
- if (rod > 100) then rod=100 end
- end
- end
- Reactor.setAllControlRodLevels(rod)
- end
- -- Start up
- Reactor.setAllControlRodLevels(rodBase)
- while true do
- if (checkBattery()) then
- active=true
- else
- active=false
- end
- control()
- tune()
- sleep(10)
- end
Add Comment
Please, Sign In to add comment