Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- local m = peripheral.wrap("monitor_0")
- local r = peripheral.wrap("BigReactors-Reactor_0")
- local msizex,msizey = m.getSize()
- local reactP = "-=Reactor Properties=-"
- local reactC = "-=Reactor Controls=-"
- function reactorControls()
- button.setTable("Activate",activate,"",3,10,7,7)
- button.setTable("Deactivate",deActivate,"",12,22,7,7)
- button.screen()
- end
- function activate()
- r.setActive(true)
- end
- function deActivate()
- r.setActive(false)
- end
- function updateStats()
- m.clear()
- m.setCursorPos(math.floor(msizex/2)-math.floor(#reactP/2),1)
- m.setTextScale(1)
- m.setTextColor(colors.blue)
- m.setBackgroundColor(colors.black)
- m.write(reactP)
- m.setCursorPos(1,2)
- m.setTextColor(colors.white)
- m.write("Status:")
- if r.getActive() then
- m.setTextColor(colors.lime)
- m.write(" ACTIVE")
- else
- m.setTextColor(colors.red)
- m.write(" INACTIVE")
- end
- m.setCursorPos(math.floor(msizex/2),2)
- m.setTextColor(colors.white)
- m.write("Control Rods: ")
- m.setTextColor(colors.gray)
- m.write(r.getNumberOfControlRods())
- m.setCursorPos(1,3)
- m.setTextColor(colors.white)
- m.write("Fuel Temp: ")
- m.setTextColor(colors.gray)
- m.write(math.floor(r.getFuelTemperature()).." C")
- m.setCursorPos(math.floor(msizex/2),3)
- m.setTextColor(colors.white)
- m.write("Casing Temp: ")
- m.setTextColor(colors.gray)
- m.write(math.floor(r.getCasingTemperature()).." C")
- m.setCursorPos(1,4)
- m.setTextColor(colors.white)
- m.write("Fuel Amount: ")
- m.setTextColor(colors.gray)
- m.write(math.floor(r.getFuelAmount()/1000).." B")
- m.setCursorPos(math.floor(msizex/2),4)
- m.setTextColor(colors.white)
- m.write("Waste Amount: ")
- m.setTextColor(colors.gray)
- m.write(r.getWasteAmount().." mB")
- m.setCursorPos(1,5)
- m.setTextColor(colors.white)
- m.write("Stored RF: ")
- energyStored = r.getEnergyStored()
- m.setTextColor(colors.gray)
- if energyStored >= 1000 and energyStored <= 999999 then
- m.write(math.floor(energyStored/1000).." KiRF")
- elseif energyStored >= 1000000 then
- m.write(math.floor(energyStored/1000000).." MiRF")
- else
- m.write(energyStored.." RF")
- end
- m.setCursorPos(math.floor(msizex/2),5)
- m.setTextColor(colors.white)
- m.write("Producing ")
- m.setTextColor(colors.gray)
- rfPerTick = r.getEnergyProducedLastTick()
- m.write(math.floor(rfPerTick).." RF/t")
- end
- function loop()
- updateStats()
- reactorControls()
- timerCode = os.startTimer(2)
- local event, side, x, y
- repeat
- event, side, x, y = os.pullEvent()
- print(event)
- if event == "timer" then
- print(timerCode..":"..side)
- if timerCode == side then
- print("Wrong code")
- else
- print("Right code")
- end
- end
- until event ~= timer or timerCode == side
- if event == "monitor_touch" then
- print(x..":"..y)
- button.checkxy(x,y)
- end
- end
- while true do
- loop()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement