Advertisement
joanjsa15

jsa15

Apr 11th, 2022
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. function digIt()
  2. while turtle.detect() do
  3. turtle.dig()
  4. os.sleep(0.5)
  5. end
  6. turtle.forward()
  7. while turtle.detectDown() or turtle.detectUp() do
  8. turtle.digUp()
  9. turtle.digDown()
  10. end
  11. end
  12.  
  13. function placeTorch()
  14. turtle.select(16)
  15. turtle.placeUp()
  16. end
  17.  
  18. local run = 0
  19. local j = 0
  20. local k = 0
  21.  
  22. term.write("Tunnel length: ")
  23. run = read()
  24.  
  25. for i = 1, run do
  26. k = i - 1
  27. j = k % 4
  28. digIt()
  29. turtle.turnLeft()
  30. digIt()
  31. turtle.turnRight()
  32. turtle.turnRight()
  33. turtle.forward()
  34. digIt()
  35. turtle.back()
  36. turtle.turnLeft()
  37. if i == 2 or j == 1 then
  38. turtle.back()
  39. turtle.turnRight()
  40. turtle.forward()
  41. placeTorch()
  42. turtle.back()
  43. turtle.back()
  44. placeTorch()
  45. turtle.forward()
  46. turtle.turnLeft()
  47. turtle.forward()
  48. end
  49. end
  50.  
  51.  
  52. turtle.down()
  53. turtle.turnRight()
  54. turtle.turnRight()
  55. turtle.select(16)
  56. turtle.placeUp()
  57.  
  58. for i = 1, run do
  59. turtle.forward()
  60. end
  61.  
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement