SHOW:
|
|
- or go back to the newest paste.
1 | -- Constants | |
2 | - | RSFlash = 'bottom' |
2 | + | RS = 'right' |
3 | - | ConstDoor = colors.red -- Silo door open/closed read from RSInput bundle |
3 | + | ConstSwitch = colors.red -- Silo main lights on/off from RS bundle |
4 | - | lightSequence = {3,6,12,9} |
4 | + | ConstTone = colors.green -- Trigger note blocks |
5 | lightSequence = {1,3,7,15,31,63,127,255,511,1023,2047,4095} | |
6 | ||
7 | - | curLight = 1 |
7 | + | |
8 | - | BDoor = false -- Start with the flashing light off and silo door closed |
8 | + | BLight = false -- Start with the lights off |
9 | redstone.setBundledOutput(RS, 0) | |
10 | - | function doFlash() |
10 | + | |
11 | - | print("lightSequence = ", lightSequence[curLight]) |
11 | + | function doLightOn() |
12 | - | redstone.setBundledOutput(RSFlash, lightSequence[curLight]) |
12 | + | for i=1,12 do |
13 | - | curLight = curLight + 1 |
13 | + | print("lightSequence = "..lightSequence[i]) |
14 | - | if curLight > 4 then |
14 | + | redstone.setBundledOutput(RS, lightSequence[i]+ ConstTone) |
15 | - | curLight = 1 |
15 | + | sleep(.75) |
16 | redstone.setBundledOutput(RS, lightSequence[i]) | |
17 | - | end -- doFlash |
17 | + | |
18 | end -- doLightOn | |
19 | - | -- Main Loop |
19 | + | |
20 | function doLightOff() | |
21 | - | print ("RSFlash = ", redstone.getBundledInput(RSFlash)) |
21 | + | for i=11,1,-1 do |
22 | - | if bit.band(redstone.getBundledInput(RSFlash), ConstDoor) == ConstDoor then |
22 | + | print("lightSequence = "..lightSequence[i]) |
23 | - | BDoor = true |
23 | + | redstone.setBundledOutput(RS, lightSequence[i] + ConstTone) |
24 | sleep(.75) | |
25 | - | BDoor = false |
25 | + | redstone.setBundledOutput(RS, lightSequence[i]) |
26 | end | |
27 | - | print ("BDoor = ", BDoor) |
27 | + | redstone.setBundledOutput(RS, ConstTone) |
28 | - | if BDoor == true then |
28 | + | sleep(.75) |
29 | - | doFlash() |
29 | + | redstone.setBundledOutput(RS, 0) |
30 | end -- doLightOff | |
31 | - | redstone.setBundledOutput(RSFlash, 0) |
31 | + | |
32 | ||
33 | - | sleep(.4) |
33 | + | |
34 | if bit.band(redstone.getBundledInput(RS), ConstSwitch) == ConstSwitch then | |
35 | if BLight == false then | |
36 | doLightOn() | |
37 | BLight = true | |
38 | end -- if | |
39 | else | |
40 | if BLight == true then | |
41 | doLightOff() | |
42 | BLight = false | |
43 | end -- if | |
44 | end -- if | |
45 | print ("BLight = ", BLight) | |
46 | sleep(2) | |
47 | end -- main loop |