It has a simple GUI
Recently I tried to incorporate the feature to disable the reactor in case of a rednet message signaling overheating..
I don't get why it doesn't work atm…
--Desktop
slc = 0
tBarC = 8
tBartC = 1
backColor = 1
term.setBackgroundColor(backColor)
term.clear()
function titleBar()
term.setCursorPos(1,1)
term.setBackgroundColor(tBarC)
term.setTextColor(tBartC)
term.clearLine()
term.setCursorPos(2, 1)
print("[Start Menu]")
term.setCursorPos(15, 1)
print("Reactor Commands")
end
function drawDesktop()
term.setBackgroundColor(backColor)
term.clear()
bground = paintutils.loadImage(".background")
paintutils.drawImage(bground,1,1)
titleBar()
end
function drawMenu1()
term.setTextColor(256)
term.setBackgroundColor(128)
term.setCursorPos(1,2)
print(" ")
term.setCursorPos(1,3)
print(" Shutdown ")
term.setCursorPos(1,4)
print(" Restart ")
term.setCursorPos(1,5)
print(" ")
end
function drawMenu2()
term.setTextColor(256)
term.setBackgroundColor(128)
term.setCursorPos(15,2)
print(" ")
term.setCursorPos(15,3)
print(" Start Reactor ")
term.setCursorPos(15,4)
print(" Stop Reactor ")
term.setCursorPos(15,5)
print(" Lock Room ")
term.setCursorPos(15,6)
print(" ")
end
drawDesktop()
while true do
local event, button, X, Y = os.pullEventRaw()
if slc == 0 then
if event == "mouse_click" then
if X >=2 and X <=15 and Y==1 and button ==1 then
drawMenu1()
slc = 1
elseif X >=15 and X <=30 and Y==1 and button ==1 then
drawMenu2()
slc = 1
else
drawDesktop()
end
end
elseif slc == 1 then
if event == "mouse_click" then
if X >=1 and X <=11 and button == 1 and Y== 3 then slc = 0
os.shutdown()
elseif X>=1 and X<=11 and Y==4 and button ==1 then slc = 0
os.reboot()
elseif X>=15 and X<=25 and Y==3 and button ==1 then slc = 0
rednet.open("top")
rednet.broadcast("Reactor 1 On")
rednet.close("top")
rs.setOutput("back", true)
elseif X>=15 and X<=25 and Y==4 and button ==1 then slc = 0
rednet.open("top")
rednet.broadcast("Reactor 1 Off")
rednet.close("top")
rs.setOutput("back", false)
elseif X>=15 and X<=20 and Y==5 and button ==1 then slc = 0
os.shutdown()
else
slc = 0
drawDesktop()
end
end
end
local arg1, arg2 = os.pullEvent("rednet.message")
if arg2 == "Reactor 1 Overheat" then
rs.setOutput("back", false)
os.reboot()
else
drawDesktop()
end
end
Thanks! :)/>
Cheers