Advertisement
herobrinethree

miner-refill

Jan 21st, 2021 (edited)
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. refill = function()
  2. turtle.select(1)
  3. if turtle.getFuelLevel() < 50 then
  4. repeat
  5. sleep()
  6. destroy()
  7. turtle.placeUp()
  8. turtle.suckUp()
  9. turtle.refuel(64)
  10. turtle.dropUp()
  11. turtle.digUp()
  12. until turtle.getFuelLevel() > 50
  13. end
  14. end
  15.  
  16. destroy = function()
  17. turtle.digDown()
  18. turtle.digUp()
  19. while turtle.detect() == true do
  20. turtle.dig()
  21. end
  22. end
  23. lastdestroy = function()
  24. turtle.digUp()
  25. turtle.digDown()
  26. end
  27. row = function(distance)
  28. for i = 0, distance, 1
  29. do
  30. destroy()
  31. refill()
  32. turtle.forward()
  33. end
  34. end
  35. righthook = function()
  36. turtle.turnRight()
  37. destroy()
  38. refill()
  39. turtle.forward()
  40. turtle.turnRight()
  41. end
  42. lefthook = function()
  43. turtle.turnLeft()
  44. destroy()
  45. refill()
  46. turtle.forward()
  47. turtle.turnLeft()
  48. end
  49. square = function(Length, Depth)
  50. if Length % 2 == 0 then
  51. for i = 1, Length, 2
  52. do
  53. row(Depth)
  54. righthook()
  55. row(Depth)
  56. lefthook()
  57. end
  58. row(Depth)
  59. righthook()
  60. row(Depth)
  61. lastdestroy()
  62. turtle.turnRight()
  63. for i = 0, Length, 1
  64. do
  65. refill()
  66. turtle.forward()
  67. end
  68. turtle.turnRight()
  69. elseif Length % 2 ~= 0 then
  70. for i = 0, Length, 2
  71. do
  72. row(Depth)
  73. righthook()
  74. row(Depth)
  75. lefthook()
  76. end
  77. row(Depth)
  78. lastdestroy()
  79. turtle.turnLeft()
  80. turtle.turnLeft()
  81. for i = 0, Depth, 1
  82. do
  83. refill()
  84. turtle.forward()
  85. end
  86. turtle.turnRight()
  87. for i = 0, Length, 1
  88. do
  89. refill()
  90. turtle.forward()
  91. end
  92. turtle.turnRight()
  93. elseif Length == 0 then
  94. row(Depth)
  95. turtle.turnLeft()
  96. turtle.turnLeft()
  97. for i = 0, Depth, 1
  98. do
  99. refill()
  100. turtle.forward()
  101. end
  102. turtle.turnRight()
  103. turtle.turnRight()
  104. elseif Depth == 0 then
  105. turtle.turnRight()
  106. row(Length)
  107. turtle.turnLeft()
  108. turtle.turnLeft()
  109. for i = 0, Length, 1
  110. do
  111. refill()
  112. turtle.forward()
  113. end
  114. turtle.turnRight()
  115. end
  116. end
  117.  
  118. term.write("Select Depth: ")
  119. local depth = read()
  120. depth = depth - 2
  121. term.write("Select Length: ")
  122. local length = read()
  123. length = length - 2
  124.  
  125. refill()
  126. square(length, depth)
  127. print("Mining Completed")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement