Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tArg = { ... }
- fwd = function()
- refuel()
- while turtle.forward()==false do
- turtle.dig()
- end
- end
- down = function()
- refuel()
- while turtle.down()==false do
- turtle.digDown()
- end
- end
- chooseTurn = function(condition, condition2)
- if condition then
- turtle.turnRight()
- if condition2 then
- fwd()
- end
- turtle.turnRight()
- else
- turtle.turnLeft()
- if condition2 then
- fwd()
- end
- turtle.turnLeft()
- end
- end
- refuel = function()
- if turtle.getFuelLevel()<20 then
- if turtle.getItemCount(16)==1 then
- print("out of fuel!")
- exit()
- end
- turtle.select(16)
- if turtle.refuel(1)==false then
- print("problem fueling!")
- exit()
- end
- turtle.select(15)
- end
- if turtle.getItemCount(15) == 1 then
- print("Out of chests!")
- exit()
- end
- if isfull() then
- empty()
- end
- end
- isfull = function()
- local full = true
- for i=1,14 do
- if turtle.getItemCount(i)==0 then
- full = false
- end
- end
- return full
- end
- empty = function()
- turtle.digDown()
- turtle.select(15)
- turtle.placeUp()
- for i=1,14 do
- turtle.select(i)
- turtle.dropUp()
- end
- turtle.select(15)
- end
- dig = function(length, width, height)
- for i=1,height do
- down()
- for j=1,width-1 do
- for k=1,length-1 do
- fwd()
- end
- chooseTurn((((width+1)%2)*(i-1)+j)%2==1, true)
- end
- for k=1,length-1 do
- fwd()
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- dig(tArg[1], tArg[2], tArg[3])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement