View difference between Paste ID: Y7QdnffL and Mwfsy0Z6
SHOW: | | - or go back to the newest paste.
1
term.setTextColor(colors.red)
2
print("Airlock v1 Starting...")
3
d0 = false
4
d1 = false
5
ready = true
6
7
m0 = peripheral.wrap("monitor_0")
8
m1 = peripheral.wrap("monitor_1")
9
m = peripheral.wrap("back")
10
m0.clear()
11
m1.clear()
12
m.clear()
13
14
m.setTextColor(colors.white)
15
m.setCursorPos(1,1)
16
for i=1,18 do m.write("#") end
17
m.setCursorPos(1,12)
18
for i=1,18 do m.write("#") end
19
for i=1,12 do m.setCursorPos(1,i) m.write("#") end
20
for i=1,12 do m.setCursorPos(18,i) m.write("#") end
21
22
m.setTextColor(colors.gray)
23
m.setCursorPos(3,2)
24
m.write("Airlock Status")
25
26
m0.setTextColor(colors.gray)
27
m0.setCursorPos(1,1)
28
m0.write("Status:")
29
30
m1.setTextColor(colors.gray)
31
m1.setCursorPos(1,1)
32
m1.write("Status:")
33
34
m1.setBackgroundColor(colors.red)
35
m1.setTextColor(colors.white)
36
m1.setCursorPos(1,5)
37
m1.write("TRIGGER")
38
39
m1.setBackgroundColor(colors.red)
40
m1.setTextColor(colors.white)
41
m1.setCursorPos(1,5)
42
m1.write("TRIGGER")
43
44
function door1()
45
  if not d2
46
  if d1 then
47
    redstone.setOutput("left",true)
48
  else
49
    redstone.setOutput("left",false)
50
  end
51
  else
52
  d2 = 0
53
  end
54
end
55
56
function door2()
57
  if not d1 then
58
  if d2 then
59
    redstone.setOutput("right",true)
60
  else
61
    redstone.setOutput("right",false)
62
  end
63
  else
64
  d1 = 0
65
  end
66
end
67
68
function updateMonitor()
69
  if (d1) or (d2) then
70
    m.setCursorPos(7,3)
71
    m.setTextColor(colors.red)
72
    m.write("!OPEN!")  
73
    m.setCursorPos(1,2)
74
    m.setTextColor(colors.red)
75
    m.write("!OPEN!")  
76
    m.setCursorPos(1,2)
77
    m.setTextColor(colors.red)
78
    m.write("!OPEN!")  
79
  else
80
    m.setCursorPos(7,3)
81
    m.setTextColor(colors.lime)
82
    m.write("Ready")
83
    m.setCursorPos(2,2)
84
    m.setTextColor(colors.red)
85
    m.write("Ready")  
86
    m.setCursorPos(2,2)
87
    m.setTextColor(colors.red)
88
    m.write("Ready")  
89
  end
90
end
91
92
function updateRednet()
93
  if (d1) then d2 = 0 door2() end
94
  if (d2) then d1 = 0 door1() end
95
end
96
97
while true do
98
  updateMonitor()
99
  updateRednet()
100
  mon = os.pullEvent("monitor_touch")
101
    if mon = "monitor_0" then
102
      door1()
103
    end
104
    if
105
end