Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --betterExcavate, now with support for non-square finite holes! And it won't dump its fuel on the ground!
- --Get input
- lwh={...}
- if lwh[2]==nil then --allow optional second parameter
- lwh[2]=lwh[1]
- end
- if lwh[3]==nil then --allow optional third parameter
- lwh[3]=2^15
- end
- for i=1,3 do
- lwh[i]=tonumber(lwh[i])
- end
- --
- local function forward()
- if turtle.getFuelLevel() == 0 then
- if not turtle.refuel() then
- print("I need fuel!")
- while not turtle.refuel() do
- sleep(0.5)
- end
- end
- end
- turtle.dig()
- turtle.forward()
- end
- --Dig
- for h=1,lwh[3] do --height
- for w=1,lwh[2] do --width
- for l=2,lwh[1] do --length
- forward()
- end
- if w==lwh[2] then
- print("Done with this layer!")
- else
- if w%2==1 then
- turtle.turnRight()
- forward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- end
- end
- end
- for i=0,lwh[2]%2 do
- turtle.turnRight()
- end
- if h~=lwh[3] then
- turtle.digDown()
- turtle.down()
- end
- if lwh[2]%2==0 then
- l,w,lwh[1],lwh[2]=w,l,lwh[2],lwh[1]
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment