SHOW:
|
|
- or go back to the newest paste.
| 1 | -- Turtle Boscaiola by Keledan75 | |
| 2 | -- Youtube.com/keledan75 | |
| 3 | ||
| 4 | local tArgs = { ... }
| |
| 5 | ||
| 6 | dimensioneAlbero = tArgs[1] | |
| 7 | --dimensioneAlbero = "4" | |
| 8 | print ("Dimensione: " .. dimensioneAlbero)
| |
| 9 | ||
| 10 | function scavaSu() | |
| 11 | altezza = 0 | |
| 12 | while turtle.detectUp() do | |
| 13 | turtle.digUp() | |
| 14 | turtle.up() | |
| 15 | altezza = altezza + 1 | |
| 16 | end | |
| 17 | return altezza | |
| 18 | end | |
| 19 | ||
| 20 | function scavaGiu(altezza) | |
| 21 | for i= 1, altezza do | |
| 22 | turtle.digDown() | |
| 23 | turtle.down() | |
| 24 | end | |
| 25 | end | |
| 26 | ||
| 27 | function scendi() | |
| 28 | while not turtle.detectDown() do | |
| 29 | turtle.down() | |
| 30 | end | |
| 31 | end | |
| 32 | ||
| 33 | if dimensioneAlbero == "1" then | |
| 34 | turtle.dig() | |
| 35 | turtle.forward() | |
| 36 | altezza = scavaSu() | |
| 37 | scendi() | |
| 38 | elseif dimensioneAlbero == "4" then | |
| 39 | turtle.dig() | |
| 40 | turtle.forward() | |
| 41 | altezza = scavaSu() | |
| 42 | turtle.dig() | |
| 43 | turtle.forward() | |
| 44 | scavaGiu(altezza) | |
| 45 | ||
| 46 | turtle.turnRight() | |
| 47 | turtle.dig() | |
| 48 | turtle.forward() | |
| 49 | altezza = scavaSu() | |
| 50 | ||
| 51 | turtle.turnRight() | |
| 52 | turtle.dig() | |
| 53 | turtle.forward() | |
| 54 | scavaGiu(altezza) | |
| 55 | ||
| 56 | turtle.turnRight() | |
| 57 | turtle.forward() | |
| 58 | turtle.turnLeft() | |
| 59 | ||
| 60 | end |