Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if not fs.exists("mt") then
- shell.run("pastebin", "get", "Yt1u8zAu", "mt")
- end
- if not fs.exists("persistent") then
- shell.run("pastebin", "get", "n9DEEpaN", "persistent")
- end
- os.loadAPI("mt")
- shell.run("persistent")
- appData = persistence.new("appData/turtleMiner2")
- mt.main()
- mt.load()
- function debugInfo()
- if appData.debug then
- print("Persistence API:")
- print("Recorded X:"..appData.x)
- print("Recorded Y:"..appData.y)
- print("Recorded Z:"..appData.z)
- print("Home X:"..appData.homeX)
- print("Home Y:"..appData.homeY)
- print("Home Z:"..appData.homeZ)
- print("Bucket X:"..appData.bucketX)
- print("Bucket Y:"..appData.bucketY)
- print("Bucket Z:"..appData.bucketZ)
- print("MagicTurtle API:")
- local x,y,z = mt.getPos()
- print("Recorded X:"..x)
- print("Recorded Y:"..y)
- print("Recorded Z:"..z)
- end
- end
- local surfaceLevel = appData.returnToSurfaceLevel
- function verticalShaft()
- while true do
- if turtle.detectDown() then
- local retries = 0
- while not turtle.digDown() do
- retries = retries+1
- if retries >= 5 then
- return
- end
- end
- end
- mt.down()
- end
- end
- function goToLevel(toY)
- local x, y, z = mt.getPos()
- mt.up(toY - y)
- end
- if appData.nextLocation ~= nil then
- mt.goToPos(appData.homeX,appData.homeY,appData.nextLocation)
- end
- function dropOffMaterials()
- mt.savePos()
- if appData.doWaypoint then
- mt.goToPos(317, 88, 85, false)
- mt.setFacing(3)
- end
- mt.goToPos(appData.bucketX, appData.bucketY, appData.bucketZ, false)
- mt.savePos()
- for i=1, 16 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.select(1)
- local x,y,z = mt.getPos()
- mt.goToPos(x, appData.returnFlightLevel, z)
- mt.goToPos(appData.homeX,appData.returnFlightLevel,appData.z+1, true)
- mt.savePos()
- end
- while true do
- debugInfo()
- appData.x,appData.y,appData.z = mt.getPos()
- appData.positionFacing = mt.getFacing()
- verticalShaft()
- goToLevel(surfaceLevel)
- appData.nextLocation = appData.z+1
- dropOffMaterials()
- appData.x,appData.y,appData.z = mt.getPos()
- if appData.doRest then
- os.sleep(1)
- end
- debugInfo()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement