View difference between Paste ID: Vfbw2BsY and FtZ7LJ0A
SHOW: | | - or go back to the newest paste.
1
xCoord = -164
2
zCoord = 195
3
yCoord = 72
4
5
xQuarry = 999
6
zQuarry = 999
7
yQuarry = 150
8
 
9
xProgress = 999
10
zProgress = 999
11
yProgress = 150
12
 
13
oProgress = 1
14
15
xHome = xCoord
16
zHome = zCoord
17
yHome = yCoord
18
 
19
yTravel = 85
20
21
orientation = 4
22
orientations = {"north", "east", "south", "west"}
23
24
zDiff = {-1, 0, 1, 0}
25
xDiff = {0, 1, 0, -1}
26
27
lineLength = 2
28
lines = 3
29
30
yMin = 999
31
32
function inventoryFull()
33
	turtle.select(9)
34
	full = turtle.getItemCount(9) > 0    -- I think this should be an if statement
35
	turtle.select(1)
36
	return full
37
	-- since full wont work (I think) you should do this
38
	if turtle.getItemCount(9) > 0 then
39
		turtle.select(1)
40
		return turtle.getItemCount(9)
41
	else
42
		return false
43
	end
44
end
45
 
46
function left()
47
	orientation = orientation - 1
48
	orientation = (orientation - 1) % 4
49
	orientation = orientation + 1
50
 
51
	turtle.turnLeft()
52
end
53
54
function right()
55
	orientation = orientation - 1
56
	orientation = (orientation + 1) % 4
57
	orientation = orientation + 1
58
	turtle.turnRight()
59
end
60
 
61-
  
61+
62
	xCoord = xCoord + xDiff[orientation]  
63-
  
63+
64-
	full = turtle.getItemCount(9) > 0
64+
65-
  
65+
66
	while not(moved) do
67-
  
67+
68
	end
69
	-- I would write this function like so:
70
	xCoord = xCoord + xDiff[orientation]  
71
	zCoord = zCoord + zDiff[orientation]
72
	move = turtle.forward()
73
	while not move do
74
		move = turtle.forward()
75-
  
75+
76
end
77-
  
77+
78
function moveUp()
79-
  
79+
	yCoord = yCoord + 1 
80
	turtle.digUp()
81
	moved = false
82-
  
82+
83
		moved = turtle.up()
84
	end  
85
	-- Look at the function above
86
end
87
88
function moveDown()
89
	yCoord = yCoord - 1
90-
  
90+
91
	moved = false
92-
  
92+
93
		moved = turtle.down()
94-
  
94+
95
	if yMin > yCoord then   
96
		yMin = yCoord
97-
  
97+
	end 
98
end
99
100
function look(direction)
101
	while direction ~= orientations[orientation] do
102
		right()
103
	end
104
	-- Not sure what this even does
105-
  
105+
106
107-
  
107+
108
	while yTarget < yCoord do
109
		moveDown()
110-
  
110+
111
	while yTarget > yCoord do
112-
  
112+
113
	end
114
	if xTarget < xCoord then
115-
  
115+
116
		while xTarget < xCoord do
117-
    
117+
118
		end
119-
  
119+
	elseif xTarget > xCoord then
120
		look("east")
121
		while xTarget > xCoord do
122
			moveForward()
123
		end
124
	end   
125
	if zTarget < zCoord then
126
		look("north")
127-
  
127+
128-
	yCoord = yCoord + 1
128+
129-
  
129+
130-
  
130+
131
	if zTarget > zCoord then
132
		look("south")
133-
  
133+
134
			moveForward()
135-
  
135+
136
	end
137-
    
137+
138
139-
  
139+
140
	xProgress = xCoord
141
	zProgress = zCoord
142
	yProgress = yCoord
143
	oProgress = orientation
144
	goto(xHome, zHome, yTravel)
145
	goto(xHome, zHome, yHome)
146
	for i = 1,9 do
147-
  
147+
		turtle.select(i)  
148
		turtle.drop()
149
	end
150-
  
150+
151
	goto(xProgress, zProgress, yTravel)
152
	goto(xProgress, zProgress, yProgress)
153-
  
153+
154
end
155
156-
  
156+
157
	for i = 1,lineLength do
158-
    
158+
159
			returnItems()
160-
  
160+
161
		moveForward()
162
	end
163-
  
163+
164
165-
	if yMin > yCoord then
165+
166-
    
166+
167
		digLine()
168-
  
168+
169
			left()
170
			moveForward()    
171
			left()  
172
		elseif i < lines then    
173
			right()    
174
			moveForward()    
175
			right()  
176-
  
176+
177
	end
178-
    
178+
179
	look("north")
180-
  
180+
181
end
182
183
function digQuarry(xTarget, zTarget, yTarget)
184
	xQuarry = xTarget
185
	zQuarry = zTarget
186
	yQuarry = yTarget
187
	
188-
  
188+
189
	goto(xQuarry, zQuarry, yQuarry)
190-
    
190+
191
	look("north")
192-
  
192+
193
		digLayer()
194-
  
194+
195
	goto(xQuarry, zQuarry, yQuarry)
196
	yMin = 999
197-
    
197+
198
199-
  
199+