_Nobody_

mine

Jan 9th, 2021 (edited)
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. io.write("Enter the Turtles Current Y Level: ")
  2. y_current = io.read()
  3. io.write("Enter Desired Mining Y Level: ")
  4. y_toMine = io.read()
  5.  
  6. io.write("Length of Tunnel: ")
  7. length = io.read()
  8. io.write("Width of Tunnel: ")
  9. width = io.read()
  10. io.write("Hight or Tunnel: ")
  11. hight = io.read()
  12. to_turn = ("")
  13. io.write("Enter Space Between Tunnels: ")
  14. tunnel_spacing = io.read()
  15. io.write("Number of Tunnels: ")
  16. tunnels = io.read()
  17. io.write("What direction if the turtle facing?: ")
  18. facing = io.read()
  19.  
  20. function digDown()
  21. turtle.digDown()
  22. turtle.down()
  23. end
  24.  
  25. function toYLevel()
  26. local y_level = tonumber(y_current) - tonumber(y_toMine)
  27. print("Digging down ", y_level, " blocks")
  28. for i = 1, y_level, 1 do
  29. digDown()
  30. end
  31. end
  32.  
  33. function checkBlock()
  34. local success, data = turtle.inspect()
  35.  
  36. if success then
  37. print("Block name: ", data.name)
  38.  
  39. end
  40. end
  41.  
  42. function digTunnel()
  43. for i = 1, length, 1 do
  44. turtle.dig()
  45. turtle.forward()
  46. end
  47. for i = 1, hight - 1, 1 do
  48. turtle.digUp()
  49. turtle.turnRight()
  50. turtle.turnRight()
  51. turtle.up()
  52. for x = 1, length - 1, 1 do
  53. turtle.dig()
  54. turtle.forward()
  55. end
  56. end
  57. for i = 1, width - 1, 1 do
  58. for x = 1, hight - 1, 1 do
  59. turtle.down()
  60. end
  61.  
  62. if to_turn == "Left" then
  63. to_turn = "Right"
  64. elseif to_turn == "Right" then
  65. to_turn = "Left"
  66. elseif hight % 2 == 0 then
  67. to_turn = "Left"
  68. elseif hight % 2 ~= 0 then
  69. to_turn = "Right"
  70. end
  71. if to_turn == "Left" then
  72. turtle.turnLeft()
  73. turtle.dig()
  74. turtle.forward()
  75. turtle.turnLeft()
  76. elseif to_turn == "Right" then
  77. turtle.turnRight()
  78. turtle.dig()
  79. turtle.forward()
  80. turtle.turnRight()
  81. end
  82.  
  83.  
  84. for i = 1, length, 1 do
  85. turtle.dig()
  86. turtle.forward()
  87. end
  88.  
  89. for i = 1, hight - 1, 1 do
  90. turtle.digUp()
  91. turtle.turnRight()
  92. turtle.turnRight()
  93. turtle.up()
  94. for x = 1, length, 1 do
  95. turtle.dig()
  96. turtle.forward()
  97. end
  98. end
  99. end
  100. end
  101.  
  102. function newTunnel()
  103. if facing == "Left" then
  104. turtle.forward()
  105. turtle.turnLeft()
  106. turtle.forward()
  107. turtle.forward()
  108. turtle.forward()
  109. turtle.turnLeft()
  110. turtle.down()
  111.  
  112. elseif facing == "Right" then
  113. turtle.forward()
  114. turtle.turnRight()
  115. turtle.forward()
  116. turtle.forward()
  117. turtle.forward()
  118. turtle.turnRight()
  119. turtle.down()
  120. end
  121. end
  122.  
  123.  
  124.  
  125. --[[function newTunnel()
  126. for i = 1, hight, 1 do
  127. turtle.down()
  128. end
  129. if width % 2 == 0 then
  130. turtle.turnLeft()
  131. else
  132. turtle.turnRight()
  133. end
  134. for i = 1, tunnel_spacing + 1, 1 do
  135. turtle.dig()
  136. turtle.forward()
  137. turtle.digUp()
  138. end
  139. if width % 2 == 0 then
  140. turtle.turnLeft()
  141. else
  142. turtle.turnRight()
  143. end
  144. end --]]
  145. --[Need to fix turtle digging back into tunnel spacing]--
  146.  
  147. toYLevel()
  148.  
  149. for i = 1, tunnels, 1 do
  150. digTunnel()
  151. newTunnel()
  152. end
Advertisement
Add Comment
Please, Sign In to add comment