Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rea = peripheral.wrap("BigReactors-Reactor_0")
- local mon = peripheral.wrap("monitor_1")
- function display()
- mon.setTextColor( colors.white )
- energy = math.floor(rea.getEnergyStored())
- energyString = string.sub(energy .. "RF ", 1, 11)
- mon.setCursorPos(4, 1)
- mon.write(energyString)
- mon.setCursorPos(14,1)
- mon.write(" / 10000000RF")
- percent = math.floor(energy / 10000000 * 100)
- mon.setCursorPos(10, 2)
- percentString = string.sub(percent .. " ", 1, 3)
- mon.write(percentString)
- mon.setCursorPos(13,2)
- mon.write("% full")
- mon.setCursorPos(11, 4)
- if percent == 100 then
- rea.setActive(false)
- elseif percent < 20 then
- rea.setActive(true)
- end
- if rea.getActive() then
- mon.setBackgroundColor( colors.green )
- mon.write("ENABLED ")
- mon.setBackgroundColor( colors.black)
- else
- mon.setBackgroundColor( colors.red )
- mon.write("DISABLED")
- end
- end
- mon.clear()
- while true do
- os.queueEvent("reactorControl")
- os.pullEvent()
- display()
- os.sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment