Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --File: /digtunnel_old
- dofile("/cattech/turtle.lua")
- dofile("/cattech/file.lua")
- local moves = require("moves")
- local torchCounter = 7;
- function checkTorch()
- torchCounter = torchCounter +1
- if (torchCounter > 7) then
- print("placing Torch!")
- placeLight(1)
- torchCounter = 0
- end
- end
- config = loadConfigAndDefaults()
- if #arg >= 1 then
- config["maxSteps"] = tonumber(arg[1])
- if #arg >= 2 then
- config["pathDirection"] = arg[2]
- end
- else
- local continue = getContinue("digtunnel")
- if continue ~= nil then
- print("Continuing remaining: ",continue)
- config["maxSteps"] = continue
- end
- end
- print("Going " .. config["pathDirection"] .. " " .. config["maxSteps"] .. " blocks")
- displayHash(config)
- local spaces = 0
- while spaces < config["maxSteps"] do
- refuelIfNeeded(30)
- if (config["pathDirection"] == "down") then
- -- Starts 1 above first step
- turtle.digDown()
- turtle.down()
- digTunnelSlice(tonumber(config["stairHeight"]))
- if config["safeTunnel"] == "yes" then
- secureTunnelSlice(tonumber(config["stairHeight"]))
- end
- checkTorch()
- goDigForward()
- end
- if (config["pathDirection"] == "up") then
- -- Starts on first step.
- digTunnelSlice(tonumber(config["stairHeight"]))
- if config["safeTunnel"] == "yes" then
- secureTunnelSlice(tonumber(config["stairHeight"]))
- end
- checkTorch()
- turtle.up()
- goDigForward()
- end
- if (config["pathDirection"] == "level") then
- -- Starts the ground
- digTunnelSlice(tonumber(config["tunnelHeight"]))
- if config["safeTunnel"] == "yes" then
- secureTunnelSlice(tonumber(config["tunnelHeight"]))
- end
- checkTorch()
- goDigForward()
- end
- local remaining = config["maxSteps"] - spaces
- updateLine(remaining.."/"..config["maxSteps"])
- updateContinue("digtunnel",remaining)
- local inv = scanInventory()
- if
- spaces = spaces + 1
- end
- updateContinue("digtunnel",nil)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement