Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- if #args < 1 then
- print("quarry <size> [height]")
- end
- function safeRefuel()
- if turtle.getFuelLevel() < 10 then
- print("Attempting to refuel.")
- turtle.refuel()
- end
- end
- function safeForward()
- if not turtle.dig() then
- turtle.forward()
- end
- end
- function safeDown()
- if turtle.detectDown() then
- turtle.digDown()
- end
- print("Going down a row.")
- turtle.down()
- end
- function excavate(radius)
- if radius < 2 then
- error("wrong radius, expected 2 or higher")
- end
- print("Excavating a row.")
- for h = 1,4 do
- for i = 1,radius do
- safeForward()
- end
- safeRefuel()
- turtle.turnRight()
- end
- end
- function digQuarry(size, height)
- if height < 2 then
- error("wrong height, expected 2 or higher")
- end
- for g = 1,height do
- excavate(size)
- safeDown()
- end
- print("Finished.")
- end
- if #args == 1 then
- excavate(tonumber(args[1]))
- elseif #args == 2 then
- digQuarry(tonumber(args[1]), tonumber(args[2]))
- end
Advertisement
Add Comment
Please, Sign In to add comment