Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- local length = tonumber(tArgs[1]) or 100
- print("Length " .. length)
- -- Turtle Vars
- local dist = 0
- local dir = 0
- local iterations = tonumber(tArgs[2]) or 1
- if (tArgs[3] == "left" or tArgs[3] == "l") then
- dir = 0
- else
- dir = 1
- end
- function Dig()
- while (turtle.detect()) do
- turtle.dig()
- sleep(0.5)
- end
- end
- function DigUp()
- while (turtle.detectUp()) do
- turtle.digUp()
- sleep(0.5)
- end
- end
- function DigStep()
- Dig()
- turtle.forward()
- DigUp()
- dist = dist + 1
- end
- function TurnAround(direction)
- if (direction == 1) then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- DigStep()
- DigStep()
- DigStep()
- if (direction == 1) then
- turtle.turnRight()
- dir = 0
- else
- turtle.turnLeft()
- dir = 1
- end
- end
- -- Main
- for i = 1, iterations do
- for j = 1, length do
- DigStep()
- end
- TurnAround(dir)
- for j = 1, length do
- DigStep()
- end
- TurnAround(dir)
- end
Add Comment
Please, Sign In to add comment