Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- local reactor = peripheral.wrap("BigReactors-Reactor_0")
- local monitor = peripheral.wrap("monitor_0")
- local factor = 0.5
- term.setTextColor(colors.blue)
- textutils.slowPrint("====Reactor Checking System====")
- textutils.slowPrint("========By DiscworldZA=========")
- if reactor == nil then
- textutils.slowPrint("No Reactor Found")
- end
- if reactor.getConnected() then
- term.setTextColor(colors.green)
- textutils.slowPrint("Reactor Connected")
- end
- local energyFactor
- function checkActive()
- energyFactor = reactor.getEnergyStored() / 10000000
- term.setTextColor(colors.red)
- textutils.slowPrint("Checking Status...")
- sleep(1)
- term.setTextColor(colors.white)
- textutils.slowWrite("Reactor Status: ")
- if reactor.getActive() then
- term.setTextColor(colors.green)
- textutils.slowPrint("On")
- else
- term.setTextColor(colors.red)
- textutils.slowPrint("Off")
- end
- term.setTextColor(colors.white)
- textutils.slowWrite("Energy Storage: ")
- term.setTextColor(colors.blue)
- textutils.slowPrint(reactor.getEnergyStored() .. " RF")
- if energyFactor < factor then
- if not reactor.getActive() then
- reactor.setActive(true)
- term.setTextColor(colors.green)
- textutils.slowPrint("Activating Reactor")
- end
- else
- if reactor.getActive() then
- reactor.setActive(false)
- term.setTextColor(colors.red)
- end
- end
- sleep(3)
- end
- function printMonitor()
- while true do
- oldterm = term.redirect(monitor)
- term.clear()
- term.setCursorPos(1, 1)
- term.setTextColor(colors.blue)
- print("====Reactor Control====")
- print("=====By DiscworldZA====")
- write("Reactor: ")
- if reactor.getActive() then
- term.setTextColor(colors.green)
- print("On")
- else
- term.setTextColor(colors.red)
- print("Off")
- end
- term.setTextColor(colors.blue)
- write("Power Level: ")
- term.setTextColor(colors.red)
- write(reactor.getEnergyStored())
- term.setTextColor(colors.blue)
- print(" RF")
- term.redirect(oldterm)
- sleep(1)
- end
- end
- function quitProgram()
- local event, name = os.pullEvent("quit")
- if name == "reactor" then
- quit = true
- end
- end
- while true do
- parallel.waitForAny(quitProgram, checkActive, printMonitor)
- if quit then
- print("Quitting....")
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement