Advertisement
Guest User

Anony

a guest
Nov 19th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 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.down()
  15. turtle.back()
  16. turtle.select(16)
  17. turtle.placeUp()
  18. turtle.forward()
  19. turtle.up()
  20. end
  21.  
  22. local run = 0
  23. local j = 0
  24. local k = 0
  25.  
  26. term.write("Branch length: ")
  27. run = read()
  28.  
  29. for i = 1, run do
  30. k = i - 1
  31. j = k % 10
  32. if j == 1 then
  33. placeTorch()
  34. end
  35. digIt()
  36. end
  37.  
  38. turtle.down()
  39. turtle.turnRight()
  40. turtle.turnRight()
  41. turtle.select(16)
  42. turtle.placeUp()
  43.  
  44. for i = 1, run do
  45. turtle.forward()
  46. end
  47.  
  48. -3Tunnel
  49. function digIt()
  50. while turtle.detect() do
  51. turtle.dig()
  52. os.sleep(0.5)
  53. end
  54. turtle.forward()
  55. while turtle.detectDown() or turtle.detectUp() do
  56. turtle.digUp()
  57. turtle.digDown()
  58. end
  59. end
  60.  
  61. local run = 0
  62. term.write("Tunnel length: ")
  63. run = read()
  64.  
  65. for i = 1, run do
  66. digIt()
  67. turtle.turnLeft()
  68. digIt()
  69. turtle.turnRight()
  70. turtle.turnRight()
  71. turtle.forward()
  72. digIt()
  73. turtle.back()
  74. turtle.turnLeft()
  75. end
  76.  
  77. -3Tunnel with Torches
  78. function digIt()
  79. while turtle.detect() do
  80. turtle.dig()
  81. os.sleep(0.5)
  82. end
  83. turtle.forward()
  84. while turtle.detectDown() or turtle.detectUp() do
  85. turtle.digUp()
  86. turtle.digDown()
  87. end
  88. end
  89.  
  90. function placeTorch()
  91. turtle.select(16)
  92. turtle.placeUp()
  93. end
  94.  
  95. local run = 0
  96. term.write("Tunnel length: ")
  97. run = read()
  98.  
  99. for i = 1, run do
  100. k = i - 1
  101. j = k % 4
  102. digIt()
  103. turtle.turnLeft()
  104. digIt()
  105. turtle.turnRight()
  106. turtle.turnRight()
  107. turtle.forward()
  108. digIt()
  109. turtle.back()
  110. turtle.turnLeft()
  111. if i == 2 or j == 1 then
  112. turtle.back()
  113. turtle.turnRight()
  114. turtle.forward()
  115. placeTorch()
  116. turtle.back()
  117. turtle.back()
  118. placeTorch()
  119. turtle.forward()
  120. turtle.turnLeft()
  121. turtle.forward()
  122. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement