Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tunnels = 10
- local tArgs = { ...}
- if #tArgs ~=1 then
- print( "Usage: strip <length>" )
- return
- end
- local length = tonumber( tArgs[1] )
- if length < 1 then
- print( "Strip 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 detectup()
- if turtle.detectUp() then
- turtle.digUp()
- sleep(0.4)
- end
- end
- local function strip()
- refuel()
- while not turtle.forward() do
- while not turtle.dig() do
- turtle.attack()
- end
- sleep(0.4)
- detectup()
- end
- end
- local function otun()
- strip()
- strip()
- detectup()
- turtle.back()
- turtle.back()
- end
- local function turnaround()
- turtle.turnRight()
- strip()
- strip()
- strip()
- otun()
- turtle.turnRight()
- end
- for n = 1, tunnels do
- refuel()
- for x = 1, length do
- strip()
- end
- refuel()
- turnaround()
- x = 0
- refuel()
- for x = 1, length do
- strip()
- end
- turtle.back()
- detectup()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement