SHOW:
|
|
- or go back to the newest paste.
| 1 | -- ByUyWEig | |
| 2 | -- rW1DX74j | |
| 3 | -- n50gd8aN | |
| 4 | ||
| 5 | --place turtle in center of hollow hill feature at block 63 (turtle makes 64), coords +- 256,256, facing east | |
| 6 | - | --turtle will autofuel from slot 1 |
| 6 | + | --place a stack of fuel in slot 1, turtle will autofuel as it needs fuel |
| 7 | - | --turtle will return to surface after maxSize area has been cleared |
| 7 | + | |
| 8 | --turtle will return to surface (level 96) after maxSize area has been cleared | |
| 9 | ||
| 10 | ||
| 11 | local curX = 0 | |
| 12 | local curY = 0 | |
| 13 | ||
| 14 | local maxSize = 48 | |
| 15 | ||
| 16 | local function reqFuel(amt) | |
| 17 | while turtle.getFuelLevel() < amt do | |
| 18 | if turtle.getItemCount(1) <= 1 then | |
| 19 | print("out of fuel")
| |
| 20 | - | for slot = 1, 16 do |
| 20 | + | |
| 21 | else | |
| 22 | turtle.refuel(1) | |
| 23 | sleep(1) | |
| 24 | end | |
| 25 | end | |
| 26 | end | |
| 27 | ||
| 28 | local function foundItem(chest) | |
| 29 | ||
| 30 | print("Found a treasure chest!")
| |
| 31 | ||
| 32 | turtle.digDown() | |
| 33 | for slot = 2, 16 do | |
| 34 | if turtle.getItemCount(slot) > 0 then | |
| 35 | turtle.select(slot) | |
| 36 | turtle.dropDown() | |
| 37 | sleep(0) | |
| 38 | end | |
| 39 | end | |
| 40 | turtle.select(1) | |
| 41 | ||
| 42 | local stacks = 0 | |
| 43 | while turtle.suck() do | |
| 44 | stacks = stacks + 1 | |
| 45 | sleep(0) | |
| 46 | end | |
| 47 | turtle.select(16) | |
| 48 | turtle.dig() | |
| 49 | ||
| 50 | print("Looted " .. stacks .. " items.")
| |
| 51 | - | for slot = 1, 16 do |
| 51 | + | |
| 52 | --return to surface | |
| 53 | reqFuel(130) | |
| 54 | ||
| 55 | for x = 1, 64 do | |
| 56 | while not turtle.up() do | |
| 57 | turtle.digUp() | |
| 58 | sleep(0) | |
| 59 | end | |
| 60 | end | |
| 61 | ||
| 62 | while not turtle.place() do | |
| 63 | turtle.dig() | |
| 64 | sleep(0) | |
| 65 | end | |
| 66 | for slot = 2, 16 do | |
| 67 | if turtle.getItemCount(slot) > 0 then | |
| 68 | turtle.select(slot) | |
| 69 | turtle.drop() | |
| 70 | sleep(0) | |
| 71 | end | |
| 72 | end | |
| 73 | turtle.select(1) | |
| 74 | ||
| 75 | --dig down and continue quarry | |
| 76 | for x = 1, 64 do | |
| 77 | while not turtle.down() do | |
| 78 | turtle.digDown() | |
| 79 | sleep(0) | |
| 80 | end | |
| 81 | end | |
| 82 | ||
| 83 | end | |
| 84 | ||
| 85 | local function digForward() | |
| 86 | ||
| 87 | local chest | |
| 88 | ||
| 89 | chest = peripheral.wrap("left")
| |
| 90 | if chest then | |
| 91 | turtle.turnLeft() | |
| 92 | foundItem(chest) | |
| 93 | turtle.turnRight() | |
| 94 | end | |
| 95 | chest = peripheral.wrap("front")
| |
| 96 | if chest then | |
| 97 | foundItem(chest) | |
| 98 | end | |
| 99 | chest = peripheral.wrap("right")
| |
| 100 | if chest then | |
| 101 | - | -- [ initialization ] [ mainquarry ] [extra for two return trips] |
| 101 | + | |
| 102 | - | local reqFuel = 32 + ((maxSize / 2 - 8) * 2) + (maxSize * maxSize * 0.33333) + (64 * 4) |
| 102 | + | |
| 103 | turtle.turnLeft() | |
| 104 | end | |
| 105 | - | while turtle.getFuelLevel() < reqFuel do |
| 105 | + | |
| 106 | - | if not turtle.refuel(1) then |
| 106 | + | |
| 107 | - | print("Req Fuel: " .. reqFuel .. " Cur Fuel: " .. turtle.getFuelLevel())
|
| 107 | + | |
| 108 | sleep(0) | |
| 109 | turtle.dig() | |
| 110 | end | |
| 111 | - | turtle.dropUp() |
| 111 | + | |
| 112 | end | |
| 113 | - | while turtle.getItemCount(1) > 0 do |
| 113 | + | |
| 114 | - | print("Remove Excess Fuel")
|
| 114 | + | |
| 115 | - | sleep(1) |
| 115 | + | |
| 116 | local function main() | |
| 117 | turtle.select(1) | |
| 118 | ||
| 119 | --dig down and position to corner of quarry area | |
| 120 | ||
| 121 | reqFuel(maxSize + 32) | |
| 122 | ||
| 123 | for x = 1, 32 do | |
| 124 | repeat turtle.digDown() sleep(0) until turtle.down() | |
| 125 | end | |
| 126 | turtle.turnLeft() | |
| 127 | for x = 1, (maxSize / 2 - 8) do | |
| 128 | turtle.digDown() | |
| 129 | repeat turtle.dig() sleep(0) until turtle.forward() | |
| 130 | end | |
| 131 | turtle.turnLeft() | |
| 132 | for x = 1, (maxSize / 2 - 8) do | |
| 133 | turtle.digDown() | |
| 134 | repeat turtle.dig() sleep(0) until turtle.forward() | |
| 135 | end | |
| 136 | turtle.turnLeft() | |
| 137 | ||
| 138 | --quarry out the level | |
| 139 | curX = 0 | |
| 140 | curY = 0 | |
| 141 | while true do | |
| 142 | reqFuel(10) | |
| 143 | ||
| 144 | if(curY % 2 == 0) then | |
| 145 | digForward() | |
| 146 | curX = curX + 1 | |
| 147 | ||
| 148 | if(curX >= maxSize) then | |
| 149 | turtle.turnLeft() | |
| 150 | digForward() | |
| 151 | digForward() | |
| 152 | digForward() | |
| 153 | turtle.turnLeft() | |
| 154 | curY = curY + 3 | |
| 155 | end | |
| 156 | else | |
| 157 | digForward() | |
| 158 | curX = curX - 1 | |
| 159 | ||
| 160 | if(curX <= 0) then | |
| 161 | turtle.turnRight() | |
| 162 | digForward() | |
| 163 | digForward() | |
| 164 | digForward() | |
| 165 | curY = curY + 3 | |
| 166 | if(curY > maxSize) then | |
| 167 | break | |
| 168 | else | |
| 169 | turtle.turnRight() | |
| 170 | end | |
| 171 | end | |
| 172 | end | |
| 173 | end | |
| 174 | ||
| 175 | --return to surface | |
| 176 | reqFuel(64) | |
| 177 | for x = 1, 64 do | |
| 178 | repeat turtle.digUp() sleep(0) until turtle.up() | |
| 179 | end | |
| 180 | ||
| 181 | end | |
| 182 | ||
| 183 | ||
| 184 | ||
| 185 | main() |