Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local checkPlacingBlocks = turtle.getItemCount(16)
- function dig() -- Will dig the quicksand if detected
- if turtle.detectDown() and turtle.digDown() then
- sleep(0.5)
- end
- end
- function digLine() -- Will dig a line(3 blocks) of quicksand
- for i = 1, 2 do
- dig()
- turtle.forward()
- end
- dig()
- end
- function turnRight() -- Turns and moves the turtle
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- end
- function turnLeft() -- Turns and moves the turtle
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- function digLayer() -- Will dig a layer(9 blocks) of quicksand
- digLine()
- turnRight()
- digLine()
- turnLeft()
- digLine()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function digAll() -- Will dig all(27 blocks) the quicksand
- for i = 1, 2 do
- digLayer()
- turtle.down()
- end
- digLayer()
- end
- function fillLine() -- Will fill a line(3 blocks) of quicksand
- for i = 1, 2 do
- turtle.placeDown()
- turtle.forward()
- end
- turtle.placeDown()
- end
- function fillLayer() -- Will fill a layer(9 blocks) of quicksand
- fillLine()
- turnRight()
- fillLine()
- turnLeft()
- fillLine()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function returnOrFill()
- if checkPlacingBlocks > 26 then
- print("Cleaning up the mess")
- turtle.select(16)
- for i = 1, 2 do
- fillLayer()
- turtle.up()
- end
- fillLayer()
- turtle.select(1)
- else
- for i = 1, 2 do
- turtle.up()
- for i = 1, 2 do
- turtle.forward()
- end
- turtle.turnRight()
- end
- end
- end
- -- Actual program
- term.clear()
- term.setCursorPos(1, 1)
- print("Digging quicksand")
- turtle.select(1)
- digAll()
- returnOrFill()
- print("Done!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement