Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- if not #args == 3 then
- print("Usage: clear <x y z>")
- return
- end
- function checkInv()
- isFull = true
- for i=1,15 do
- if turtle.getItemCount(i) == 0 then
- isFull = false
- end
- end
- if isFull == true then
- shell.run("emptyI")
- end
- end
- local y = tonumber(args[1])
- local x = tonumber(args[2]) - 1
- local z = tonumber(args[3])
- if x == nil or y == nil or z == nil then
- print("Invalid dimensions")
- return
- end
- if x < 0 or y < 0 or z < 0 then
- print("Invalid (negative) dimensions")
- return
- end
- local direction = true
- for i = 1, z do
- for j = 1, y do
- for k = 1, x do
- turtle.dig()
- while not turtle.forward() do turtle.dig() end
- checkInv()
- end
- if j < y then
- if direction then
- turtle.turnRight()
- turtle.dig()
- while not turtle.forward() do turtle.dig() end
- turtle.turnRight()
- direction = false
- else
- turtle.turnLeft()
- turtle.dig()
- while not turtle.forward() do turtle.dig() end
- turtle.turnLeft()
- direction = true
- end
- end
- end
- if i < z then
- turtle.digDown()
- while not turtle.down() do turtle.digDown() end
- turtle.turnRight()
- turtle.turnRight()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment