Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- reactor = peripheral.wrap("back")
- monitor = peripheral.wrap("monitor_0")
- --function for fuel info
- function fuelInfo(mon, br, x, y)
- mon.setCursorPos(x, y)
- mon.setTextColor(colors.white)
- mon.write("Fuel Level:")
- mon.setCursorPos(x, y+1)
- mon.setTextColor(colors.yellow)
- mon.write((br.getFuelAmount()/br.getFuelAmountMax()*100).."%")
- end
- -- total charge info
- function chargeInfo(mon, br, x, y)
- mon.setCursorPos(x,y)
- mon.setTextColor(colors.white)
- mon.write("Current Charge:")
- mon.setCursorPos(x,y+1)
- mon.setTextColor(colors.yellow)
- mon.write(br.getEnergyStored().." RF")
- end
- -- reactor status on/off
- function reactorStatus(mon, br, x, y)
- mon.setCursorPos(x,y)
- mon.setTextColor(colors.white)
- mon.write("Reactor Status:")
- mon.setCursorPos(x,y+1)
- mon.setTextColor(colors.yellow)
- if br.getActive() then mon.write("Active") else mon.write("Inactive") end
- end
- -- control rod controls
- function updateControlRods(br)
- if br.getEnergyStored() <= 9500000 and br.getEnergyStored()>=0 then
- br.setAllControlRodLevels(0+(br.getEnergyStored()/100000))
- else
- br.setAllControlRodLevels(100)
- end
- end
- -- control rod info
- function controlRodInfo(mon, br, x, y)
- for a=0,(br.getNumberOfControlRods()-1) do
- mon.setCursorPos(x, y+a)
- mon.setTextColor(colors.yellow)
- mon.write("ControlRod "..(a+1)..": "..(br.getControlRodLevel(a)))
- end
- end
- -- current charge information
- function currentCharge(mon, br, x, y)
- mon.setCursorPos(x, y)
- mon.setTextColor(colors.white)
- mon.write("Current RF Produced:")
- mon.setCursorPos(x, y+1)
- mon.setTextColor(colors.yellow)
- mon.write((br.getEnergyProducedLastTick()).."RF/t")
- end
- while true do
- updateControlRods(reactor)
- monitor.clear()
- --fuel info
- fuelInfo(monitor, reactor, 1, 1)
- --charge info
- chargeInfo(monitor, reactor, 1, 4)
- --reactor status
- reactorStatus(monitor, reactor, 20, 1)
- --control rod info
- controlRodInfo(monitor, reactor, 1, 7)
- --current charge info
- currentCharge(monitor, reactor, 20, 4)
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment