Advertisement
SouthernBlend

Turtle Quarry

Dec 20th, 2019
1,625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. function Init()
  2. pathed = 0
  3. turtle.digDown()
  4. turtle.down()
  5. turtle.digDown()
  6. turtle.down()
  7. end
  8. function Refuel()
  9. fuel = turtle.getFuelLevel()
  10. while fuel < 200 do
  11. print("Refueling...")
  12. turtle.select(1)
  13. turtle.refuel(1)
  14. fuel = turtle.getFuelLevel()
  15. end
  16. print("Turtle is done refueling")
  17. end
  18. function Mine()
  19. print("Mining")
  20. x = 15
  21. while x > 0 do
  22. turtle.digUp()
  23. turtle.digDown()
  24. if turtle.forward() == false then
  25. print("Path is obstructed. Probably gravel or sand. Clearing...")
  26. repeat
  27. turtle.digUp()
  28. turtle.dig()
  29. sleep(0.25) -- small sleep to allow for gravel/sand to fall.
  30. until turtle.forward() == true
  31. end
  32. x = x - 1
  33. end
  34. end
  35. function TurnAroundLeft()
  36. print("Turning Left")
  37. turtle.turnLeft()
  38. if turtle.forward() == false then
  39. print("Path is obstructed. Probably gravel or sand. Clearing...")
  40. repeat
  41. turtle.digUp()
  42. turtle.dig()
  43. turtle.digDown()
  44. sleep(0.25) -- small sleep to allow for gravel/sand to fall.
  45. until turtle.forward() == true
  46.  
  47. end
  48. turtle.turnLeft()
  49. end
  50. function TurnAroundRight()
  51. print("Turning Right")
  52. turtle.turnRight()
  53. if turtle.forward() == false then
  54. print("Path is obstructed. Probably gravel or sand. Clearing...")
  55. repeat
  56. turtle.digUp()
  57. turtle.dig()
  58. turtle.digDown()
  59. sleep(0.25) -- small sleep to allow for gravel/sand to fall.
  60. until turtle.forward() == true
  61.  
  62.  
  63. end
  64. turtle.turnRight()
  65. end
  66. function PathtoChest()
  67. print("Going to the chest")
  68. move = 16
  69. turtle.turnRight()
  70. while move > 0 do
  71. if turtle.forward() == false then
  72. print("Path is obstructed. Probably gravel or sand. Clearing...")
  73. repeat
  74. turtle.digUp()
  75. turtle.dig()
  76. turtle.digDown()
  77. sleep(0.25) -- small sleep to allow for gravel/sand to fall.
  78. until turtle.forward() == true
  79. end
  80. move = move - 1
  81. end
  82.  
  83. turtle.turnRight()
  84. move = 10
  85.  
  86. while move > 0 do
  87. if turtle.forward() == false then
  88. print("Path is obstructed. Probably gravel or sand. Clearing...")
  89. repeat
  90. turtle.digUp()
  91. turtle.dig()
  92. turtle.digDown()
  93. sleep(0.25) -- small sleep to allow for gravel/sand to fall.
  94. until turtle.forward() == true
  95. end
  96. move = move - 1
  97. end
  98. pathedRes = pathed
  99. while pathed > 0 do
  100. turtle.up()
  101. turtle.up()
  102. turtle.up()
  103. pathed = pathed - 1
  104. end
  105. pathed = pathedRes
  106. pathed = pathed + 1
  107. pathedRes = pathed
  108. end
  109. function StoreItems()
  110. for inventory = 2, 16 do
  111. turtle.select(inventory)
  112. turtle.drop()
  113. end
  114. end
  115. function NextLvl()
  116. turtle.turnLeft()
  117. turtle.turnLeft()
  118. while pathed > 0 do
  119. turtle.digDown()
  120. turtle.down()
  121. turtle.digDown()
  122. turtle.down()
  123. turtle.digDown()
  124. turtle.down()
  125. pathed = pathed - 1
  126. end
  127. pathed = pathedRes
  128. end
  129. Refuel()
  130. Init()
  131. loopLvl = 8
  132. loopMine = 10
  133. loopMineRes = loopMine
  134. while loopLvl > 0 do
  135. Refuel()
  136. Mine()
  137. while loopMine > 0 do
  138. Refuel()
  139. TurnAroundLeft()
  140. Mine()
  141. TurnAroundRight()
  142. Mine()
  143. loopMine = loopMine - 1
  144. end
  145. loopMine = loopMineRes
  146. PathtoChest()
  147. StoreItems()
  148. NextLvl()
  149. loopLvl = loopLvl - 1
  150. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement