Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function move()
- if (turtle.getItemCount(16) ~= 0) then
- dropItems()
- end
- if(turtle.getFuelLevel() == 0) then
- error("Out of fuel")
- end
- while (not turtle.forward()) do
- turtle.dig()
- end
- end
- function right()
- turtle.turnRight()
- end
- function left()
- turtle.turnLeft()
- end
- function down()
- turtle.digDown()
- turtle.down()
- end
- function outer()
- digside1()
- right()
- digside2()
- right()
- digside1()
- right()
- end
- function digside1()
- for num = 2, side1 do
- move()
- end
- end
- function digside2()
- for num = 2, side2 do
- move()
- end
- end
- function inner()
- peaks = (side2 / 2) - 1
- for num = 1, peaks do
- ascend()
- descend()
- end
- move()
- right()
- if(oddSide) then
- oddSideFix()
- end
- end
- function ascend()
- move()
- right()
- for num = 3, side1 do
- move()
- end
- left()
- end
- function descend()
- move()
- left()
- for num = 3, side1 do
- move()
- end
- right()
- end
- function oddSideFix()
- for num = 3, side1 do
- move()
- end
- left()
- left()
- for num = 3, side1 do
- move()
- end
- right()
- move()
- right()
- end
- function dropItems()
- right()
- right()
- turtle.select(1)
- while (not turtle.place()) do
- turtle.dig()
- end
- for num = 2, 16 do
- turtle.select(num)
- turtle.drop()
- end
- turtle.select(2)
- left()
- left()
- if(turtle.getItemCount(1) == 0) then
- error("Out of chests")
- end
- end
- -------------------------
- local args = { ... }
- side1 = tonumber(args[1])
- side2 = tonumber(args[2])
- depth = tonumber(args[3])
- oddSide = false
- if(side2 % 2 == 1) then
- oddSide = true
- end
- if(turtle.getItemCount(1) == 0) then
- error("Place chests in slot 1 and try again")
- end
- print(" ")
- print("Excavating these dimensions:")
- print("Out: " .. side1)
- print("Across: " .. side2)
- print("Down: " .. depth)
- print(" ")
- layers = 0
- while(layers < depth) do
- outer()
- inner()
- layers = layers + 1
- if(layers < depth) then down() end
- print((100*layers/depth) .. "% complete")
- end
- print(" ")
- print("Done!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement