Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. --Quarry Code
  2. --Variables:
  3. Args = {...}
  4.  
  5.  
  6. --functions:
  7. function TurtleRefuel() --Refuel
  8. if turtle.getFuelLevel() < 320 and turtle.getItemCount(1) > 3 then
  9. turtle.select(1)
  10. turtle.refuel(3)
  11. end
  12. end
  13.  
  14. function UDF() --Break up down in front and move forward
  15. if turtle.detect() then
  16. turtle.dig()
  17. end
  18. if turtle.detectDown() then
  19. turtle.digDown()
  20. end
  21. if turtle.detectUp() then
  22. turtle.digUp()
  23. end
  24. turtle.forward()
  25. end
  26.  
  27. function CobbleVoid() --Search inventory for Cobble and void it, move itemslot 15 to an empty one
  28. if turtle.getItemCount(15) > 1 then
  29. for u=2,14 do
  30. itemdetail = turtle.getItemDetail(u)
  31. if itemdetail ~= nil then
  32. if itemdetail.name=="minecraft:cobblestone" then
  33. turtle.select(u)
  34. os.sleep(2/20)
  35. turtle.drop()
  36. turtle.select(15)
  37. turtle.transferTo(u)
  38. end
  39. end
  40.  
  41. end
  42. end
  43. end
  44.  
  45. function Down3() --move 3 down
  46. for k=1,3 do
  47. if turtle.detectDown() then
  48. turtle.digDown()
  49. end
  50. turtle.down()
  51. end
  52. end
  53.  
  54. function Up3() --move 3 up
  55. for k=1,3 do
  56. if turtle.detectUp() then
  57. turtle.digUp()
  58. end
  59. turtle.up()
  60. end
  61. end
  62. function TurnAround() --Turn around
  63. turtle.turnLeft()
  64. turtle.turnLeft()
  65. end
  66.  
  67. function EndoftheRoad() --Turns around and down at the end of the road
  68. Down3()
  69. TurnAround()
  70. end
  71.  
  72.  
  73. function ItemDelivery() --Drop items in the chest in front of it (needs to be trapped or regular)
  74. if turtle.detect() then
  75. bool,data=turtle.inspect()
  76. if data.name == "minecraft:chest" or data.name == "minecraft:trapped_chest" then
  77. for i=2,16 do
  78. turtle.select(i)
  79. os.sleep(2/20)
  80. turtle.drop()
  81. end
  82. else
  83. turtle.dig()
  84. end
  85. end
  86. end
  87.  
  88. function BacktoChest() --Moves Turtle by q blocks back to chest
  89. Up3()
  90. turtle.turnLeft()
  91. for u=1,q do
  92. turtle.forward()
  93. end
  94. turtle.turnRight()
  95.  
  96. end
  97. function LeavingChest() --Moves Turtle by q blocks from the chest
  98. turtle.turnRight()
  99. for u=1,q do
  100. turtle.dig()
  101. turtle.forward()
  102. end
  103. turtle.turnRight()
  104. end
  105.  
  106. --Parameters:
  107.  
  108. i=0
  109. j=tonumber(Args[2])
  110. r=tonumber(Args[1])
  111. q=0
  112. --Code:
  113.  
  114. for y=1,r do
  115. while i <= j do
  116.  
  117. TurtleRefuel()
  118. CobbleVoid()
  119.  
  120. if i < 0.5*j then
  121. UDF()
  122. elseif i == 0.5*j then
  123. EndoftheRoad()
  124. elseif i > 0.5*j then
  125. UDF()
  126. TurtleRefuel()
  127. end
  128. i=i+1
  129. end
  130.  
  131. BacktoChest()
  132. ItemDelivery()
  133. q=q+1
  134. LeavingChest()
  135. i=0
  136. end
  137. print("type name 'repeats' 'length' for specifications")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement