Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Set the size of the area to be mined
- local width = 9
- local height = 9
- -- Function to mine forward and handle fuel
- function mineForward()
- while not turtle.forward() do
- if turtle.getFuelLevel() == 0 then
- print("Out of fuel. Refuel and restart.")
- error()
- end
- turtle.refuel(1)
- end
- end
- -- Function to mine a full column
- function mineColumn()
- for i = 1, height do
- turtle.digDown()
- mineForward()
- end
- end
- -- Function to move to the next column
- function moveToNextColumn()
- if turtle.getFuelLevel() == 0 then
- print("Out of fuel. Refuel and restart.")
- error()
- end
- turtle.turnRight()
- turtle.digDown()
- mineForward()
- turtle.turnRight()
- end
- -- Main mining function
- function mineArea()
- for col = 1, width do
- mineColumn()
- if col < width then
- moveToNextColumn()
- end
- end
- end
- -- Function to move to the next level
- function moveToNextLevel()
- turtle.digDown()
- turtle.down()
- end
- -- Main mining process
- for level = 1, height do
- mineArea()
- if level < height then
- moveToNextLevel()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment