Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local dist = tonumber(args[1])
- local movementCount = 0
- local maxSlots = 16
- local curSlot = turtle.getSelectedSlot()
- function dig()
- turtle.digUp()
- turtle.dig()
- end
- function nextSlot()
- if curSlot == maxSlots then
- curSlot = 1
- else
- curSlot = curSlot + 1
- end
- return curSlot
- end
- function bridge()
- if not turtle.detectDown() then
- local ok, err = turtle.placeDown()
- if not ok then
- turtle.select(nextSlot())
- bridge()
- end
- end
- end
- function moveForward()
- turtle.forward()
- bridge()
- movementCount = movementCount + 1
- end
- while movementCount < dist do
- if turtle.detect() or turtle.detectUp() then
- dig()
- else
- moveForward()
- end
- end
Add Comment
Please, Sign In to add comment