SHOW:
|
|
- or go back to the newest paste.
| 1 | - | --[[ |
| 1 | + | |
| 2 | - | Changes: |
| 2 | + | |
| 3 | - | Turtles no longer monitor how many rows they've gone forward (no more rowsProgressed file) |
| 3 | + | |
| 4 | - | Master turtle simply waits for (numberNeighbours) unique turtles to send messages saying |
| 4 | + | |
| 5 | - | they are ready and waiting. Slave turtles repeatedly send ready and waiting signals to prevent |
| 5 | + | |
| 6 | - | the sync problems we were having before. |
| 6 | + | |
| 7 | - | --]] |
| 7 | + | |
| 8 | print ("Let's Roll!")
| |
| 9 | - | -- Open up modem to receive wireless broadcasts |
| 9 | + | |
| 10 | - | rednet.open("right")
|
| 10 | + | |
| 11 | end | |
| 12 | - | -- Wait until neighbouring turtles are ready |
| 12 | + | |
| 13 | - | function waitForMaster() |
| 13 | + | |
| 14 | - | local event, param1, param2 |
| 14 | + | |
| 15 | ||
| 16 | - | rednet.broadcast("I am ready and waiting master")
|
| 16 | + | |
| 17 | - | os.startTimer(1) |
| 17 | + | |
| 18 | print ("Starting ORE FINDING PROTOCOLS!")
| |
| 19 | print ("---------------------------")
| |
| 20 | - | event, param1, param2 = os.pullEvent() |
| 20 | + | |
| 21 | ||
| 22 | - | -- Resend ready message every second, in case master is not yet ready |
| 22 | + | |
| 23 | - | if event == "timer" then |
| 23 | + | |
| 24 | - | rednet.broadcast("I am ready and waiting master")
|
| 24 | + | |
| 25 | - | os.startTimer(1) |
| 25 | + | |
| 26 | - | |
| 26 | + | |
| 27 | - | -- Wait for master turtle to give the OK to proceed before continuing digging |
| 27 | + | |
| 28 | - | elseif event == "rednet_message" then |
| 28 | + | |
| 29 | - | local message = param2 |
| 29 | + | |
| 30 | - | if message == "You are authorised to proceed" then |
| 30 | + | |
| 31 | - | break |
| 31 | + | |
| 32 | - | end -- if message |
| 32 | + | |
| 33 | - | end -- if event |
| 33 | + | |
| 34 | - | end -- while |
| 34 | + | |
| 35 | - | end -- function |
| 35 | + | |
| 36 | moves = moves + 1 | |
| 37 | while not turtle.down() do | |
| 38 | turtle.attack() | |
| 39 | end | |
| 40 | sleep(.5) | |
| 41 | turtle.select(2) | |
| 42 | ore = turtle.compareDown() | |
| 43 | turtle.select(3) | |
| 44 | end | |
| 45 | ||
| 46 | for q=1, moves do | |
| 47 | turtle.digUp() | |
| 48 | while not turtle.up() do | |
| 49 | turtle.attack() | |
| 50 | turtle.digUp() | |
| 51 | end | |
| 52 | end | |
| 53 | ||
| 54 | - | print ("Starting World Eating Scripts!")
|
| 54 | + | |
| 55 | ||
| 56 | turtle.dig() | |
| 57 | while not turtle.forward() do | |
| 58 | turtle.attack() | |
| 59 | turtle.dig() | |
| 60 | end | |
| 61 | ||
| 62 | ||
| 63 | print ("Dropping off items")
| |
| 64 | ||
| 65 | turtle.dig() | |
| 66 | turtle.attack() | |
| 67 | ||
| 68 | ||
| 69 | turtle.select(1) | |
| 70 | while not turtle.place() do | |
| 71 | turtle.select(3) | |
| 72 | turtle.attack() | |
| 73 | turtle.dig() | |
| 74 | turtle.select(1) | |
| 75 | end | |
| 76 | ||
| 77 | for dropslot = 3, 16 do | |
| 78 | turtle.select(dropslot) | |
| 79 | turtle.drop() | |
| 80 | end | |
| 81 | ||
| 82 | turtle.select(1) | |
| 83 | ||
| 84 | turtle.dig() | |
| 85 | ||
| 86 | turtle.select(3) | |
| 87 | ||
| 88 | end |