Advertisement
Dr_Turtle

Untitled

Jun 25th, 2021
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. local args = {...}
  2.  
  3. local INsets = args[1]
  4. local INstripLength = args[2]
  5. local INstripInterval = args[3]
  6.  
  7.  
  8.  
  9. function checkInv()
  10. if turtle.getItemCount(10)>0 then
  11. turtle.turnRight()
  12. turtle.dig()
  13. while turtle.detect()==true do
  14. turtle.dig()
  15. sleep(0.5)
  16. end
  17. turtle.select(13)
  18. turtle.place()
  19. for i = 1,10 do
  20. turtle.select(i)
  21. turtle.drop()
  22. end
  23. turtle.select(13)
  24. turtle.dig()
  25. turtle.turnLeft()
  26. turtle.select(1)
  27. end
  28. end
  29.  
  30. function checkFuel()
  31. if turtle.getFuelLevel()<50 then
  32. turtle.select(14)
  33. turtle.refuel(20000)
  34. end
  35. end
  36.  
  37. function mine(blocks)
  38. for i = 1,blocks do
  39. turtle.dig()
  40. while not turtle.forward() do
  41. turtle.dig()
  42. sleep(0.25)
  43. end
  44. turtle.digUp()
  45. checkInv()
  46. checkFuel()
  47. end
  48. end
  49.  
  50. function placeTorch()
  51. turtle.select(15)
  52. if turtle.getItemCount()==0 then
  53. turtle.select(16)
  54. end
  55. if turtle.getItemCount()>0 then
  56. turtle.turnRight()
  57. turtle.placeUp()
  58. turtle.turnLeft()
  59. end
  60. end
  61.  
  62. function mineTorch(length)
  63. for i = 1,length,10 do
  64. turtle.select(1)
  65. mine(10)
  66. placeTorch()
  67. end
  68. end
  69.  
  70. function moveForward(blocks)
  71. for i = 1,blocks do
  72. turtle.forward()
  73. while not turtle.forward() do
  74. turtle.dig()
  75. sleep(0.5)
  76. turtle.forward()
  77. end
  78. end
  79. end
  80. function changeLane(direction)
  81. if direction=="L" then
  82. turtle.turnLeft()
  83. mine(INstripInterval-1)
  84. placeTorch()
  85. mine(1)
  86. turtle.turnLeft()
  87. end
  88. if direction=="R" then
  89. turtle.turnRight()
  90. mine(INstripInterval-1)
  91. placeTorch()
  92. mine(1)
  93. turtle.turnRight()
  94. end
  95. end
  96.  
  97. function strip(sets, stripLength, stripInterval)
  98. for i = 1,sets do
  99. if i~=1 then
  100. mine(stripInterval-1)
  101. placeTorch()
  102. mine(1)
  103. end
  104. mine(stripInterval-1)
  105. placeTorch()
  106. mine(1)
  107. turtle.turnRight()
  108. mineTorch(stripLength)
  109. changeLane("L")
  110. mineTorch(stripLength*2)
  111. changeLane("L")
  112. mineTorch(stripLength)
  113. turtle.turnLeft()
  114. end
  115. end
  116.  
  117. print("miner_v2.lua init complete")
  118. print("strip length = ", INstripLength)
  119. print("sets = ", INsets)
  120. print("strip interval = ", INstripInterval)
  121. strip(INsets, INstripLength, INstripInterval)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement