SHOW:
|
|
- or go back to the newest paste.
| 1 | function digF() | |
| 2 | while not turtle.forward() do | |
| 3 | turtle.dig() | |
| 4 | end | |
| 5 | end | |
| 6 | ||
| 7 | function digU() | |
| 8 | while not turtle.up() do | |
| 9 | turtle.digUp() | |
| 10 | end | |
| 11 | end | |
| 12 | ||
| 13 | function digD() | |
| 14 | while not turtle.down() do | |
| 15 | turtle.digDown() | |
| 16 | end | |
| 17 | end | |
| 18 | ||
| 19 | function detectU() | |
| 20 | while turtle.detectUp() do | |
| 21 | turtle.digUp() | |
| 22 | end | |
| 23 | end | |
| 24 | ||
| 25 | function detectD() | |
| 26 | while turtle.detectDown() do | |
| 27 | turtle.digDown() | |
| 28 | end | |
| 29 | end | |
| 30 | ||
| 31 | function tF() | |
| 32 | while turtle.getFuelLevel()==0 do | |
| 33 | turtle.refuel() | |
| 34 | end | |
| 35 | end | |
| 36 | ||
| 37 | function rL() | |
| 38 | while not turtle.detect() do | |
| 39 | turtle.turnLeft() | |
| 40 | - | while not turtle.detect() |
| 40 | + | |
| 41 | - | turtle.turnRight() |
| 41 | + | |
| 42 | - | turtle.turnRight() |
| 42 | + | |
| 43 | - | while not turtle.detect() do |
| 43 | + | |
| 44 | - | turtle.turnLeft() |
| 44 | + | |
| 45 | - | turtle.digF() |
| 45 | + | |
| 46 | - | else |
| 46 | + | |
| 47 | - | turtle.digF() |
| 47 | + | |
| 48 | end | |
| 49 | ||
| 50 | print("Enter lenght vaule of corridor")
| |
| 51 | local lenght=read()/2 | |
| 52 | ||
| 53 | for i=1,lenght do | |
| 54 | tF() | |
| 55 | digF() | |
| 56 | digU() | |
| 57 | digF() | |
| 58 | digD() | |
| 59 | end |