View difference between Paste ID: yy1teCEF and v8BY7wFR
SHOW: | | - or go back to the newest paste.
1
--Variables
2-
players = {"Whiptails", "Jugoyasan", "Bazookaguy"}
2+
players = {"King5kyline"}
3
open = false
4
x, y = term.getSize()
5
os.pullEvent = os.pullEventRaw
6
7
--Functions
8
function drawAcross(line, char)
9
 term.setCursorPos(1, line)
10
 for i = 1,  x do
11
  term.write(char)
12
 end
13
end
14
15
function drawCentered(line, text)
16
 term.setCursorPos((x - string.len(text))/ 2, line)
17
 term.write(text) 
18
end
19
20
function openDoor()
21
 rs.setOutput("bottom", true)
22
 sleep(3.0)
23
 rs.setOutput("bottom", false)
24
 sleep(0.1)
25
end
26
27
function soundAlarm()
28
 rs.setOutput("top", true)
29
 sleep(5.0)
30
 rs.setOutput("top", false)
31
 sleep(0.1)
32
end
33
34
--Body code
35
term.clear()
36
drawAcross(1, "*")
37-
drawCentered(2, "WhipCorp security system V1")
37+
drawCentered(2, "Devils House Security System")
38
drawAcross(3, "*")
39
40
while true do
41
 event, p1 = os.pullEvent()
42
 
43
 if event == "player" then
44
  for i = 1, #players do
45
   if players[i] == p1 then
46
    openDoor()
47
    open = true
48
    end
49
  end
50
  
51
  if not open then
52
   soundAlarm()
53
  end
54
    
55
 end
56
  
57
 if event == "redstone" then
58
  openDoor()
59
 end
60
    
61
 if (event == "key") and (p1 == 16) then
62
  break
63
 end
64
65
end