Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = { ... }
- if #args ~= 2 then
- print("Usage: stripmine <depth> <amount of strips>")
- return
- end
- depth = tonumber(args[1])
- n = tonumber(args[2])
- function dig(depth)
- for i=1, depth do
- invCheck()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- end
- end
- function digArray(depth,n)
- for i=1, n do
- if fuelCheck(depth*2) then
- dig(depth)
- end
- if i>1 then
- turtle.turnRight()
- for i=1,2 do
- dig(1)
- end
- turtle.back()
- turtle.back()
- turtle.turnLeft()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- dig(depth)
- if i<n then
- turtle.turnRight()
- dig(3)
- turtle.turnRight()
- end
- end
- end
- function invCheck()
- if turtle.getItemDetail(14) ~= nil then
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.back()
- turtle.select(16)
- turtle.place()
- for i=2,15 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(1)
- turtle.turnLeft()
- end
- end
- function fuelCheck(threshold)
- fuel = turtle.getFuelLevel()
- print("Current fuel: ", fuel)
- if fuel <= threshold then
- return turtle.refuel()
- end
- return true
- end
- digArray(depth,n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement