Advertisement
TheProdigy22

Untitled

Mar 26th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. local args = {...}
  2.  
  3. if #args ~= 1 then
  4. print("Usage: tunnel <distance>")
  5. else
  6. local torches = math.floor(args[1] / 8)
  7. print("Put "..torches.." torches in slot 1, then press enter.")
  8. read()
  9. end
  10.  
  11. function dig()
  12. while turtle.detect() do turtle.dig() end
  13. end
  14.  
  15. function digUp()
  16. while turtle.detectUp() do turtle.digUp() end
  17. end
  18.  
  19. function pokeHole()
  20. for i=1,5 do
  21. dig()
  22. if i < 5 then
  23. turtle.forward()
  24. end
  25. end
  26. for i=1,4 do
  27. turtle.back()
  28. end
  29. end
  30.  
  31. for i=1,args[1] do
  32. dig()
  33. turtle.forward()
  34. digUp()
  35. if i%4 == 0 then
  36. turtle.up()
  37. turtle.turnLeft()
  38. pokeHole()
  39. turtle.turnRight()
  40. turtle.turnRight()
  41. pokeHole()
  42. turtle.turnLeft()
  43. turtle.down()
  44. end
  45. if i%8 == 7 then
  46. turtle.back()
  47. turtle.select(1)
  48. turtle.placeUp()
  49. end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement