View difference between Paste ID: HmgeTs3x and 68wFPyAZ
SHOW: | | - or go back to the newest paste.
1
os.loadAPI("predictPath.lua")
2
os.loadAPI("turtleToCords.lua")
3
os.loadAPI("userInput.lua")
4
os.loadAPI("getTurtleFuel.lua")
5
6-
function getLocation()
6+
--must be started with pick equipped and modem in first slot
7-
	--must be started with pick equipped and modem in first slot
7+
turtle.equipLeft()
8-
	x = tonumber(userInput.getUserInput("X Cord: "))
8+
cx, cy, cz = gps.locate()
9-
	y = tonumber(userInput.getUserInput("Y Cord: "))
9+
turtle.equipLeft()
10-
	z = tonumber(userInput.getUserInput("Z Cord: "))
10+
x = tonumber(userInput.getUserInput("X Cord: "))
11-
	return x, y, z
11+
y = tonumber(userInput.getUserInput("Y Cord: "))
12
z = tonumber(userInput.getUserInput("Z Cord: "))
13
14-
function goToCords(x, y, z)
14+
path = {1}
15-
	path = {1}
15+
predictPath.predictTwo(x, y, z, cx, cy, cz, path)
16-
	predictPath.predict(x, y, z, path)
16+
predictPath.finalWrite(predictPath.getPath())
17-
	predictPath.finalWrite(predictPath.getPath())
17+
fuelcost = predictPath.getFuelCost()
18-
	fuelcost = predictPath.getFuelCost()
18+
if fuelcost > turtle.getFuelLevel() then
19-
	if fuelcost > turtle.getFuelLevel() then
19+
    getTurtleFuel.displayFuelInfo()
20-
	    getTurtleFuel.displayFuelInfo()
20+
	print("Fuel Needed: " .. fuelcost)
21-
		print("Fuel Needed: " .. fuelcost)
21+
    print("Fuel too Low to Start, Please Insert Buckets")
22-
	    print("Fuel too Low to Start, Please Insert Buckets")
22+
    userInput.getUserInput("Type Anything to Refuel")
23-
    	userInput.getUserInput("Type Anything to Refuel")
23+
    shell.run("turtleRefuel.lua")
24-
    	shell.run("turtleRefuel.lua")
24+
25-
	end
25+
if fuelcost > turtle.getFuelLevel() then
26-
	if fuelcost > turtle.getFuelLevel() then
26+
    print("Fuel Still too Low to Start, Terminating Program")
27-
    	print("Fuel Still too Low to Start, Terminating Program")
27+
else
28-
	else
28+
	predictPath.predict(x, y, z)
29-
		turtleToCords.toCords(predictPath.getDiffX(), predictPath.getDiffY(), predictPath.getDiffZ(), predictPath.getNegX(), 	predictPath.getNegY(), predictPath.getNegZ())
29+
    turtleToCords.toCords(predictPath.getDiffX(), predictPath.getDiffY(), predictPath.getDiffZ(), predictPath.getNegX(), predictPath.getNegY(), predictPath.getNegZ())
30-
	end
30+
	predictPath.predict(cx, cy, cz)
31
	turtleToCords.toCords(predictPath.getDiffX(), predictPath.getDiffY(), predictPath.getDiffZ(), predictPath.getNegX(), predictPath.getNegY(), predictPath.getNegZ())
32
end