SHOW:
|
|
- or go back to the newest paste.
| 1 | -- os.shutdown() | |
| 2 | os.sleep(1200) | |
| 3 | - | local fieldSize = 16 |
| 3 | + | local fieldSize = 10 |
| 4 | local isOdd = math.ceil(fieldSize/2) ~= (fieldSize/2) | |
| 5 | turtle.select(16) | |
| 6 | for i = 1,fieldSize+1,1 do | |
| 7 | turtle.forward() | |
| 8 | end | |
| 9 | for j = 1,4,1 do | |
| 10 | os.sleep(1) | |
| 11 | turtle.turnLeft() | |
| 12 | for k = 1,fieldSize+1,1 do | |
| 13 | turtle.forward() | |
| 14 | end | |
| 15 | if(not turtle.compareUp()) then | |
| 16 | break | |
| 17 | end | |
| 18 | end | |
| 19 | ||
| 20 | -- if we need more fuel for this pass | |
| 21 | --TODO update for odd | |
| 22 | if (isOdd and turtle.getFuelLevel() < 2*((fieldSize * fieldSize) + 2*fieldSize)) or (turtle.getFuelLevel() < 2*((fieldSize * fieldSize) + fieldSize)) then | |
| 23 | turtle.select(2) | |
| 24 | turtle.suckUp() | |
| 25 | turtle.refuel() | |
| 26 | end | |
| 27 | turtle.select(1) | |
| 28 | -- face outward | |
| 29 | turtle.turnLeft() | |
| 30 | turtle.turnLeft() | |
| 31 | -- loop over the rows | |
| 32 | local turnRight = true | |
| 33 | for x = 1,fieldSize,1 do | |
| 34 | -- loop over the columns (except the last one) | |
| 35 | for y = 1,fieldSize - 1,1 do | |
| 36 | turtle.digDown() | |
| 37 | turtle.placeDown() | |
| 38 | turtle.forward() | |
| 39 | end | |
| 40 | -- harvest the last one | |
| 41 | turtle.digDown() | |
| 42 | turtle.placeDown() | |
| 43 | -- all but the last row | |
| 44 | if x ~= fieldSize then | |
| 45 | -- turn right or left and change column | |
| 46 | if turnRight == true then | |
| 47 | turtle.turnRight() | |
| 48 | turtle.forward() | |
| 49 | turtle.turnRight() | |
| 50 | turnRight = false | |
| 51 | else | |
| 52 | turtle.turnLeft() | |
| 53 | turtle.forward() | |
| 54 | turtle.turnLeft() | |
| 55 | turnRight = true | |
| 56 | end | |
| 57 | end | |
| 58 | end | |
| 59 | ||
| 60 | -- face the starting point | |
| 61 | turtle.turnRight() | |
| 62 | -- go back over the row if there was an odd size | |
| 63 | if isOdd then | |
| 64 | turtle.turnRight() | |
| 65 | for back = 1,(fieldSize-1),1 do | |
| 66 | turtle.forward() | |
| 67 | end | |
| 68 | turtle.turnRight() | |
| 69 | end | |
| 70 | -- go back down the column | |
| 71 | for back = 1,(fieldSize-1),1 do | |
| 72 | turtle.forward() | |
| 73 | end | |
| 74 | -- face the chest | |
| 75 | turtle.turnLeft() | |
| 76 | --empty everything into the chest | |
| 77 | for slot = 2,16,1 do | |
| 78 | turtle.select(slot) | |
| 79 | -- we keep trying to dump inventory | |
| 80 | while turtle.getItemCount(slot) ~= 0 do | |
| 81 | if not turtle.drop() then | |
| 82 | -- if the target inventory was full, we'll try it again later | |
| 83 | os.sleep(10) | |
| 84 | end | |
| 85 | end | |
| 86 | end | |
| 87 | -- reset to the starting conditions | |
| 88 | turtle.select(1) | |
| 89 | -- go again in 60 minutes | |
| 90 | os.sleep(2400) | |
| 91 | os.reboot() |