View difference between Paste ID: BijuTSsz and 38fRGVaB
SHOW: | | - or go back to the newest paste.
1
function move()
2
	if (turtle.getItemCount(16) ~= 0) then
3
		dropItems()
4
	end
5
	if(turtle.getFuelLevel() == 0) then
6
		error("Out of fuel")
7
	end
8
	while (not turtle.forward()) do
9
		turtle.dig()
10
	end
11
end
12
13
function right()
14
	turtle.turnRight()
15
end
16
17
function left()
18
	turtle.turnLeft()
19
end
20
21
function down()
22
	turtle.digDown()
23
	turtle.down()
24
end
25
26
function outer()
27
	digside1()
28
	right()
29
	digside2()
30
	right()
31
	digside1()
32
	right()
33
end
34
35
function digside1()
36
	for num = 2, side1 do
37
		move()
38
	end
39
end
40
41
function digside2()
42
	for num = 2, side2 do
43
		move()
44
	end
45
end
46
47
function inner()
48
	peaks = (side2 / 2) - 1
49
	for num = 1, peaks do
50
		ascend()
51
		descend()
52
	end
53
	move()
54
	right()
55
	if(oddSide) then
56
		oddSideFix()
57
	end
58
end
59
60
function ascend()
61
	move()
62
	right()
63
	for num = 3, side1 do
64
		move()
65
	end
66
	left()
67
end
68
69
function descend()
70
	move()
71
	left()
72
	for num = 3, side1 do
73
		move()
74
	end
75
	right()
76
end
77
78
function oddSideFix()
79
	for num = 3, side1 do
80
		move()
81
	end
82
	left()
83
	left()
84
	for num = 3, side1 do
85
		move()
86
	end
87
	right()
88
	move()
89
	right()
90
end
91
92
function dropItems()
93
	right()
94
	right()
95
	turtle.select(1)
96
	while (not turtle.place()) do
97
		turtle.dig()
98
	end
99
	for num = 2, 16 do
100
		turtle.select(num)
101
		turtle.drop()
102
	end
103
	turtle.select(2)
104
	left()
105
	left()
106
	if(turtle.getItemCount(1) == 0) then
107
		error("Out of chests")
108
	end
109
end
110
111
-------------------------
112
113
local args = { ... }
114
115-
arg1 = args[1]
115+
116-
arg2 = args[2]
116+
117-
arg3 = args[3]
117+
118
119
oddSide = false
120
121
if(side2 % 2 == 1) then
122
	oddSide = true
123
end
124
125
if(turtle.getItemCount(1) == 0) then
126
	error("Place chests in slot 1 and try again")
127
end
128
129
print(" ")
130
print("Excavating these dimensions:")
131
print("Out: " .. side1)
132
print("Across: " .. side2)
133
print("Down: " .. depth)
134
print(" ")
135
136
layers = 0
137
while(layers < depth) do
138
	outer()
139
	inner()
140
	layers = layers + 1
141
	if(layers < depth) then down() end
142
	print((100*layers/depth) .. "% complete")
143
end
144
145
print(" ")
146
print("Done!")