SHOW:
|
|
- or go back to the newest paste.
| 1 | --[[ | |
| 2 | Changes: | |
| 3 | Turtles no longer monitor how many rows they've gone forward (no more rowsProgressed file) | |
| 4 | Master turtle simply waits for (numberNeighbours) unique turtles to send messages saying | |
| 5 | they are ready and waiting. Slave turtles repeatedly send ready and waiting signals to prevent | |
| 6 | the sync problems we were having before. | |
| 7 | --]] | |
| 8 | ||
| 9 | -- Open up modem to receive wireless broadcasts | |
| 10 | rednet.open("right")
| |
| 11 | ||
| 12 | -- Wait until neighbouring turtles are ready | |
| 13 | function waitForMaster() | |
| 14 | local event, param1, param2 | |
| 15 | ||
| 16 | rednet.broadcast("I am ready and waiting master")
| |
| 17 | os.startTimer(1) | |
| 18 | ||
| 19 | while true do | |
| 20 | event, param1, param2 = os.pullEvent() | |
| 21 | ||
| 22 | -- Resend ready message every second, in case master is not yet ready | |
| 23 | if event == "timer" then | |
| 24 | rednet.broadcast("I am ready and waiting master")
| |
| 25 | os.startTimer(1) | |
| 26 | ||
| 27 | -- Wait for master turtle to give the OK to proceed before continuing digging | |
| 28 | elseif event == "rednet_message" then | |
| 29 | local message = param2 | |
| 30 | if message == "You are authorised to proceed" then | |
| 31 | break | |
| 32 | end -- if message | |
| 33 | end -- if event | |
| 34 | end -- while | |
| 35 | end -- function | |
| 36 | ||
| 37 | bool=true | |
| 38 | ||
| 39 | while bool==true do | |
| 40 | if rs.getInput("back", true) then
| |
| 41 | print ("Waiting")
| |
| 42 | sleep (1) | |
| 43 | else | |
| 44 | print ("Let's Roll!")
| |
| 45 | bool=false | |
| 46 | end | |
| 47 | end | |
| 48 | ||
| 49 | X=66 | |
| 50 | ||
| 51 | print ("Startup Functions Activating")
| |
| 52 | print ("Going to lowest point")
| |
| 53 | ||
| 54 | turtle.select(1) | |
| 55 | turtle.dig() | |
| 56 | turtle.select(3) | |
| 57 | turtle.back() | |
| 58 | ||
| 59 | while true do | |
| 60 | local mobsPresent = turtle.attackDown() | |
| 61 | local digSuccess = turtle.digDown() | |
| 62 | local movementSuccess = turtle.down() | |
| 63 | ||
| 64 | if not mobsPresent and not digSuccess and not movementSuccess then | |
| 65 | break | |
| 66 | end | |
| 67 | end | |
| 68 | ||
| 69 | for b = 1, X do | |
| 70 | turtle.digUp() | |
| 71 | while not turtle.up() do | |
| 72 | turtle.attackUp() | |
| 73 | end | |
| 74 | end | |
| 75 | ||
| 76 | - | print ("Calibrated level for a flat bedrock world.")
|
| 76 | + | |
| 77 | print ("Starting World Eating Scripts!")
| |
| 78 | print ("---------------------------")
| |
| 79 | ||
| 80 | turtle.dig() | |
| 81 | ||
| 82 | while not turtle.forward() do | |
| 83 | turtle.attack() | |
| 84 | end | |
| 85 | ||
| 86 | while true do | |
| 87 | ||
| 88 | ||
| 89 | - | for i = 1, 2 do |
| 89 | + | |
| 90 | ||
| 91 | ||
| 92 | ||
| 93 | ore = false | |
| 94 | - | while not turtle.down() do |
| 94 | + | |
| 95 | - | turtle.attackDown() |
| 95 | + | |
| 96 | ||
| 97 | for c = 1, X do | |
| 98 | turtle.select(2) | |
| 99 | ore = turtle.compareDown() | |
| 100 | if ore == true then | |
| 101 | ||
| 102 | for t = 1, c do | |
| 103 | turtle.digUp() | |
| 104 | while not turtle.up() | |
| 105 | turtle.digUp() | |
| 106 | turtle.attackUp() | |
| 107 | end | |
| 108 | end | |
| 109 | else | |
| 110 | ||
| 111 | turtle.dig() | |
| 112 | turtle.digDown() | |
| 113 | while not turtle.down() do | |
| 114 | turtle.attackDown() | |
| 115 | - | Fuel = turtle.getFuelLevel() |
| 115 | + | end |
| 116 | end | |
| 117 | - | print ("Fuel level is: "..Fuel)
|
| 117 | + | |
| 118 | ||
| 119 | - | if Fuel >= 8192 then |
| 119 | + | if ore == false then |
| 120 | for d = 1, X do | |
| 121 | - | print ("Fuel level is above minimum safe limit.")
|
| 121 | + | |
| 122 | turtle.digUp() | |
| 123 | - | else |
| 123 | + | |
| 124 | turtle.attackUp() | |
| 125 | - | print ("Fuel is below safe limit! Refueling!")
|
| 125 | + | |
| 126 | else | |
| 127 | - | turtle.select(3) |
| 127 | + | |
| 128 | - | turtle.dig() |
| 128 | + | |
| 129 | - | turtle.select(2) |
| 129 | + | |
| 130 | - | while not turtle.place() do |
| 130 | + | |
| 131 | - | turtle.select(3) |
| 131 | + | |
| 132 | - | turtle.dig() |
| 132 | + | |
| 133 | - | turtle.attack() |
| 133 | + | |
| 134 | - | turtle.select(2) |
| 134 | + | |
| 135 | ||
| 136 | - | turtle.suck() |
| 136 | + | |
| 137 | - | turtle.refuel() |
| 137 | + | |
| 138 | for r = 1, 2 do | |
| 139 | - | |
| 139 | + | |
| 140 | - | turtle.select(3) |
| 140 | + | |
| 141 | - | |
| 141 | + | |
| 142 | end | |
| 143 | ||
| 144 | end | |
| 145 | ||
| 146 | print ("Dropping off items")
| |
| 147 | ||
| 148 | turtle.dig() | |
| 149 | turtle.attack() | |
| 150 | ||
| 151 | ||
| 152 | turtle.select(1) | |
| 153 | while not turtle.place() do | |
| 154 | turtle.select(3) | |
| 155 | turtle.attack() | |
| 156 | turtle.select(1) | |
| 157 | end | |
| 158 | ||
| 159 | for dropslot = 3, 16 do | |
| 160 | turtle.select(dropslot) | |
| 161 | turtle.drop() | |
| 162 | end | |
| 163 | ||
| 164 | waitForMaster() | |
| 165 | ||
| 166 | turtle.select(1) | |
| 167 | ||
| 168 | turtle.dig() | |
| 169 | ||
| 170 | turtle.select(3) | |
| 171 | ||
| 172 | end | |
| 173 | end |