Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local distanceLimit = 500;
- if arg[2] then distanceLimit = tonumber(arg[2]) end
- function isFiller(block)
- return block.name == "minecraft:diorite" or block.name == "minecraft:deepslate" or block.name == "minecraft:stone" or block.name == "minecraft:granite" or block.name == "minecraft:cobblestone" or block.name == "minecraft:cobbled_deepslate" or block.name == "minecraft:netherrack"
- end
- function digahole()
- local distance = 0
- local blockLevel = 0
- while true do
- while turtle.digDown() do
- if blockLevel == 0 then
- blockLevel = distance
- end
- end
- if turtle.getItemCount(16) > 0 then
- for i=1,distance do
- while turtle.digUp() do end
- turtle.up()
- end
- print("Waiting for items to be unloaded (Press Enter to continue)")
- local eventData = {"key", 0}
- while eventData[2] ~= 257 do eventData = {os.pullEvent("key")} end
- for i=1,distance do
- while turtle.digDown() do end
- turtle.down()
- end
- end
- if turtle.getFuelLevel() - 2 < distance then
- for i=1,distance do
- while turtle.digUp() do end
- turtle.up()
- end
- while turtle.getFuelLevel() - 2 < distance*2 do
- print("Waiting for more fuel (press Enter to continue)")
- local eventData = {"key", 0}
- while eventData[2] ~= 257 do eventData = {os.pullEvent("key")} end
- for i=1,16 do
- turtle.select(i)
- turtle.refuel(64)
- end
- turtle.select(1)
- end
- for i=1,distance do
- while turtle.digDown() do end
- turtle.down()
- end
- end
- if not turtle.down() then break end
- distance = distance + 1
- for i=1,4 do
- turtle.turnLeft()
- local isBlock, block = turtle.inspect();
- if isBlock and not isFiller(block) then
- turtle.dig()
- end
- end
- if distance == distanceLimit then break end
- end
- for i=1,distance do
- while turtle.digUp() do end
- turtle.up()
- if distance-i-1 == blockLevel then turtle.placeDown() end
- end
- end
- local step = 0
- turtle.select(1);
- for i=1,tonumber(arg[1]) do
- if i>1 then
- step = (step + 1) % 3
- print(tostring(step))
- if step == 0 then
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- else
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- digahole()
- end
- turtle.turnLeft()
- for i=1,step do
- turtle.forward()
- end
- turtle.turnRight()
- for i=2,arg[1] do
- turtle.back()
- turtle.back()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement