Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mineLayer(x, y, z)
- if z < 1 then
- return
- else
- -- Dig down
- if not turtle.detectDown() then
- turtle.digDown()
- end
- turtle.down()
- -- Call the function to mine the next layer
- mineLayer(x, y, z - 1)
- -- Dig up and return to original position
- turtle.up()
- end
- end
- function mineStrip(length)
- for i = 1, length do
- if not turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- end
- end
- function mineField(width, length, depth)
- for w = 1, width do
- -- Mine a strip of the specified length
- mineStrip(length)
- -- Position the turtle to start the next strip
- if w < width then
- if w % 2 == 1 then
- turtle.turnRight()
- if not turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- if not turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- turtle.turnLeft()
- end
- end
- end
- -- Recursive call to mine the next layer down
- mineLayer(width, length, depth)
- end
- -- Start the mining operation
- mineField(6, 1, 6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement