Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 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. turtle.select(15)
  30. for v=2,14 do
  31. turtle.transferTo(v)
  32. end
  33. turtle.select(1)
  34. end
  35. end
  36.  
  37. function Down3() --move 3 down
  38. for k=1,3 do
  39. if turtle.detectDown() then
  40. turtle.digDown()
  41. end
  42. turtle.down()
  43. end
  44. end
  45.  
  46. function Up3() --move 3 up
  47. for k=1,3 do
  48. if turtle.detectUp() then
  49. turtle.digUp()
  50. end
  51. turtle.up()
  52. end
  53. end
  54. function TurnAround() --Turn around
  55. turtle.turnLeft()
  56. turtle.turnLeft()
  57. end
  58.  
  59. function EndoftheRoad() --Turns around and down at the end of the road
  60. Down3()
  61. TurnAround()
  62. end
  63.  
  64.  
  65. function ItemDelivery() --Drop items in the chest in front of it (needs to be trapped or regular)
  66. if turtle.detect() then
  67. bool,data=turtle.inspect()
  68. if data.name == "minecraft:chest" or data.name == "minecraft:trapped_chest" then
  69. for i=2,16 do
  70. turtle.select(i)
  71. os.sleep(2/20)
  72. turtle.drop()
  73. end
  74. else
  75. turtle.dig()
  76. end
  77. end
  78. end
  79.  
  80. function BacktoChest() --Moves Turtle by q blocks back to chest
  81. Up3()
  82. turtle.turnLeft()
  83. for u=1,q do
  84. turtle.forward()
  85. end
  86. turtle.turnRight()
  87.  
  88. end
  89. function LeavingChest() --Moves Turtle by q blocks from the chest
  90. turtle.turnRight()
  91. for u=1,q do
  92. turtle.dig()
  93. turtle.forward()
  94. end
  95. turtle.turnRight()
  96. end
  97.  
  98. --Parameters:
  99.  
  100. i=0
  101. j=tonumber(Args[2])
  102. r=tonumber(Args[1])
  103. q=0
  104. --Code:
  105.  
  106. for y=1,r do
  107. while i <= j do
  108.  
  109. TurtleRefuel()
  110. CobbleVoid()
  111.  
  112. if i < 0.5*j then
  113. UDF()
  114. elseif i == 0.5*j then
  115. EndoftheRoad()
  116. elseif i > 0.5*j then
  117. UDF()
  118. TurtleRefuel()
  119. end
  120. i=i+1
  121. end
  122.  
  123. BacktoChest()
  124. ItemDelivery()
  125. q=q+1
  126. LeavingChest()
  127. i=0
  128. end
  129. print("type name 'repeats' 'length' for specifications")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement