View difference between Paste ID: sbDLWcZG and 6ii2abYU
SHOW: | | - or go back to the newest paste.
1-
refill = function()
1+
2
	turtle.digUp()
3-
	if turtle.getFuelLevel()  < 50 then
3+
4-
		repeat
4+
5-
			sleep(3)
5+
6-
			turtle.digUp()
6+
7-
			turtle.placeUp()
7+
8-
			turtle.suckUp()
8+
9-
			turtle.refuel(64)
9+
10-
			turtle.dropUp()
10+
11-
			turtle.digUp()
11+
12-
		until turtle.getFuelLevel() > 50
12+
13
end
14
empty = function()
15
	if turtle.getItemCount(15) >= 1 then
16
		turtle.digUp()
17
		turtle.select(2)
18
		turtle.placeUp()
19
		for i = 3, 16, 1
20
		do
21
			turtle.select(i)
22
			turtle.dropUp(64)
23
		end
24
		turtle.select(2)
25
		turtle.digUp()
26
		turtle.select(1)
27
	end
28
end
29
30
destroy = function()
31
	empty()
32
	turtle.digDown()
33
	turtle.digUp()
34
	while turtle.detect() == true do
35
		turtle.dig()
36
	end
37
end
38
lastdestroy = function()
39
	empty()
40
	turtle.digUp()
41
	turtle.digDown()
42
end
43
row = function(distance)
44
	for i = 0, distance, 1
45
	do
46
		destroy()
47
		turtle.forward()
48
	end
49
end
50
righthook = function()
51
	empty()
52
	turtle.turnRight()
53
	destroy()
54
	turtle.forward()
55
	turtle.turnRight()
56
end
57
lefthook = function()
58
	empty()
59
	turtle.turnLeft()
60
	destroy()
61-
		refill()
61+
62
	turtle.turnLeft()
63
end
64
square = function(Length, Depth)
65
	empty()
66
	if Length % 2 == 0 then
67
		for i = 1, Length, 2
68
		do
69-
	refill()
69+
70
			righthook()
71
			row(Depth)
72
			lefthook()
73
		end
74
		row(Depth)
75
		righthook()
76
		row(Depth)
77-
	refill()
77+
78
		turtle.turnRight()
79
		for i = 0, Length, 1
80
		do
81
			turtle.forward()
82
		end
83
		turtle.turnRight()
84
	elseif Length % 2 ~= 0 then
85
		for i = 0, Length, 2
86
		do
87
			row(Depth)
88
			righthook()
89
			row(Depth)
90
			lefthook()
91
		end
92
		row(Depth)
93
		lastdestroy()
94
		turtle.turnLeft()
95
		turtle.turnLeft()
96
		for i = 0, Depth, 1
97
		do
98-
			refill()
98+
99
		end
100
		turtle.turnRight()
101
		for i = 0, Length, 1 
102
		do
103
			turtle.forward()
104
		end
105
		turtle.turnRight()
106
	elseif Length == 0 then
107
		row(Depth)
108
		turtle.turnLeft()
109
		turtle.turnLeft()
110
		for i = 0, Depth, 1
111
		do
112
			turtle.forward()
113
		end
114
		turtle.turnRight()
115
		turtle.turnRight()
116-
			refill()
116+
117
		turtle.turnRight()
118
		row(Length)
119
		turtle.turnLeft()
120
		turtle.turnLeft()
121
		for i = 0, Length, 1
122-
			refill()
122+
123
			turtle.forward()
124
		end
125
		turtle.turnRight()
126
	end
127
	lastempty()
128
end
129
130
term.write("Select Depth: ")
131
local depth = read()
132-
			refill()
132+
133
term.write("Select Length: ")
134
local length = read()
135
length = length - 2
136
137
square(length, depth)
138
print("Mining Completed")