Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("turtleChest.lua")
- os.loadAPI("predictPath.lua")
- os.loadAPI("turtleOneTrip.lua")
- function getLocation()
- turtle.equipLeft()
- cx, cy, cz = gps.locate()
- turtle.equipLeft()
- return cx, cy, cz
- end
- function predictTotalFuelCostDelivery(x, y, z, cx, cy, cz)
- path = {1}
- predictPath.resetFuelCost()
- predictPath.predictTwo(x, y, z, cx, cy, cz, path)
- predictPath.finalWrite(predictPath.getPath())
- fuelcost = predictPath.getFuelCost()
- print("cost" .. fuelcost)
- if fuelcost > turtle.getFuelLevel() then
- getTurtleFuel.displayFuelInfo()
- print("Fuel Needed: " .. fuelcost)
- print("Fuel too Low to Start, Please Insert Buckets")
- return false
- end
- return true
- end
- function predictTotalFuelCostUPS(ax, ay, az, bx, by, bz)
- path = {1}
- predictPath.resetFuelCost()
- predictPath.predictTwo(ax, ay, az, bx, by, bz, path)
- predictPath.predict(bx, by, bz, path)
- predictPath.finalWrite(predictPath.getPath())
- fuelcost = predictPath.getFuelCost()
- print("cost" .. fuelcost)
- if fuelcost > turtle.getFuelLevel() then
- getTurtleFuel.displayFuelInfo()
- print("Fuel Needed: " .. fuelcost)
- print("Fuel too Low to Start, Please Insert Buckets")
- return false
- end
- return true
- end
- function placeCarePackage()
- turtle.dig()
- turtle.select(2)
- turtle.place()
- turtleChest.insertSome(2)
- end
- turtleChest.insertSome(2)
- function sendUPS(ax, ay, az, bx, by, bz)
- sx, sy, sz = getLocation()
- if predictTotalFuelCostUPS(ax, ay, az, bx, by, bz) then
- if turtleOneTrip.oneTrip(ax, ay, az) then
- turtleChest.takeAll()
- if not turtleOneTrip.oneTrip(bx, by, bz) then
- hx, hy, hz = getLocation()
- return "help " .. hx .. " " .. hy .. " " .. hz
- else
- turtleChest.insertSome(2)
- if not turtleOneTrip.oneTrip(sx, sy, sz) then
- hx, hy, hz = getLocation()
- return "help " .. hx .. " " .. hy .. " " .. hz
- else
- return "true"
- end
- end
- end
- else
- return "fuel"
- end
- end
- function sendDelivery(x, y, z)
- sx, sy, sz = getLocation()
- if predictTotalFuelCostDelivery(x, y, z, sx, sy, sz) then
- if turtleOneTrip.oneTrip(x, y, z) then
- turtleChest.insertSome(2)
- if not turtleOneTrip.oneTrip(sx, sy, sz) then
- hx, hy, hz = getLocation()
- return "help " .. hx .. " " .. hy .. " " .. hz
- else
- return "true"
- end
- end
- else
- return "fuel"
- end
- end
- function sendCarePackage(x, y, z)
- sx, sy, sz = getLocation()
- if predictTotalFuelCostDelivery(x, y, z, sx, sy, sz) then
- if turtleOneTrip.oneTrip(x, y, z) then
- placeCarePackage()
- if not turtleOneTrip.oneTrip(sx, sy, sz) then
- hx, hy, hz = getLocation()
- return "help " .. hx .. " " .. hy .. " " .. hz
- else
- return "true"
- end
- end
- else
- return "fuel"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement