SHOW:
|
|
- or go back to the newest paste.
| 1 | - | -- Last pos: -7944 |
| 1 | + | SAFE_SLOTS = 1 |
| 2 | - | SAFE_SLOTS = 3 |
| 2 | + | |
| 3 | SLOT_COUNT = 16 | |
| 4 | ||
| 5 | - | CHUNK_LOADER_PERIOD=16 |
| 5 | + | |
| 6 | for slot = SAFE_SLOTS + 1, SLOT_COUNT do | |
| 7 | turtle.select(slot) | |
| 8 | if turtle.compareTo(2) and turtle.getItemCount() > 1 then | |
| 9 | return | |
| 10 | end | |
| 11 | end | |
| 12 | end | |
| 13 | ||
| 14 | function placeFiller(direction) | |
| 15 | if direction == nil then | |
| 16 | - | function selectFillerDestination() |
| 16 | + | |
| 17 | - | turtle.select(SAFE_SLOTS + 1) |
| 17 | + | |
| 18 | ||
| 19 | while turtle['detect' .. direction]() do | |
| 20 | turtle['dig' .. direction]() | |
| 21 | end | |
| 22 | selectFiller() | |
| 23 | turtle['place' .. direction]() | |
| 24 | end | |
| 25 | ||
| 26 | - | selectFillerDestination() |
| 26 | + | |
| 27 | if direction == nil then | |
| 28 | direction = '' | |
| 29 | end | |
| 30 | ||
| 31 | while turtle['detect' .. direction]() do | |
| 32 | selectFiller() | |
| 33 | turtle['place' .. direction]() | |
| 34 | turtle['dig' .. direction]() | |
| 35 | end | |
| 36 | end | |
| 37 | ||
| 38 | function move(direction) | |
| 39 | clear(direction) | |
| 40 | ||
| 41 | - | selectFillerDestination() |
| 41 | + | |
| 42 | turtle.forward() | |
| 43 | elseif direction == 'Up' then | |
| 44 | turtle.up() | |
| 45 | else | |
| 46 | turtle.down() | |
| 47 | end | |
| 48 | end | |
| 49 | ||
| 50 | function dropNonFuel() | |
| 51 | for slot = LAST_FILLER_SLOT + 1, SLOT_COUNT do | |
| 52 | turtle.select(slot) | |
| 53 | if not turtle.refuel() then | |
| 54 | turtle.drop() | |
| 55 | end | |
| 56 | end | |
| 57 | end | |
| 58 | ||
| 59 | function buildLayer(width, height) | |
| 60 | direction = 'Right' | |
| 61 | for x = 1, width do | |
| 62 | for y = 1, height - 1 do | |
| 63 | clear('Down')
| |
| 64 | move() | |
| 65 | end | |
| 66 | clear('Down')
| |
| 67 | turtle['turn' .. direction]() | |
| 68 | - | local startFuel = turtle.getFuelLevel() |
| 68 | + | |
| 69 | - | local left = math.floor(width / 2) |
| 69 | + | turtle['turn' .. direction]() |
| 70 | - | local right = left |
| 70 | + | if direction == 'Right' then |
| 71 | direction = 'Left' | |
| 72 | - | move() |
| 72 | + | |
| 73 | - | turtle.turnLeft() |
| 73 | + | direction = 'Right' |
| 74 | - | for i = 1, left + 1 do |
| 74 | + | |
| 75 | - | placeFiller('Down')
|
| 75 | + | |
| 76 | - | clear('')
|
| 76 | + | |
| 77 | if direction == 'Left' then | |
| 78 | turtle.turnRight() | |
| 79 | move() | |
| 80 | - | placeFiller('Down')
|
| 80 | + | turtle.turnLeft() |
| 81 | else | |
| 82 | - | turtle.turnLeft() |
| 82 | + | turtle.turnLeft() |
| 83 | - | turtle.turnLeft() |
| 83 | + | |
| 84 | - | for i = 1, height - 1 do |
| 84 | + | turtle.turnRight() |
| 85 | - | move('Up')
|
| 85 | + | |
| 86 | - | clear() |
| 86 | + | |
| 87 | - | placeFiller('Down')
|
| 87 | + | move('Down')
|
| 88 | ||
| 89 | dropNonFuel() | |
| 90 | - | placeFiller('Up')
|
| 90 | + | |
| 91 | - | turtle.forward() |
| 91 | + | |
| 92 | - | turtle.turnLeft() |
| 92 | + | |
| 93 | - | turtle.turnLeft() |
| 93 | + | turtle.forward() |
| 94 | - | placeFiller() |
| 94 | + | turtle.forward() |
| 95 | - | turtle.turnLeft() |
| 95 | + | |
| 96 | - | turtle.turnLeft() |
| 96 | + | turtle.forward() |
| 97 | turtle.forward() | |
| 98 | - | for i = 1, width do |
| 98 | + | |
| 99 | - | placeFiller('Up')
|
| 99 | + | |
| 100 | ||
| 101 | for i = 1,45 do | |
| 102 | buildLayer(5, 5) | |
| 103 | - | placeFiller('Up')
|
| 103 | + | end |