SHOW:
|
|
- or go back to the newest paste.
| 1 | args = {...}
| |
| 2 | - | width = args[0]; |
| 2 | + | width = args[1]; |
| 3 | - | length = args[1]; |
| 3 | + | length = args[2]; |
| 4 | - | height = args[2]; |
| 4 | + | height = args[3]; |
| 5 | ||
| 6 | turtle.turnRight(); | |
| 7 | for i=0, width/2-1, 1 do | |
| 8 | --Assuming that we were put in the centre of one side of the bottom of the cube | |
| 9 | -- move to the side of the cube to start. | |
| 10 | turtle.dig(); | |
| 11 | while not turtle.forward() do | |
| 12 | turtle.dig() | |
| 13 | end | |
| 14 | turtle.turnLeft(); | |
| 15 | end | |
| 16 | ||
| 17 | ||
| 18 | function mineRow(num) | |
| 19 | for i=0, num, 1 do | |
| 20 | --Dig infront of you. | |
| 21 | while turtle.detect() do | |
| 22 | turtle.dig() | |
| 23 | end | |
| 24 | --dig infront of you if you can't move forward. | |
| 25 | while not turtle.forward() do | |
| 26 | turtle.dig() | |
| 27 | end | |
| 28 | end | |
| 29 | end | |
| 30 | ||
| 31 | function digPlane(x, y) | |
| 32 | for i=0, y, 2 do | |
| 33 | --Mine 1 row | |
| 34 | mineRow(x); | |
| 35 | turtle.turnRight(); | |
| 36 | --Mine column a little | |
| 37 | mineRow(1); | |
| 38 | turtle.turnRight(); | |
| 39 | --Mine 1 row | |
| 40 | mineRow(x); | |
| 41 | turtle.turnLeft(); | |
| 42 | --Exit if we've finished this area. | |
| 43 | if i+2 >= y then | |
| 44 | break | |
| 45 | end | |
| 46 | --Else turn around and get ready for the next one. | |
| 47 | mineRow(1); | |
| 48 | turtle.turnLeft(); | |
| 49 | end | |
| 50 | --Turn around and get ready for the next plane. | |
| 51 | turtle.turnLeft(); | |
| 52 | end | |
| 53 | ||
| 54 | function digCube(x, y, z) | |
| 55 | for i=0, z, 1 do | |
| 56 | digPlane(x, y); | |
| 57 | --Dig above you | |
| 58 | while turtle.detectUp() do | |
| 59 | turtle.digUp() | |
| 60 | end | |
| 61 | --Move up | |
| 62 | while not turtle.up() do | |
| 63 | turtle.digUp() | |
| 64 | end | |
| 65 | end | |
| 66 | end | |
| 67 | ||
| 68 | digCube(length, width, height); |