Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --variables
- running = true
- id = 11
- --Functions
- function reset()
- term.clear()
- term.setCursorPos(1,1)
- end
- function gui()
- reset()
- print("Power ON/OFF")
- term.setCursorPos(1,3)
- print("Eject Waste")
- term.setCursorPos(1,5)
- print("Reactor Information")
- term.setCursorPos(1,7)
- print("Test Connection")
- term.setCursorPos(1,9)
- print("Exit Program")
- end
- function testConnection()
- testID = 8
- rednet.send(8, "ping")
- testCon = {os.pullEvent("rednet_message")}
- if testCon[1] == testID and testCon[3] == "pong" then
- print("Connection Good!")
- sleep(5)
- shell.run("reactorClient")
- end
- end
- function reactorInfo()
- reset()
- message = { os.pullEvent("rednet_message") }
- isActive = message[3][1]
- fuel = message[3][2]
- fuelMax = message[3][3]
- energyStored = message[3][4]
- RFS = message[3][5]
- reactivity = message[3][6]
- waste = message[3][7]
- caseTemp = message[3][8]
- fuelTemp = message[3][9]
- if isActive == "true" then
- print("Reactor On")
- elseif message[3][1] =="false" then
- print("Reactor Off")
- end
- print("Fuel: "..fuel.."/"..fuelMax)
- print("Energy: "..energyStored.." RF")
- print("RF/s: "..RFS)
- print("Reactivity"..reactivity.."%")
- print("waste: "..waste.." mB")
- print("Casing Temp: "..caseTemp)
- print("Fuel Temp: "..fuelTemp)
- end
- function receive()
- msg = { os.pullEvent("rednet_message") }
- event = msg[1]
- SID = msg[2]
- sent = msg[3]
- reset()
- print(sent)
- sleep(5)
- shell.run("reactorClient")
- end
- function debug()
- term.setCursorPos(1,11)
- for k,v in pairs(click) do
- print(v)
- end
- end
- --Main Program
- rednet.open("back")
- gui()
- click = { os.pullEvent("mouse_click") }
- button = click[1]
- xPos = click[2]
- yPos = click[3]
- if xPos >= 1 and xPos <= 13 and yPos == 1 then
- rednet.send(id, "power")
- receive()
- elseif button == 1 and xPos >= 1 and xPos <= 13 and yPos == 3 then
- rednet.send(id, "waste")
- receive()
- elseif button == 1 and xPos >= 1 and xPos <= 18 and yPos == 5 then
- rednet.send(id, "reactorInfo")
- reactorInfo()
- elseif button == 1 and xPos >= 1 and xPos <= 13 and yPos == 7 then
- reset()
- textutils.slowPrint("Testing Connection...")
- testConnection()
- elseif button == 1 and xPos >= 1 and xPos <= 13 and yPos == 9 then
- print("Exiting Program")
- running = false
- shell.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement