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 | - | |
| 36 | + | |
| 37 | function rL() | |
| 38 | while not turtle.detect() do | |
| 39 | turtle.turnLeft() | |
| 40 | while not turtle.detect() | |
| 41 | turtle.turnRight() | |
| 42 | turtle.turnRight() | |
| 43 | while not turtle.detect() do | |
| 44 | turtle.turnLeft() | |
| 45 | turtle.digF() | |
| 46 | else | |
| 47 | turtle.digF() | |
| 48 | end | |
| 49 | end | |
| 50 | ||
| 51 | function rR() | |
| 52 | while turtle.detectRight() do | |
| 53 | turtle.turnRight() | |
| 54 | turtle.dig() | |
| 55 | end | |
| 56 | end | |
| 57 | ||
| 58 | print("Enter lenght vaule of corridor")
| |
| 59 | local lenght=read()/2 | |
| 60 | ||
| 61 | for i=1,lenght do | |
| 62 | tF() | |
| 63 | digF() | |
| 64 | detectD() | |
| 65 | rL() | |
| 66 | detectU() | |
| 67 | digU() | |
| 68 | digF() | |
| 69 | end |