Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. --Quarry Code
  2. --Variables:
  3. Args = {...}
  4.  
  5.  
  6. --functions:
  7.  
  8. function graveldig() --Gravel Shield for forward digging and the digging
  9. if turtle.detect() then
  10. bool,data=turtle.inspect()
  11. while data.name ~= "minecraft:flowing_water" and data.name ~= "minecraft:flowing_lava" and turtle.inspect()~= false do
  12. turtle.dig()
  13. bool,data=turtle.inspect()
  14. end
  15. end
  16. end
  17.  
  18. function graveldigUp() --Gravel Shield for Up digging and the digging Up
  19. if turtle.detectUp() then
  20. bool,data=turtle.inspectUp()
  21. while data.name ~= "minecraft:flowing_water" and data.name ~= "minecraft:flowing_lava" and turtle.inspectUp()~= false do
  22. turtle.digUp()
  23. os.sleep(9/20)
  24. bool,data=turtle.inspect()
  25. end
  26. end
  27. end
  28. function TurtleRefuel() --Refuel
  29. if turtle.getFuelLevel() < 320 and turtle.getItemCount(1) > 3 then
  30. turtle.select(1)
  31. turtle.refuel(3)
  32. print("TurtleRefueling")
  33. end
  34. end
  35.  
  36.  
  37. function UDF() --Break up down in front and move forward (with gravel protection)
  38. if turtle.detect() then
  39. turtle.dig()
  40. end
  41. graveldig()
  42. if turtle.detectDown() then
  43. turtle.digDown()
  44. end
  45. if turtle.detectUp() then
  46. turtle.digUp()
  47. end
  48. turtle.forward()
  49. end
  50.  
  51. function CobbleVoid() --Search inventory for Cobble and void it, move itemslot 15 to an empty one
  52. if turtle.getItemCount(16) > 1 then
  53. for u=2,15 do
  54. itemdetail = turtle.getItemDetail(u)
  55. if itemdetail ~= nil then
  56. if itemdetail.name=="minecraft:cobblestone" or itemdetail.name=="etfuturum:stone" or itemdetail.name=="minecraft:cobblestone"then
  57. turtle.select(u)
  58. os.sleep(2/20)
  59. turtle.drop()
  60. turtle.select(16)
  61. turtle.transferTo(u)
  62. end
  63. end
  64.  
  65. end
  66. turtle.select(1)
  67. end
  68. end
  69.  
  70. function Downs() --move s down
  71. for k=1,s do
  72. if turtle.detectDown() then
  73. turtle.digDown()
  74. end
  75. turtle.down()
  76. end
  77. end
  78.  
  79. function Upz() --move z up
  80. for k=1,z do
  81. if turtle.detectUp() then
  82. turtle.digUp()
  83. end
  84. graveldigUp()
  85. turtle.up()
  86. end
  87. end
  88. function TurnAround() --Turn around
  89. turtle.turnLeft()
  90. turtle.turnLeft()
  91. end
  92.  
  93. function EndoftheRoad() --Turns around and down at the end of the road
  94. s=3
  95. Downs()
  96. TurnAround()
  97. end
  98.  
  99. function ItemDelivery() --Drop items in the chest in front of it (needs to be trapped or regular)
  100. bool,data=turtle.inspect()
  101. if data.name == "minecraft:chest" or data.name == "minecraft:trapped_chest" then
  102. for p=2,16 do
  103. turtle.select(p)
  104. os.sleep(2/20)
  105. turtle.drop()
  106. end
  107. else
  108. turtle.dig()
  109. end
  110. turtle.select(1)
  111. end
  112.  
  113. function BacktoChest() --Moves Turtle by q blocks back to chest
  114. turtle.turnLeft()
  115. for u=1,q do
  116. while turtle.detect() do
  117. turtle.dig()
  118. end
  119. turtle.forward()
  120. end
  121. turtle.turnRight()
  122.  
  123. end
  124. function LeavingChest() --Moves Turtle by q blocks from the chest
  125.  
  126. turtle.turnRight()
  127.  
  128. for u=1,q do
  129. graveldig()
  130. turtle.forward()
  131. end
  132. turtle.turnRight()
  133. end
  134.  
  135. --Parameters:
  136. s=3
  137. z=3
  138. i=0
  139. j=tonumber(Args[2])
  140. r=tonumber(Args[1])
  141. q=0
  142. d=tonumber(Args[3])
  143. b=0
  144. --Code:
  145.  
  146. print("Turtle will dig a")
  147. print(r)
  148. print("by")
  149. print(j/2)
  150. print("by")
  151. print(6+d*6)
  152. print("Volume")
  153. for y=1,r do
  154. while i <= j do
  155.  
  156. TurtleRefuel()
  157. CobbleVoid()
  158.  
  159. if i < 0.5*j then
  160. UDF()
  161. elseif i == 0.5*j then
  162. if turtle.detectUp() then
  163. turtle.digUp()
  164. end
  165. EndoftheRoad()
  166. elseif i > 0.5*j then
  167. UDF()
  168. end
  169. i=i+1
  170.  
  171. if i == j+1 and b < d then --This will make it dig deeper by d*3
  172. i=0
  173. b=b+1
  174. if turtle.detectUp() then
  175. turtle.digUp()
  176. end
  177. EndoftheRoad() --This will orient the turtle properly for the extra dig
  178. end
  179.  
  180. end
  181.  
  182.  
  183.  
  184. z = 3+d*2*3
  185. Upz()
  186. BacktoChest()
  187. ItemDelivery()
  188. q=q+1
  189. LeavingChest()
  190. i=0
  191. b=0
  192. end
  193. print("Done")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement