Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SingleTunnel by Lothendas
- --****IMPORTANT READ THIS***
- -- 1. Fuel in slot 1 (Coal/Charcoal/LavaBuckets)
- -- 2. Torces in slot 2
- local args = { ... }
- -- Distance Variable
- local distance = tonumber(args[1])
- -- Fuel needed Variable
- local fuelNeeded = distance * 2
- -- Torches needed variable
- local torchNeeded = distance / 10
- -- Check Amount of Fuel Function
- local function checkFuel()
- while (turtle.getFuelLevel() < fuelNeeded) do
- turtle.select(1)
- if (turtle.getItemCount(1) == 0) then
- print("Not enough fuel to complete operation...")
- return false
- end
- turtle.refuel(1)
- end
- return true
- end
- -- Check Amount of Torches Function
- local function checkTorches()
- if (turtle.getItemCount(2) < torchNeeded) then
- print ("Not enough torches to complete operation...")
- return false
- end
- return true
- end
- local function placeTorch()
- turtle.select(2)
- turtle.placeDown()
- end
- local function dig()
- while (turtle.detect()) do
- turtle.dig()
- sleep(0.5)
- end
- end
- local function turnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- local function toStart()
- local i = 0
- for i = 1, distance do
- turtle.forward()
- end
- end
- local function digTunnel()
- print("Initializing digging...")
- local torch = 0
- local i = 0
- while (i < distance) do
- dig()
- turtle.forward()
- turtle.digDown()
- torch = torch + 1
- if (torch == 10) then
- placeTorch()
- turtle.turnLeft()
- dig()
- turnAround()
- dig()
- turtle.turnLeft()
- torch = 0
- end
- i = i + 1
- end
- turnAround()
- toStart()
- print("Tunnel digging complete...")
- end
- if checkFuel() and checkTorches() then
- digTunnel()
- end
Advertisement
Add Comment
Please, Sign In to add comment