SHOW:
|
|
- or go back to the newest paste.
| 1 | os.loadAPI("turtle2")
| |
| 2 | turtle2:reloadConfigs() | |
| 3 | ||
| 4 | local function comeOutOfHole() | |
| 5 | turtle2:up() | |
| 6 | turtle2:forward() | |
| 7 | turtle2:up() | |
| 8 | turtle2:turnLeft() | |
| 9 | end | |
| 10 | ||
| 11 | local slot = 4 | |
| 12 | ||
| 13 | local function farmSquare() | |
| 14 | turtle2.select(1) | |
| 15 | if turtle2:digDown() then | |
| 16 | if turtle2.getItemCount(slot) == 0 then | |
| 17 | slot = slot < 16 and slot + 1 | |
| 18 | if turtle2.getItemCount(slot) == 0 then | |
| 19 | print("out of seed.... ;-(")
| |
| 20 | turtle2.returnHome() | |
| 21 | - | turtle2.select(1) |
| 21 | + | return false |
| 22 | - | if turtle2:digDown() then |
| 22 | + | |
| 23 | end | |
| 24 | - | slot = slot < 16 and slot + 1 |
| 24 | + | turtle2.select(slot) |
| 25 | - | if turtle2.getItemCount(slot) == 0 then |
| 25 | + | if not turtle2:placeDown() then turtle2:digDown() turtle2:placeDown() end |
| 26 | - | print("out of seed.... ;-(")
|
| 26 | + | |
| 27 | - | turtle2.returnHome() |
| 27 | + | |
| 28 | - | return |
| 28 | + | return true |
| 29 | - | end |
| 29 | + | |
| 30 | - | turtle2.select(slot) |
| 30 | + | |
| 31 | while true do | |
| 32 | - | if not turtle2:placeDown() then turtle2:digDown() turtle2:placeDown() end |
| 32 | + | |
| 33 | error("Not enough fuel to make full trip. Please refuel")
| |
| 34 | - | end |
| 34 | + | |
| 35 | comeOutOfHole() | |
| 36 | turn = true | |
| 37 | - | turnFunc(turtle2) turtle2:forward() turnFunc(turtle2) |
| 37 | + | |
| 38 | while turtle2:forward() do | |
| 39 | if not farmSquare() then return end | |
| 40 | end | |
| 41 | turnFunc=turn and turtle2.turnRight or turtle2.turnLeft() | |
| 42 | turnFunc(turtle2) turtle2:forward() farmSquare() turnFunc(turtle2) | |
| 43 | end | |
| 44 | turtle2.returnHome() | |
| 45 | for j=1,16 do | |
| 46 | itemCount = turtle2.getItemCount(j) | |
| 47 | if itemCount > 1 then | |
| 48 | turtle2.select(j) | |
| 49 | turtle2.dropDown(itemCount-1) | |
| 50 | end | |
| 51 | end | |
| 52 | sleep(4200) --70 min | |
| 53 | end |