Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- if #args ~= 1 then
- print("Usage: tunnel <distance>")
- else
- local torches = math.floor(args[1] / 8)
- print("Put "..torches.." torches in slot 1, then press enter.")
- read()
- end
- function dig()
- while turtle.detect() do turtle.dig() end
- end
- function digUp()
- while turtle.detectUp() do turtle.digUp() end
- end
- function pokeHole()
- for i=1,5 do
- dig()
- if i < 5 then
- turtle.forward()
- end
- end
- for i=1,4 do
- turtle.back()
- end
- end
- for i=1,args[1] do
- dig()
- turtle.forward()
- digUp()
- if i%4 == 0 then
- turtle.up()
- turtle.turnLeft()
- pokeHole()
- turtle.turnRight()
- turtle.turnRight()
- pokeHole()
- turtle.turnLeft()
- turtle.down()
- end
- if i%8 == 7 then
- turtle.back()
- turtle.select(1)
- turtle.placeUp()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement