Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = { ... }
- if #args ~= 3 then
- print("Usage: quarry <length> <width> <depth>")
- return
- end
- x = tonumber(args[1])
- y = tonumber(args[2])
- z = tonumber(args[3])
- function dig(n)
- for i=1,n do
- invCheck()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- end
- end
- function digPlane(x,y)
- for i=1,y do
- dig(x-1)
- if i==y then
- if y%2==0 then
- turtle.turnLeft()
- else
- turtle.turnLeft()
- turtle.turnLeft()
- dig(x)
- end
- elseif i%2==0 then
- turtle.turnRight()
- dig(1)
- turtle.turnRight()
- else
- turtle.turnLeft()
- dig(1)
- turtle.turnLeft()
- end
- end
- end
- function digVolume(x,y,z)
- for i=1,math.ceil(z/2) do
- if fuelCheck(x+y+z) then
- for i=1,2 do
- if turtle.detectDown() then
- if not turtle.digDown() then
- break
- end
- end
- turtle.down()
- end
- digPlane(x,y)
- end
- end
- end
- function invCheck()
- if turtle.getItemDetail(14) ~= nil then
- turtle.select(16)
- turtle.placeUp()
- for i=2,15 do
- turtle.select(i)
- turtle.dropUp()
- end
- turtle.select(1)
- end
- end
- function fuelCheck(threshold)
- fuel = turtle.getFuelLevel()
- print("Current fuel: ", fuel)
- if fuel <= threshold then
- return turtle.refuel()
- end
- return true
- end
- digVolume(x,y,z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement