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