Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("tMV.lua")
- local sideLength = 16
- local atMaxDepth = false
- local nextDepth = 0
- --mines and moves forward
- function mineForward()
- while turtle.dig() do
- os.sleep(0.1)
- end
- while not tMV.tForward() do
- os.sleep(0.1)
- end
- turtle.digDown()
- turtle.digUp()
- end
- --mines an 8x8 layer, 3 high
- function mineLayer()
- for i=1,sideLength do
- mineForward()
- end
- tMV.tTurnRight()
- for i=(sideLength-1),1,-1 do
- for j=1,2 do
- for k=1,i do
- mineForward()
- end
- tMV.tTurnRight()
- end
- dumpCobble()
- end
- end
- --mines to the next layer down. returns true if the turtle couldnt move any further down
- function layerDown(layerDepth)
- local atBedrock = false
- tMV.face(1)
- for i=1,-1*layerDepth do
- turtle.digDown()
- if not tMV.tDown() then
- atBedrock = true
- end
- end
- return atBedrock
- end
- --return to home and dump ores
- function dropOffOres()
- tMV.goHome()
- tMV.face(3)
- for slot=2,16 do
- turtle.select(slot)
- turtle.drop()
- end
- end
- --dumps all cobble on the ground
- function dumpCobble()
- for slot=2,16 do
- turtle.select(slot)
- if turtle.compareTo(1) then
- turtle.dropDown(64)
- end
- end
- end
- --main loop. mines a layer, gets the depth it was at, goes home to drop off ores, then returns to that depth +3. if it hits bedrock the loop ends
- while not atMaxDepth do
- print(nextDepth)
- mineLayer()
- nextDepth = tMV.getPos()[2] - 3
- print(nextDepth)
- print("")
- dropOffOres()
- if layerDown(nextDepth) then
- atMaxDepth = true
- end
- end
- tMV.goHome()
Add Comment
Please, Sign In to add comment