Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Copyright 2014 Seth Traverse (WinMac32)
- print("Running reactor control utility.")
- mfe = peripheral.wrap("top")
- local reactorSide = "right"
- redstone.setOutput(reactorSide, false)
- local on = false
- function rText(x, y, text)
- ox, oy = term.getCursorPos()
- term.setCursorPos(x, y)
- term.write(text)
- term.setCursorPos(ox, oy)
- end
- function renderStats(cap, stored, perc)
- scrX = term.getSize()
- x = scrX - 16
- rText(x, 1, "Capacity: " .. cap)
- rText(x, 2, "Stored: " .. stored)
- rText(x, 3, "Percent: " .. perc)
- end
- while 1 do
- cap = mfe.getEUCapacity()
- stored = mfe.getEUStored()
- perc = stored / cap * 100
- renderStats(cap, stored, perc)
- if (redstone.getInput("left")) then
- redstone.setOutput(reactorSide, false)
- print("MANUAL SHUTDOWN ENABLED!!")
- sleep(10)
- else
- if (perc < 80 and not on) then
- redstone.setOutput(reactorSide, true)
- print("Storage percentage less than 80%")
- print("-> Reactor turned on")
- on = true
- elseif (perc > 95 and on) then
- redstone.setOutput(reactorSide, false)
- print("Storage percentage greater than 95%")
- print("-> Reactor turned off")
- on = false
- end
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement