Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Rooms = {"Elevator","Hallway"}
- table.insert(Rooms,#Rooms + 1,"SHUTDOWN")
- table.insert(Rooms,#Rooms + 1,"ON")
- local activL = {}
- local activO = {}
- local mon = peripheral.wrap("top")
- local add = true
- local lockdown = false
- mon.clear()
- local highlighted = 1
- for i=1,#Rooms,1 do
- table.insert(activL,"1")
- table.insert(activO,"1")
- end
- term.redirect(peripheral.wrap("top"))
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mon.setBackgroundColor(colors.black)
- paintutils.drawFilledBox(1,38,6,40,colors.red)
- mon.setBackgroundColor(colors.black)
- while true do
- mon.setBackgroundColor(colors.black)
- mon.clear()
- if lockdown == false then
- paintutils.drawFilledBox(1,38,6,40,colors.red)
- mon.setBackgroundColor(colors.black)
- else
- paintutils.drawFilledBox(1,38,6,40,colors.purple)
- mon.setBackgroundColor(colors.black)
- end
- mon.setCursorPos(1,1)
- if lockdown == false then
- mon.write("Lights:")
- else
- mon.write("Lock Down: ")
- end
- local x = 2
- local a = 1
- for i = 1,#Rooms,1 do
- mon.setCursorPos(a,x)
- x = x + 1
- if activL[i] == "1" and lockdown == false then
- mon.setTextColor(colors.green)
- elseif activL[i] == "0" and lockdown == false then
- mon.setTextColor(colors.red)
- elseif activO[i] == "1" and lockdown == true then
- mon.setTextColor(colors.green)
- elseif activO[i] == "0" and lockdown == true then
- mon.setTextColor(colors.red)
- end
- if highlighted == i then
- mon.write("> "..Rooms[i].." ")
- else
- mon.write(" "..Rooms[i].." ")
- end
- mon.setTextColor(colors.white)
- end
- if activL[highlighted] == "1" then
- paintutils.drawFilledBox(25,38,30,40,colors.green)
- else
- paintutils.drawFilledBox(25,38,30,40,colors.red)
- end
- local event, side, x, y = os.pullEvent()
- if event == "monitor_touch" then
- if x > 25 and y > 38 then
- if activL[highlighted] == "0" and lockdown == false then
- table.remove(activL,highlighted)
- table.insert(activL,highlighted,"1")
- elseif activL[highlighted] == "1" and lockdown == false then
- table.remove(activL,highlighted)
- table.insert(activL,highlighted,"0")
- elseif activO[highlighted] == "0" and lockdown == true then
- table.remove(activO,highlighted)
- table.insert(activO,highlighted,"1")
- elseif activO[highlighted] == "1" and lockdown == true then
- table.remove(activO,highlighted)
- table.insert(activO,highlighted,"0")
- end
- if highlighted == #Rooms - 1 then
- activL = {}
- for i = 1,#Rooms,1 do
- table.insert(activL,"0")
- end
- end
- if highlighted == #Rooms then
- os.reboot()
- end
- elseif x > 1 and x < 6 and y >38 and y < 41 then
- if lockdown == true then
- lockdown = false
- else
- lockdown = true
- end
- else
- highlighted = highlighted + 1
- if highlighted > #Rooms then
- highlighted = 1
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement