Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ...}
- if #tArgs ~=1 then
- print( "Usage: strip <TunnelLength>" )
- return
- end
- local tlength = tonumber( tArgs[1] )
- if tlength < 1 then
- print( "Tunnel Length must be positive" )
- return
- end
- local function refuel()
- local fuelLevel = turtle.getFuelLevel()
- if fuelLevel == "unlimited" or fuelLevel > 0 then
- return
- end
- local function tryRefuel()
- for n=1,16 do
- if turtle.getItemCount(n) > 0 then
- turtle.select(n)
- if turtle.refuel(1) then
- turtle.select(1)
- return true
- end
- end
- end
- turtle.select(1)
- return false
- end
- if not tryRefuel() then
- print( "Add more fuel to continue." )
- while not tryRefuel() do
- sleep(1)
- end
- print( "Resuming Tunnel." )
- end
- end
- local function floorcheck()
- while not turtle.detectDown() do
- turtle.select(1)
- turtle.placeDown()
- end
- end
- local function detectup()
- while turtle.detectUp() do
- turtle.digUp()
- end
- end
- local function strip()
- refuel()
- while not turtle.forward() do
- while not turtle.dig() do
- turtle.attack()
- end
- sleep(0.4)
- end
- detectup()
- floorcheck()
- end
- local function otun()
- strip()
- strip()
- turtle.back()
- turtle.back()
- end
- local function turnaround()
- turtle.turnRight()
- strip()
- strip()
- strip()
- otun()
- turtle.turnRight()
- end
- length = 25
- tunnel = tlength/4
- refuel()
- for z = 1, tunnel do
- for x = 1, length do
- strip()
- end
- turnaround()
- x = 0
- for x = 1, length do
- strip()
- end
- turtle.turnLeft()
- strip()
- strip()
- strip()
- turtle.turnLeft()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement