Advertisement
funkd0ct0r

Untitled

Mar 27th, 2014
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. -- n50gd8aN
  2.  
  3. --place turtle in center of hollow hill feature at block 63 (turtle makes 64), coords +- 256,256, facing east
  4.  
  5. --turtle will autofuel from slot 1
  6. --turtle will return to surface after finding charm of life or when maxSize area has been cleared
  7.  
  8.  
  9. local curX = 0
  10. local curY = 0
  11.  
  12. local maxSize = 48
  13.  
  14. local function foundItem(chest)
  15.  
  16. print("Found a treasure chest!")
  17.  
  18. turtle.digDown()
  19. for slot = 1, 16 do
  20. if turtle.getItemCount(slot) > 0 then
  21. turtle.select(slot)
  22. turtle.dropDown()
  23. sleep(0)
  24. end
  25. end
  26. turtle.select(1)
  27.  
  28. local stacks = 0
  29. while turtle.suck() do
  30. stacks = stacks + 1
  31. sleep(0)
  32. end
  33. turtle.select(16)
  34. turtle.dig()
  35.  
  36. print("Looted " .. stacks .. "items.")
  37.  
  38. --return to surface
  39. for x = 1, 64 do
  40. while not turtle.up() do
  41. turtle.digUp()
  42. sleep(0)
  43. end
  44. end
  45.  
  46. turtle.place()
  47. for slot = 1, 16 do
  48. if turtle.getItemCount(slot) > 0 then
  49. turtle.select(slot)
  50. turtle.drop()
  51. sleep(0)
  52. end
  53. end
  54. turtle.select(1)
  55.  
  56. --dig down and continue quarry
  57. for x = 1, 64 do
  58. while not turtle.down() do
  59. turtle.digDown()
  60. sleep(0)
  61. end
  62. end
  63.  
  64. end
  65.  
  66. local function digForward()
  67.  
  68. local chest
  69.  
  70. chest = peripheral.wrap("left")
  71. if chest then
  72. turtle.turnLeft()
  73. foundItem(chest)
  74. turtle.turnRight()
  75. end
  76. chest = peripheral.wrap("front")
  77. if chest then
  78. foundItem(chest)
  79. end
  80. chest = peripheral.wrap("right")
  81. if chest then
  82. turtle.turnRight()
  83. foundItem(chest)
  84. turtle.turnLeft()
  85. end
  86.  
  87.  
  88. while not turtle.forward() do
  89. sleep(0)
  90. turtle.dig()
  91. end
  92. turtle.digDown()
  93. end
  94.  
  95.  
  96. local function main()
  97.  
  98. local reqFuel = 32 + ((maxSize / 2 - 8) * 2) + (maxSize * maxSize) + (64 * 3)
  99.  
  100. turtle.select(1)
  101. while turtle.getFuelLevel() < reqFuel do
  102. if not turtle.refuel(1) then
  103. print("Req Fuel: " .. reqFuel .. " Cur Fuel: " .. turtle.getFuelLevel())
  104. sleep(1)
  105. end
  106. end
  107. turtle.dropUp()
  108.  
  109. --dig down and position to corner of quarry area
  110.  
  111.  
  112. for x = 1, 32 do
  113. repeat turtle.digDown() sleep(0) until turtle.down()
  114. end
  115. turtle.turnLeft()
  116. for x = 1, (maxSize / 2 - 8) do
  117. repeat turtle.dig() sleep(0) until turtle.forward()
  118. end
  119. turtle.turnLeft()
  120. for x = 1, (maxSize / 2 - 8) do
  121. repeat turtle.dig() sleep(0) until turtle.forward()
  122. end
  123. turtle.turnLeft()
  124. --quarry out the level
  125. curX = 0
  126. curY = 0
  127. while true do
  128. if(curY % 2 == 0) then
  129. digForward()
  130. curX = curX + 1
  131.  
  132. if(curX >= maxSize) then
  133. turtle.turnLeft()
  134. digForward()
  135. digForward()
  136. digForward()
  137. turtle.turnLeft()
  138. curY = curY + 3
  139. end
  140. else
  141. digForward()
  142. curX = curX - 1
  143.  
  144. if(curX <= 0) then
  145. turtle.turnRight()
  146. digForward()
  147. digForward()
  148. digForward()
  149. curY = curY + 3
  150. if(curY > maxSize) then
  151. break
  152. else
  153. turtle.turnRight()
  154. end
  155. end
  156. end
  157. end
  158.  
  159. --return to surface
  160. for x = 1, 64 do
  161. repeat turtle.digUp() sleep(0) until turtle.up()
  162. end
  163.  
  164. end
  165.  
  166.  
  167.  
  168. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement