Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.setTextColor(colors.red)
- print("Airlock v1 Starting...")
- d0 = false
- d1 = false
- ready = true
- m0 = peripheral.wrap("monitor_0")
- m1 = peripheral.wrap("monitor_1")
- m = peripheral.wrap("back")
- m0.clear()
- m1.clear()
- m.clear()
- m.setTextColor(colors.white)
- m.setCursorPos(1,1)
- for i=1,18 do m.write("#") end
- m.setCursorPos(1,12)
- for i=1,18 do m.write("#") end
- for i=1,12 do m.setCursorPos(1,i) m.write("#") end
- for i=1,12 do m.setCursorPos(18,i) m.write("#") end
- m.setTextColor(colors.gray)
- m.setCursorPos(3,2)
- m.write("Airlock Status")
- m0.setTextColor(colors.gray)
- m0.setCursorPos(1,1)
- m0.write("Status:")
- m1.setTextColor(colors.gray)
- m1.setCursorPos(1,1)
- m1.write("Status:")
- m1.setBackgroundColor(colors.red)
- m1.setTextColor(colors.white)
- m1.setCursorPos(1,5)
- m1.write("TRIGGER")
- m1.setBackgroundColor(colors.red)
- m1.setTextColor(colors.white)
- m1.setCursorPos(1,5)
- m1.write("TRIGGER")
- function door1()
- if not d2
- if d1 then
- redstone.setOutput("left",true)
- else
- redstone.setOutput("left",false)
- end
- else
- d2 = 0
- end
- end
- function door2()
- if not d1 then
- if d2 then
- redstone.setOutput("right",true)
- else
- redstone.setOutput("right",false)
- end
- else
- d1 = 0
- end
- end
- function updateMonitor()
- if (d1) or (d2) then
- m.setCursorPos(7,3)
- m.setTextColor(colors.red)
- m.write("!OPEN!")
- m.setCursorPos(1,2)
- m.setTextColor(colors.red)
- m.write("!OPEN!")
- m.setCursorPos(1,2)
- m.setTextColor(colors.red)
- m.write("!OPEN!")
- else
- m.setCursorPos(7,3)
- m.setTextColor(colors.lime)
- m.write("Ready")
- m.setCursorPos(2,2)
- m.setTextColor(colors.red)
- m.write("Ready")
- m.setCursorPos(2,2)
- m.setTextColor(colors.red)
- m.write("Ready")
- end
- end
- function updateRednet()
- if (d1) then d2 = 0 door2() end
- if (d2) then d1 = 0 door1() end
- end
- while true do
- updateMonitor()
- updateRednet()
- mon = os.pullEvent("monitor_touch")
- if mon = "monitor_0" then
- door1()
- end
- if
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement