Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables for dimensions
- local width = 5
- local length = 5
- local depth = 5
- -- Function to dig a row
- local function digRow()
- for i = 1, width - 1 do
- turtle.dig()
- turtle.forward()
- end
- end
- -- Function to return to the start of the row
- local function returnToStartOfRow()
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, width - 1 do
- turtle.forward()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- -- Function to move down a level
- local function moveDown()
- turtle.digDown()
- turtle.down()
- end
- -- Main digging function
- local function digPit()
- for d = 1, depth do
- for l = 1, length do
- digRow()
- if l < length then
- if l % 2 == 1 then
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- end
- -- Return to the starting position
- if length % 2 == 1 then
- returnToStartOfRow()
- else
- turtle.turnLeft()
- for i = 1, length - 1 do
- turtle.forward()
- end
- turtle.turnRight()
- end
- -- Move down to the next layer
- if d < depth then
- moveDown()
- end
- end
- end
- -- Start the digging process
- digPit()
Advertisement
Add Comment
Please, Sign In to add comment