Advertisement
Guest User

Miner

a guest
Dec 11th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. length=5
  2. current=0
  3. faceDepth=4
  4. trials=5
  5.  
  6. function Forward()
  7. while not turtle.forward() do
  8. turtle.dig()
  9. turtle.attack()
  10. end
  11. end
  12.  
  13. function Up()
  14. while not turtle.up() do
  15. turtle.digUp()
  16. turtle.attackUp()
  17. end
  18. end
  19.  
  20. function Down()
  21. while not turtle.down() do
  22. turtle.digDown()
  23. turtle.attackDown()
  24. end
  25. end
  26.  
  27. function Dump()
  28. for slot=1,16 do
  29. turtle.select(slot)
  30. turtle.drop()
  31. end
  32. turtle.select(1)
  33. end
  34.  
  35. function Gravel()
  36. while turtle.detect() do
  37. turtle.dig()
  38. sleep(1)
  39. end
  40. end
  41.  
  42. function DigFace()
  43. turtle.turnLeft()
  44. for i=1,faceDepth do
  45. turtle.dig()
  46. turtle.digDown()
  47. Down()
  48. end
  49. turtle.dig()
  50. sleep(1)
  51. Gravel()
  52.  
  53. turtle.turnRight() turtle.turnRight()
  54. turtle.dig()
  55. sleep(1)
  56. Gravel()
  57.  
  58. for i=1,faceDepth do
  59. Up()
  60. turtle.dig()
  61. end
  62. turtle.turnLeft()
  63. end
  64.  
  65. function EmptyInventory(dist)
  66. turtle.turnRight() turtle.turnRight()
  67. while current>0 do
  68. Forward()
  69. current=current-1
  70. end
  71. Down() Down() Down()
  72. Dump()
  73.  
  74. turtle.turnRight() turtle.turnRight()
  75. Up() Up() Up()
  76.  
  77. while current<dist do
  78. Forward()
  79. current=current+1
  80. end
  81. end
  82.  
  83. function DigTunnel()
  84. while current<length do
  85. DigFace()
  86. turtle.dig()
  87. Forward()
  88. current=current+1
  89. if turtle.getItemCount(16)>0 then EmptyInventory(current) end
  90. end
  91. EmptyInventory(0)
  92. end
  93.  
  94. function FindPosition()
  95. turtle.turnLeft()
  96. while not turtle.detect() do
  97. turtle.forward()
  98. end
  99. local success,data=turtle.inspect()
  100. if success and not data.name=="computercraft:turtle_expanded" then
  101. turtle.dig() Forward()
  102. turtle.dig() Forward()
  103. turtle.turnRight()
  104. DigTunnel()
  105. else
  106. turtle.turnRight() sleep(5)
  107. end
  108. end
  109.  
  110.  
  111.  
  112. for i=1,trials do
  113. FindPosition()
  114. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement