Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Beginning Declarations
- monitor = peripheral.wrap("top")
- monitor.clear()
- nir = peripheral.wrap("left")
- local nuke = paintutils.loadImage("nuke")
- os.loadAPI("disk/buttons")
- addButton("NuclearReactorToggle",no,reactorToggle,colors.yellow,colors.yellow,colors.black,1,1,25,1)
- function reactorToggle()
- rednet.open("bottom")
- if reactorNumb == 1 then
- rednet.send(255,on)
- elseif reactorNumb == 2 then
- rednet.send(254,on)
- elseif reactorNumb == 3 then
- rednet.send(254,on)
- elseif reactorNumb == 4 then
- rednet.send(253,on)
- end
- end
- --System Functions
- function heat()
- for system,status in pairs(info) do
- status = tostring(status)
- max = 500
- if system == "heat" then
- monitor.setCursorPos(1,3)
- monitor.setTextColor(colors.yellow)
- print("*")
- monitor.setCursorPos(1,5)
- print("*")
- monitor.setTextColor(colors.white)
- monitor.setCursorPos(2,3)
- print(" Reactor Heat Level = "..status)
- monitor.setCursorPos(2,5)
- print(" Reactor Max Heat = "..max)
- monitor.setTextColor(colors.yellow)
- monitor.setCursorPos(27,5)
- print("+")
- monitor.setTextColor(colors.white)
- monitor.setCursorPos(28,5)
- print(" or ")
- monitor.setCursorPos(33,5)
- monitor.setTextColor(colors.yellow)
- print("-")
- end
- end
- end
- function reactorPower()
- for system,status in pairs(info) do
- status = tostring(status)
- if system == "reactorPoweredB" then
- monitor.setBackgroundColor(colors.yellow)
- monitor.setTextColor(colors.black)
- monitor.setCursorPos(1,1)
- for name,data in pairs(disk/buttons) do
- local on = data["active"]
- if on == true then
- reactorStatus = "on"
- else
- reactorStatus = "off"
- end
- end
- print("Nuclear Reactor #"..reactorNumb.." = "..reactorStatus)
- monitor.setCursorPos(1,18)
- print("Back")
- monitor.setCursorPos(28,18)
- print("Page Forward")
- monitor.setBackgroundColor(colors.black)
- end
- end
- end
- function output()
- for system,status in pairs(info) do
- status = tostring(status)
- if system == "output" then
- monitor.setTextColor(colors.yellow)
- monitor.setCursorPos(1,7)
- print("*")
- monitor.setTextColor(colors.white)
- monitor.setCursorPos(2,7)
- print(" EU Output = "..status)
- end
- end
- end
- function timeLeft()
- for system,status in pairs(info) do
- status = tostring(status)
- if system == "timeLeft" then
- monitor.setTextColor(colors.yellow)
- monitor.setCursorPos(1,9)
- print("*")
- monitor.setTextColor(colors.white)
- monitor.setCursorPos(2,9)
- print(" Uranium Cells level = "..status)
- end
- end
- end
- function nuclear(numbNuke)
- noth1, noth2, card, info = nir.get(numbNuke)
- reactorNumb = numbNuke
- term.redirect(monitor)
- monitor.clear()
- monitor.setBackgroundColor(colors.black)
- heat()
- reactorPower()
- output()
- timeLeft()
- term.restore()
- end
- --Load Screen Function
- local function loadScreen()
- monitor.clear()
- term.redirect(monitor)
- monitor.setTextColor(colors.white)
- monitor.setBackgroundColor(colors.black)
- monitor.setCursorPos(9,1)
- textutils.slowWrite("Nuclear Reactor Controls")
- paintutils.drawImage(nuke,-4,2)
- monitor.setCursorPos(1,15)
- textutils.slowWrite("(Right Click Screen to go edit Reactor)")
- while os.pullEvent("monitor_touch") == false do
- sleep(0)
- end
- monitor.clear()
- term.restore()
- end
- --Load Screen Function
- loadScreen()
- --Nuclear #1 Display/Controls
- nuclear(1)
- while true do
- nuclear(1)
- buttonLoop()
- sleep(0)
- end
- local event,side,xPos,yPos = os.pullEvent("monitor_touch")
Advertisement
Add Comment
Please, Sign In to add comment