View difference between Paste ID: 4YAwvA3m and D938ccJ8
SHOW: | | - or go back to the newest paste.
1
args = {...}
2
width = args[1];
3
length = 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, 1 do
33
		--Mine 1 row
34-
		mineRow(x);
34+
		mineRow(x/2);
35
		turtle.turnLeft();
36
		--Else turn around and get ready for the next one.
37
		mineRow(0);
38
		turtle.turnLeft();
39
		--Mine 1 row
40-
		mineRow(x);
40+
		mineRow(x/2);
41
		turtle.turnRight();
42
		--Exit if we've finished this area.
43
		if i+1 >= y then
44
			break
45
		end
46
		--Mine column a little
47
		mineRow(0);
48
		turtle.turnRight();
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);