Advertisement
Guest User

Untitled

a guest
Oct 29th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Efficent Dig
  2. --By Nurall
  3. --EfficentDigV1
  4.  
  5. --use: turtle will dig in shafts in a patern as not to miss any areas
  6. --use: digging in a 24x24 area the turtle will compare ore found with slot 1-4
  7. --use: if that ore is not foud in the ignored slots then it will be mined
  8.  
  9. --Var
  10. local z = 1
  11. local t = 1
  12. local y = 100 --altitude
  13. local i = 0
  14. local x = 0
  15. local k = 0
  16.  
  17. --function
  18. function MineDown()
  19. for z = 1, y do
  20. while not turtle.down() do
  21. turtle.dig()
  22. turtle.attack()
  23. end
  24. FullStorage()
  25. RefuelDigger()
  26. for t = 1, 4 do
  27. turtle.select(t)
  28. if not turtle.compare() then
  29. turtle.dig()
  30. end
  31. turtle.turnRight()
  32. end
  33. end
  34. for z = 1, y do
  35. while not turtle.up() do
  36. turtle.dig()
  37. turtle.attack()
  38. end
  39. end
  40. end
  41.  
  42. function RefuelDigger()
  43. if turtle.getFuelLevel() < 30 then
  44. if turtle.getItemCount(16) == 1 then
  45. turtle.select(16)
  46. turtle.refuel(1)
  47. turtle.select(15)
  48. if turtle.placeUp()then
  49. turtle.select(16)
  50. turtle.suckUp()
  51. turtle.select(15)
  52. turtle.digUp()
  53. end
  54. else
  55. turtle.select(16)
  56. turtle.refuel(1)
  57. end
  58. end
  59. end
  60.  
  61. function FullStorage()
  62. if turtle.getItemCount(13) > 0 then
  63. turtle.select(14)
  64. if turtle.placeUp() then
  65. for i = 5, 13 do
  66. turtle.select(i)
  67. turtle.dropUp()
  68. end
  69. turtle.select(14)
  70. turtle.digUp()
  71. end
  72. end
  73. end
  74.  
  75. function Skip()
  76. for i = 1, 5 do
  77. while not turtle.forward() do
  78. turtle.dig()
  79. turtle.attack()
  80. end
  81. end
  82. end
  83.  
  84. function RowStart()
  85. turtle.turnRight()
  86. turtle.turnRight()
  87. for i = 1, 25 do
  88. while not turtle.forward() do
  89. turtle.dig()
  90. turtle.attack()
  91. end
  92. end
  93. turtle.turnLeft()
  94. while not turtle.forward() do
  95. turtle.dig()
  96. turtle.attack()
  97. end
  98. turtle.turnLeft()
  99. RefuelDigger()
  100. end
  101.  
  102. --program
  103.  
  104. for k = 1, 5 do
  105. --row 1
  106. for x = 1, 5 do
  107. Skip()
  108. MineDown()
  109. end
  110. RowStart()
  111. --row 2
  112. for i = 1, 2 do
  113. while not turtle.forward() do
  114. turtle.attack()
  115. turtle.dig()
  116. end
  117. end
  118. MineDown()
  119. for x = 1, 4 do
  120. Skip()
  121. MineDown()
  122. end
  123. for i = 1, 3 do
  124. while not turtle.forward() do
  125. turtle.attack()
  126. turtle.dig()
  127. end
  128. end
  129. RowStart()
  130. --row 3
  131. for i = 1, 4 do
  132. while not turtle.forward() do
  133. turtle.attack()
  134. turtle.dig()
  135. end
  136. end
  137. MineDown()
  138. for x = 1, 4 do
  139. Skip()
  140. MineDown()
  141. end
  142. while not turtle.forward() do
  143. turtle.attack()
  144. turtle.dig()
  145. end
  146. RowStart()
  147. --row 4
  148. while not turtle.forward() do
  149. turtle.attack()
  150. turtle.dig()
  151. end
  152. MineDown()
  153. for x = 1, 4 do
  154. Skip()
  155. MineDown()
  156. end
  157. for i = 1, 4 do
  158. while not turtle.forward() do
  159. turtle.attack()
  160. turtle.dig()
  161. end
  162. end
  163. RowStart()
  164. --row 5
  165. for i = 1, 3 do
  166. while not turtle.forward() do
  167. turtle.attack()
  168. turtle.dig()
  169. end
  170. end
  171. MineDown()
  172. for x = 1, 4 do
  173. Skip()
  174. MineDown()
  175. end
  176. for i = 1, 2 do
  177. while not turtle.forward() do
  178. turtle.attack()
  179. turtle.dig()
  180. end
  181. end
  182. RowStart()
  183.  
  184. end
  185. turtle.turnLeft()
  186. for i = 1, 24 do
  187. while not turtle.forward() do
  188. turtle.attack()
  189. turtle.dig()
  190. end
  191. end
  192. turtle.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement