soulgriever

Untitled

Oct 8th, 2021 (edited)
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.12 KB | None | 0 0
  1.  
  2. -- ********************************************************************************** --
  3. -- ** OreQuarry REDUX ** --
  4. -- ** Minecraft Mining Turtle Ore Quarry v0.01 by Soulgriever ** --
  5. -- ** ** --
  6. -- ** Written from scratch but heavily inspired by the original OreQuarry ** --
  7. -- ** by AustinKK ** --
  8. -- ** ** --
  9. -- ** For instructions on how to use: ** --
  10. -- ** ** --
  11. -- ** http://www.youtube.com/watch?v=PIugLVzUz3g ** --
  12. -- ** ** --
  13. -- ** Change Log: ** --
  14. -- ** 8th Oct 2021: [v0.01] Started writing original rogram ** --
  15. -- ** TODO: ** --
  16. -- ** Build Z logic and test initial logic ** --
  17. -- ** Check Fuel level ** --
  18. -- ** Ender Chest Support ** --
  19. -- ** GPS support ** --
  20. -- ** Charge Station support ** --
  21. -- ** Initial program start and arguements ** --
  22. -- ********************************************************************************** --
  23.  
  24.  
  25.  
  26.  
  27.  
  28. --The secret sauce, Main function that digs out defined X and Y while inspecting above and below as it travels
  29. function digLevel()
  30. if X > 0 then
  31. --Inspects if their is a block in front of the turtle and determins if its Water,Lava,Chest, or other block
  32. local I, data = turtle.inspect()
  33. if I then
  34. if data.name ~= "minecraft:water" or data.name ~= "minecraft:lava" then
  35. if data.name == "minecraft:chest" then
  36. checkChest()
  37. else
  38. turtle.dig()
  39. end
  40. turtle.forward()
  41. checkNear()
  42. else
  43. turtle.forward()
  44. checkNear()
  45. end
  46. X = X-1
  47. end
  48. end
  49. if X == 0 then
  50. if Y > 0 then
  51. -- Checks if Y is even or odd
  52. if math.mod(y, 2) == 0 then
  53. turtle.turnRight()
  54. local I, data = turtle.inspect()
  55. if I then
  56. if data.name ~= "minecraft:water" or data.name ~= "minecraft:lava" then
  57. if data.name == "minecraft:chest" then
  58. checkChest()
  59. else
  60. turtle.dig()
  61. end
  62. turtle.forward()
  63. else
  64. turtle.forward()
  65. end
  66. Y = Y-1
  67. turtle.turnRight()
  68. checkNear()
  69. else
  70.  
  71.  
  72. end
  73. end
  74. end
  75. end
  76. end
  77.  
  78. --Logic to check if chest has inventory and then mine chest when chest is empty
  79. function checkChest()
  80. if turtle.suck() == true then
  81. checkChest()
  82. else
  83. if inventory() > 0 then
  84. turtle.dig()
  85. else
  86. returnHome()
  87. end
  88. end
  89. end
  90.  
  91. function checkChestUp()
  92. if turtle.suckUp() == true then
  93. checkChestUp()
  94. else
  95. if inventory() > 0 then
  96. turtle.digUP()
  97. else
  98. returnHome()
  99. end
  100. end
  101. end
  102.  
  103. function checkChestDown()
  104. if turtle.suckDown() == true then
  105. checkChestDown()
  106. else
  107. if inventory() > 0 then
  108. turtle.digDown()
  109. else
  110. returnHome()
  111. end
  112. end
  113. end
  114.  
  115.  
  116. --Logic to inspect above and below and compare inspected item to list of unwanted items
  117. function checkNear()
  118. if inventory() > 1 then
  119. local Up, dataUp = turtle.inspectUp()
  120. local Down, dataDown = turtle.inspectDown()
  121. if Up then
  122. if dataUp.name == "minecraft:chest" then
  123. checkChestUp()
  124. else
  125. --Logic to compare to list
  126. print("not a chest")
  127. end
  128. end
  129. if Down then
  130. if dataDown.name == "minecraft:chest" then
  131. checkChestDown()
  132. else
  133. --Logic to compare to list
  134. print("not a chest")
  135. end
  136. end
  137. else
  138. returnHome()
  139. end
  140. end
  141.  
  142. --Counts the slots in the Turtles inventory to determine if it has room to continue, return's number of empty slots
  143. function inventory()
  144. local inv = 0
  145. for i=1,14 do
  146. turtle.select(i)
  147. if turtle.getItemDetail() == nil then
  148. inv = inv + 1
  149. end
  150. end
  151. turtle.select(16)
  152. return inv
  153. end
  154.  
  155. --Logic to return home
  156. function returnHome()
  157. end
  158.  
  159. --Program Started
  160. term.clear()
  161. term.setCursorPos(1,1)
  162. print(" ___ ___ ___")
  163. print(" / _ \\| _ \\| __|")
  164. print(" | (_) | /| _|")
  165. print(" \\___/|_|_\\|___| v0.01")
  166. print(" ___ _ _ _ ___ _____ __")
  167. print(" / _ \\| | | |/_\\ | _ \\ _ \\ \\ / /")
  168. print(" | (_) | |_| / _ \\| / /\\ V /")
  169. print(" \\__\\_\\\\___/_/ \\_\\_|_\\_|_\\ |_|")
  170. print()
  171. print(" REDUX! by. Soulgriever")
  172.  
  173. print("function Test")
  174. checkNear()
Add Comment
Please, Sign In to add comment