Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Starting to clear area")
- args = {...} --Get Aruguments Length Width Height
- if #arg ~= 2 then
- print("Please enter length and width")
- return
- end
- local length = tonumber(args[1])
- local width = tonumber(args[2])
- function dig()
- turtle.dig()
- end
- function forward(n)
- for x = 1, n do
- dig()
- s = turtle.forward()
- if not s == nil then
- print("Cannot move forward: " + s)
- end
- end
- end
- function right()
- turtle.turnRight()
- end
- function left()
- turtle.turnLeft()
- end
- function clearLayer()
- for y = 1, width do
- forward(length - 1)
- if y < width then
- if y % 2 == 1 then
- right()
- forward(1)
- right()
- else
- left()
- forward(1)
- left()
- end
- end
- end
- if width % 2 == 1 then
- right()
- right()
- forward(length - 1)
- end
- right()
- forward(width - 1)
- right()
- end
- function clearArea()
- clearLayer()
- end
- while true do
- clearArea()
- end
- print("Area cleared")
Add Comment
Please, Sign In to add comment