Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("back")
- screen = peripheral.wrap("bottom")
- TotalPowerOutput = 0
- PowerOutput = 60
- r1p = 0
- r2p = 0
- r3p = 0
- local function UpdateScreen()
- screen.clear()
- screen.setTextScale(2)
- screen.setCursorPos(2,2)
- screen.write("Power Output:")
- sleep(0.1)
- screen.setCursorPos(5,4)
- screen.write(TotalPowerOutput.." EU/t")
- end
- UpdateScreen()
- while true do
- local id, message = rednet.receive()
- if message == "Reactor1 is now ONLINE" and r1p == 0 then
- r1p = 1
- TotalPowerOutput = TotalPowerOutput + PowerOutput
- UpdateScreen()
- elseif message == "Reactor2 is now ONLINE" and r2p == 0 then
- r2p = 1
- TotalPowerOutput = TotalPowerOutput + PowerOutput
- UpdateScreen()
- elseif message == "Reactor3 is now ONLINE" and r3p == 0 then
- r3p = 1
- TotalPowerOutput = TotalPowerOutput + PowerOutput
- UpdateScreen()
- elseif message == "Reactor1 is now OFFLINE" and r1p == 1 then
- r1p = 0
- TotalPowerOutput = TotalPowerOutput - PowerOutput
- UpdateScreen()
- elseif message == "Reactor2 is now OFFLINE" and r2p == 1 then
- r2p = 0
- TotalPowerOutput = TotalPowerOutput - PowerOutput
- UpdateScreen()
- elseif message == "Reactor3 is now OFFLINE" and r3p == 1 then
- r3p = 0
- TotalPowerOutput = TotalPowerOutput - PowerOutput
- UpdateScreen()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement