Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Desktop
- slc = 0
- tBarC = 8
- tBartC = 1
- backColor = 1
- term.setBackgroundColor(backColor)
- term.clear()
- -- Functions
- 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
- -- Main Loop
- drawDesktop()
- while true do
- local event, arg1, arg2, arg3 = os.pullEvent()
- if event == "mouse_click" then
- if slc == 0 then
- if event == "mouse_click" then
- if arg2 >=2 and arg2 <=15 and arg3==1 and arg1 ==1 then
- drawMenu1()
- slc = 1
- elseif arg2 >=15 and arg2 <=30 and arg3==1 and arg1 ==1 then
- drawMenu2()
- slc = 1
- else
- drawDesktop()
- end
- end
- elseif slc == 1 then
- if event == "mouse_click" then
- if arg2 >=1 and arg2 <=11 and arg1 == 1 and arg3== 3 then
- slc = 0
- os.shutdown()
- elseif arg2>=1 and arg2<=11 and arg3==4 and arg1 ==1 then
- slc = 0
- os.reboot()
- elseif arg2>=15 and arg2<=25 and arg3==3 and arg1 ==1 then
- slc = 0
- rednet.open("top")
- rednet.broadcast("Reactor 1 On")
- rednet.close("top")
- rs.setOutput("back", true)
- elseif arg2>=15 and arg2<=25 and arg3==4 and arg1 ==1 then
- slc = 0
- rednet.open("top")
- rednet.broadcast("Reactor 1 Off")
- rednet.close("top")
- rs.setOutput("back", false)
- elseif arg2>=15 and arg2<=20 and arg3==5 and arg1 ==1 then
- slc = 0
- os.shutdown()
- else
- slc = 0
- drawDesktop()
- end
- end
- end
- elseif event == "rednet_message" and arg2 == "Reactor 1 Overheat" then
- rs.setOutput("back", false)
- rednet.open("top")
- rednet.broadcast("Reactor 1 Off")
- rednet.close("top")
- else
- drawDesktop()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment