Advertisement
FriedToes

Untitled

Jun 10th, 2021
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. local run = true
  2. local size = read()
  3. print("DA MINER BOT")
  4. print("ONLY SUPPORTED SIZES ARE")
  5. print("3x3")
  6. print("2x1")
  7. print("BOT IS FASTER AND BETTER")
  8.  
  9. function moveLeft()
  10. turtle.turnLeft()
  11. turtle.forward()
  12. turtle.turnRight()
  13. end
  14. function moveDigUp(num)
  15. local curCount = 1
  16. while (curCount < num) do
  17. curCount = curCount + 1
  18. turtle.dig()
  19. turtle.up()
  20. end
  21. end
  22. function moveDigDown(num)
  23. local curCount = 1
  24. while (curCount < num) do
  25. curCount = curCount + 1
  26. turtle.dig()
  27. turtle.down()
  28. end
  29. end
  30. function moveDigLeft(num)
  31. local curCount = 1
  32. while (curCount < num) do
  33. curCount = curCount + 1
  34. turtle.dig()
  35. turtle.turnLeft()
  36. turtle.forward()
  37. turtle.turnRight()
  38. turtle.dig()
  39. -- a
  40. end
  41. end
  42. function moveDigRight(num)
  43. local curCount = 1
  44. while (curCount < num) do
  45. curCount = curCount + 1
  46. turtle.dig()
  47. turtle.turnRight()
  48. turtle.forward()
  49. turtle.turnLeft()
  50. turtle.dig()
  51. -- a
  52. end
  53. end
  54. function moveForward(num)
  55. local curCount = 1
  56. while (curCount < num) do
  57. curCount = curCount + 1
  58. turtle.forward()
  59. print(curCount)
  60. end
  61. end
  62. function moveDown(num)
  63. local curCount = 1
  64. while (curCount < num) do
  65. curCount = curCount + 1
  66. turtle.down()
  67. print(curCount)
  68. end
  69. end
  70.  
  71. if (size == "3x3") then
  72. -- actual mining
  73. function right3x3()
  74. -- go up 3 and dig up
  75. moveDigUp(3)
  76. end
  77. function middle3x3()
  78. -- go left and dig down
  79. moveLeft()
  80. moveDigDown(3)
  81. end
  82. function left3x3()
  83. -- turn left and dig up
  84. moveLeft()
  85. moveDigUp(3)
  86. end
  87. function end3x3()
  88. -- go back to og spot + forward 1
  89. turtle.turnRight()
  90. moveForward(3)
  91. moveDown(2)
  92. turtle.turnLeft()
  93. turtle.forward()
  94. end
  95. while (true) do
  96. right3x3()
  97. middle3x3()
  98. left3x3()
  99. end3x3()
  100. end
  101. end
  102.  
  103. if (size == "2x1") then
  104. function mine2x1()
  105. turtle.dig()
  106. turtle.up()
  107. turtle.dig()
  108. turtle.down()
  109. turtle.forward()
  110. end
  111. while (true) do
  112. mine2x1()
  113. end
  114. end
  115.  
  116. if (size == "5x3") then
  117. function row1_5x3()
  118. moveDigUp(3)
  119. end
  120. function row2_5x3()
  121. moveLeft()
  122. moveDigDown(3)
  123. end
  124. function row3_5x3()
  125. moveLeft()
  126. moveDigUp(3)
  127. end
  128. function row4_5x3()
  129. moveLeft()
  130. moveDigDown(3)
  131. end
  132. function row5_5x3()
  133. moveLeft()
  134. moveDigUp(3)
  135. end
  136. function start_5x3()
  137. turtle.turnRight()
  138. moveForward(5)
  139. moveDown(2)
  140. turtle.turnLeft()
  141. turtle.forward()
  142. end
  143. while (true) do
  144. row1_5x3()
  145. row2_5x3()
  146. row3_5x3()
  147. row4_5x3()
  148. row5_5x3()
  149. start_5x3()
  150. end
  151. end
  152.  
  153. if (size == "1x3") then
  154. function row_1x3()
  155. moveDigLeft(3)
  156. turtle.forward()
  157. moveDigRight(3)
  158. turtle.forward()
  159. end
  160. while (true) do
  161. row_1x3()
  162. end
  163. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement