SHOW:
|
|
- or go back to the newest paste.
| 1 | local sensor = peripheral.wrap('right')
| |
| 2 | ||
| 3 | local isMoving | |
| 4 | local isStart = true | |
| 5 | local isEnd | |
| 6 | ||
| 7 | --0.0, y=-3.0, z=1.0 | |
| 8 | ||
| 9 | function init() | |
| 10 | - | while true do |
| 10 | + | -- Debug |
| 11 | - | while not placeCobbleStone() do |
| 11 | + | shell.run('rm output')
|
| 12 | - | sleep(3) |
| 12 | + | local output = fs.open('output', 'w')
|
| 13 | - | end |
| 13 | + | output.write(sensor.sonicScan()) |
| 14 | - | checkFuel() |
| 14 | + | output.close() |
| 15 | - | moveToEgg() |
| 15 | + | shell.run('pastebin put output')
|
| 16 | - | turtle.dig() |
| 16 | + | |
| 17 | - | returnToBase() |
| 17 | + | |
| 18 | - | transferEgg() |
| 18 | + | |
| 19 | - | sleep(5) |
| 19 | + | |
| 20 | - | end |
| 20 | + | |
| 21 | turtle.forward() | |
| 22 | turtle.forward() | |
| 23 | - | function placeCobbleStone() |
| 23 | + | |
| 24 | - | if ( turtle.getItemCount(1) > 0 and turtle.getItemDetail(1).name == 'minecraft:cobblestone' ) then |
| 24 | + | |
| 25 | - | turtle.select(1) |
| 25 | + | |
| 26 | - | return turtle.place() |
| 26 | + | |
| 27 | - | else |
| 27 | + | |
| 28 | - | error("No Cobblestone")
|
| 28 | + | |
| 29 | - | end |
| 29 | + | |
| 30 | isMoving = true | |
| 31 | turtle.back() | |
| 32 | - | function transferEgg() |
| 32 | + | |
| 33 | - | if ( turtle.getItemCount(2) > 0 and turtle.getItemDetail(2).name == 'minecraft:dragon_egg' ) then |
| 33 | + | |
| 34 | - | turtle.select(2) |
| 34 | + | |
| 35 | - | turtle.dropDown() |
| 35 | + | |
| 36 | - | else |
| 36 | + | |
| 37 | - | error('what the $!@#, there is no egg?!')
|
| 37 | + | |
| 38 | - | end |
| 38 | + | |
| 39 | ||
| 40 | init() |