Advertisement
Guest User

ACM.lua

a guest
Apr 6th, 2020
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.66 KB | None | 0 0
  1. turtle.refuel()
  2.  
  3. local plantDistance = 3
  4. local circles = 0
  5. local circlesDone = 1
  6. local circlesDinstance = 3
  7. local startHight = 0
  8. local endHight = 0
  9. local chestHight = 0
  10. local hight = 0
  11.  
  12. print("Current Hight:")
  13. hight = tonumber(read())
  14. chestHight = hight
  15. print("")
  16.  
  17. print("Start Hight:")
  18. startHight = tonumber(read())
  19. print("")
  20.  
  21. print("End Hight:")
  22. endHight = tonumber(read())
  23. print("")
  24.  
  25. print("Circles:")
  26. circles = tonumber(read())
  27. print("")
  28.  
  29. local success, block = nil
  30.  
  31. local Ores = {
  32.   "minecraft:coal_ore",
  33.   "minecraft:iron_ore",
  34.   "minecraft:gold_ore",
  35.   "minecraft:diamond_ore",
  36.   "minecraft:lapis_ore",
  37.   "minecraft:lit_redstone_ore",
  38.   "minecraft:emerald_ore",
  39.   "thermalfoundation:ore",
  40.   "thermalfoundation:ore_fluid",
  41.   "ic2:resource",
  42.   "bigreactors:oreyellorite",
  43.   "appliedenergistics2:quartz_ore",
  44.   "appliedenergistics2:charged_quartz_ore",
  45.   "deepresonance:resonating_ore",
  46.   "draconicevolution:draconium_ore",
  47.   "thaumcraft:ore_cinnabar",
  48.   "thaumcraft:ore_amber",
  49.   "thaumcraft:ore_quartz",
  50.   "projectred-exploration:ore",
  51.   "forestry:resources",
  52.   "bigreactors:orebenitoite",
  53.   "bigreactors:oreanglesite",
  54.   "biomesoplenty:gem_ore",
  55.   "astralsorcery:blockcustomore",
  56.   "actuallyadditions:block_misc",
  57.   "minecraft:quartz_ore",
  58.   "rftools:dimensional_shard_ore",
  59.   "quark:biotite_ore",
  60.   "railcraft:ore_metal_poor",
  61.   "railcraft:ore_metal",
  62.   "railcraft:ore_magic",
  63.   "woot:stygianironore",
  64. }
  65.  
  66. function forward()
  67. turtle.attack()
  68. turtle.attack()
  69. turtle.attack()
  70. turtle.forward()
  71. end
  72.  
  73. function up()
  74. turtle.attackUp()
  75. turtle.attackUp()
  76. turtle.attackUp()
  77. turtle.up()
  78. end
  79.  
  80. function down()
  81. turtle.attackDown()
  82. turtle.attackDown()
  83. turtle.attackDown()
  84. turtle.down()
  85. end
  86.  
  87.  
  88. function DigForward()
  89.  
  90. while turtle.detect() do
  91. turtle.dig()
  92. end
  93. forward()
  94. end
  95.  
  96.  
  97. function Ore()
  98.  
  99. success, block = turtle.inspectUp()
  100. for i=1,#Ores do
  101. if Ores[i] == block.name then
  102. block = nil
  103. turtle.digUp()
  104. up()
  105. Ore()
  106. down()
  107. break
  108. end
  109. end
  110.  
  111. for i=1,4 do
  112.  
  113. success, block = turtle.inspect()
  114. for i=1,#Ores do
  115. if Ores[i] == block.name then
  116. block = nil
  117. while turtle.detect() do
  118. turtle.dig()
  119. end
  120. forward()
  121. Ore()
  122. turtle.turnRight()
  123. turtle.turnRight()
  124. forward()
  125. turtle.turnRight()
  126. turtle.turnRight()
  127. break
  128. end
  129. end
  130.  
  131. turtle.turnRight()
  132.  
  133. end
  134.  
  135. success, block = turtle.inspectDown()
  136. for i=1,#Ores do
  137. if Ores[i] == block.name then
  138. block = nil
  139. turtle.digDown()
  140. down()
  141. Ore()
  142. up()
  143. break
  144. end
  145. end
  146.  
  147. end
  148.  
  149. function DigDown()
  150.  
  151. while hight > startHight do
  152. turtle.digDown()
  153. down()
  154. hight = hight - 1
  155. Ore()
  156. end
  157. end
  158.  
  159.  
  160. function returntToPlant()
  161.  
  162. while hight > startHight do
  163. down()
  164. hight = hight - 1
  165. end
  166. end
  167.  
  168.  
  169. function returnToChest()
  170. while hight < chestHight do
  171. up()
  172. hight = hight + 1
  173. end
  174. end
  175.  
  176. function fuel()
  177. if turtle.getFuelLevel() < 2000 then
  178. turtle.refuel()
  179. end
  180. end
  181.  
  182. function chestDropp()
  183. for i=1,16 do
  184. turtle.select(i)
  185. fuel()
  186. turtle.dropUp()
  187. end
  188. end
  189.  
  190. function doStrip()
  191.  
  192. for i=1,circlesDone*4 do
  193. DigForward()
  194. Ore()
  195. end
  196.  
  197. turtle.turnRight()
  198. turtle.turnRight()
  199.  
  200. for i=1,circlesDone*4 do
  201. forward()
  202. end
  203.  
  204. end
  205.  
  206. function mine()
  207.  
  208. for i=1,circlesDone*4 do
  209. DigForward()
  210. Ore()
  211. end
  212.  
  213. turtle.turnRight()
  214.  
  215. doStrip()
  216. doStrip()
  217.  
  218. turtle.turnRight()
  219.  
  220. for i=1,circlesDone*4 do
  221. forward()
  222. end
  223.  
  224. turtle.turnLeft()
  225.  
  226. end
  227.  
  228. function doCircle()
  229.  
  230. for i=1,4 do
  231. mine()
  232. returnToChest()
  233. chestDropp()
  234. returntToPlant()
  235. end
  236.  
  237. circlesDone = circlesDone + 1
  238.  
  239. end
  240.  
  241. function doPlant()
  242.  
  243. DigDown()
  244.  
  245. for i=1,circles do
  246. doCircle()
  247. end
  248.  
  249. startHight = startHight - 4
  250. circlesDone = 1
  251.  
  252. end
  253.  
  254. function run()
  255.  
  256. while startHight > endHight do
  257. doPlant()
  258. end
  259. returnToChest()
  260. end
  261.  
  262. run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement