SHOW:
|
|
- or go back to the newest paste.
| 1 | near=true | |
| 2 | blocksTravelled = 0 | |
| 3 | ||
| 4 | function detectLava() | |
| 5 | - | turtle.up() |
| 5 | + | while not turtle.up() do |
| 6 | turtle.digUp() | |
| 7 | end | |
| 8 | for i=0, 1, 1 do | |
| 9 | if not turtle.detectUp() then | |
| 10 | if turtle.digUp() then | |
| 11 | turtle.placeUp() | |
| 12 | end | |
| 13 | end | |
| 14 | turtle.turnLeft() | |
| 15 | if not turtle.detect() then | |
| 16 | if turtle.dig() then | |
| 17 | turtle.place() | |
| 18 | end | |
| 19 | end | |
| 20 | turtle.turnRight() | |
| 21 | turtle.turnRight() | |
| 22 | if not turtle.detect() then | |
| 23 | if turtle.dig() then | |
| 24 | turtle.place() | |
| 25 | end | |
| 26 | end | |
| 27 | turtle.turnLeft() | |
| 28 | if i == 0 then | |
| 29 | turtle.down() | |
| 30 | end | |
| 31 | end | |
| 32 | end | |
| 33 | ||
| 34 | function mine(num) | |
| 35 | for i=0, num, 1 do | |
| 36 | while turtle.detectUp() do | |
| 37 | turtle.digUp() | |
| 38 | end | |
| 39 | while turtle.detect() do | |
| 40 | turtle.dig() | |
| 41 | end | |
| 42 | while not turtle.forward() do | |
| 43 | turtle.dig() | |
| 44 | end | |
| 45 | detectLava() | |
| 46 | end | |
| 47 | end | |
| 48 | ||
| 49 | function checkInventory() | |
| 50 | if turtle.getItemCount(8) > 0 then | |
| 51 | dropOff() | |
| 52 | end | |
| 53 | end | |
| 54 | ||
| 55 | function dropOff() | |
| 56 | turtle.turnRight() | |
| 57 | turtle.turnRight() | |
| 58 | for i=0, (blocksTravelled - 1), 1 do | |
| 59 | turtle.forward() | |
| 60 | end | |
| 61 | if not near then | |
| 62 | turtle.turnLeft() | |
| 63 | for i=0, 16, 1 do | |
| 64 | turtle.forward() | |
| 65 | end | |
| 66 | turtle.turnRight() | |
| 67 | end | |
| 68 | sleep(10) | |
| 69 | turtle.turnRight() | |
| 70 | turtle.turnRight() | |
| 71 | if not near then | |
| 72 | turtle.turnLeft() | |
| 73 | for i=0, 16, 1 do | |
| 74 | turtle.forward() | |
| 75 | end | |
| 76 | turtle.turnRight() | |
| 77 | end | |
| 78 | for i=0, blocksTravelled - 1, 1 do | |
| 79 | turtle.forward() | |
| 80 | end | |
| 81 | end | |
| 82 | ||
| 83 | function segment(mirror) | |
| 84 | turn = function() error("Turn not being assigned") end
| |
| 85 | reverseTurn = function() error("ReverseTurn not being assigned") end
| |
| 86 | if mirror == true then | |
| 87 | turn = turtle.turnRight | |
| 88 | reverseTurn = turtle.turnLeft | |
| 89 | else | |
| 90 | turn = turtle.turnLeft | |
| 91 | reverseTurn = turtle.turnRight | |
| 92 | end | |
| 93 | turn() | |
| 94 | mine(16) | |
| 95 | near = not near | |
| 96 | turn() | |
| 97 | mine(2) | |
| 98 | reverseTurn() | |
| 99 | reverseTurn() | |
| 100 | mine(5) | |
| 101 | blocksTravelled = blocksTravelled + 3 | |
| 102 | checkInventory() | |
| 103 | end | |
| 104 | ||
| 105 | for i=0, 10, 1 do | |
| 106 | segment(false) | |
| 107 | segment(true) | |
| 108 | end |