SHOW:
|
|
- or go back to the newest paste.
| 1 | local t = turtle | |
| 2 | local error = 0 | |
| 3 | ||
| 4 | function openDoor() | |
| 5 | t.select(2) | |
| 6 | if(t.getItemCount(2) > 0) then | |
| 7 | print("Error: ItemCount slot 2 > 0")
| |
| 8 | error = 11 | |
| 9 | return | |
| 10 | end | |
| 11 | rs.setOutput("top",true)
| |
| 12 | sleep(0.05) | |
| 13 | rs.setOutput("top",false)
| |
| 14 | if(t.getItemCount(2) == 0) then | |
| 15 | print("Error: ItemCount slot 2 == 0")
| |
| 16 | error = 12 | |
| 17 | return | |
| 18 | end | |
| 19 | if(not t.transferTo(3)) then | |
| 20 | print("Error: transfer to slot 3 failed")
| |
| 21 | error = 13 | |
| 22 | return | |
| 23 | end | |
| 24 | if(not t.digUp()) then | |
| 25 | print("Error: cannot break Block Breaker")
| |
| 26 | error = 21 | |
| 27 | return | |
| 28 | end | |
| 29 | t.select(1) | |
| 30 | if(not t.placeUp()) then | |
| 31 | print("Error: cannot place Auto Placer")
| |
| 32 | error = 22 | |
| 33 | return | |
| 34 | end | |
| 35 | if(t.getItemCount(1) < 1) then | |
| 36 | print("Error: less than one Auto Placer remaining")
| |
| 37 | error = 14 | |
| 38 | return | |
| 39 | end | |
| 40 | rs.setOutput("left",true)
| |
| 41 | sleep(0.1) | |
| 42 | rs.setOutput("left",false)
| |
| 43 | - | |
| 43 | + | os.pullEvent("redstone")
|
| 44 | if(not rs.getInput("left")) then
| |
| 45 | print("Warning: wrong redstone signal received")
| |
| 46 | local signal = false | |
| 47 | while not signal do | |
| 48 | os.pullEvent("redstone")
| |
| 49 | signal = rs.getInput("left")
| |
| 50 | end | |
| 51 | print("Warning: correct redstone signal received after wrong signal")
| |
| 52 | end | |
| 53 | t.select(3) | |
| 54 | if(t.getItemCount(3) < 3) then | |
| 55 | print("Error: less than three door blocks in slot 3")
| |
| 56 | error = 15 | |
| 57 | return | |
| 58 | end | |
| 59 | if(not t.dropUp(2)) then | |
| 60 | print("Error: cannot drop two items into Auto Placer")
| |
| 61 | error = 31 | |
| 62 | return | |
| 63 | end | |
| 64 | end | |
| 65 | ||
| 66 | function closeDoor() | |
| 67 | ||
| 68 | end |