Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- BigReactor passive cooled fuel rod controller
- -- By BookerTheGeek
- -- Variables
- local reactor = peripheral.wrap("back")
- local maxEnergy = reactor.getEnergyCapacity()
- local run = true
- -- The Goods
- while run == true do
- -- Check if Reactor is Formed
- if reactor.mbIsAssembled() == false then
- term.clear()
- term.setCursorPos(1,1)
- print("Reactor not formed")
- sleep(1)
- else
- -- Turn Reactor On if Off
- if reactor.getActive() ~= "true" then
- reactor.setActive(true)
- end
- -- Figure out Energy stored as a %
- storedEnergy = reactor.getEnergyStored()
- percentFull = math.floor(storedEnergy / maxEnergy * 100)
- -- Make sure we are not going over 100 or under 0
- if percentFull >= 100 then percentFull = 100 end
- if percentFull <= 0 then percentFull = 0 end
- -- Control the Control Rods
- reactor.setAllControlRodLevels(percentFull)
- -- Output Information
- term.clear()
- term.setCursorPos(1,1)
- print("RF:", storedEnergy )
- print("Rod % ", percentFull)
- -- Wait to run again
- sleep(1)
- -- End the Loop
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement