herobrinethree

floorplus

Feb 24th, 2021 (edited)
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Slot 1: Lava Refuel Container
  2. -- Slot 2: Emptying Container
  3. -- Slot 3: Container for Floor Blocks
  4. -- Slot 4: Block For Placing
  5.  
  6. refill = function()
  7. turtle.select(1)
  8. if turtle.getFuelLevel() < 50 then
  9. repeat
  10. sleep(3)
  11. empty()
  12. turtle.digUp()
  13. turtle.placeUp()
  14. turtle.suckUp()
  15. turtle.refuel(64)
  16. turtle.dropUp()
  17. empty()
  18. turtle.digUp()
  19. until turtle.getFuelLevel() > 50
  20. end
  21. end
  22. lastempty = function()
  23. turtle.digUp()
  24. turtle.select(2)
  25. turtle.placeUp()
  26. for i = 4, 16, 1
  27. do
  28. turtle.select(i)
  29. turtle.dropUp(64)
  30. end
  31. turtle.select(2)
  32. turtle.digUp()
  33. turtle.select(1)
  34. end
  35. empty = function()
  36. if turtle.getItemCount(15) >= 1 then
  37. turtle.digUp()
  38. turtle.select(2)
  39. turtle.placeUp()
  40. for i = 4, 16, 1
  41. do
  42. turtle.select(i)
  43. turtle.dropUp(64)
  44. end
  45. turtle.select(2)
  46. turtle.digUp()
  47. turtle.select(1)
  48. end
  49. end
  50. place = function()
  51. blockrefill()
  52. turtle.select(4)
  53. turtle.placeDown()
  54. turtle.select(1)
  55. end
  56.  
  57. blockrefill = function()
  58. if turtle.getItemCount(4) <= 1 then
  59. empty()
  60. turtle.select(4)
  61. turtle.transferTo(16)
  62. turtle.select(5)
  63. turtle.digUp()
  64. turtle.select(3)
  65. turtle.placeUp()
  66. turtle.select(4)
  67. turtle.suckUp(64)
  68. turtle.select(3)
  69. turtle.digUp()
  70. end
  71. turtle.select(1)
  72. end
  73. destroy = function()
  74. empty()
  75. turtle.digDown()
  76. place()
  77. turtle.digUp()
  78. while turtle.detect() == true do
  79. turtle.dig()
  80. end
  81. end
  82. lastdestroy = function()
  83. empty()
  84. turtle.digUp()
  85. turtle.digDown()
  86. place()
  87. end
  88. row = function(distance)
  89. for i = 0, distance, 1
  90. do
  91. destroy()
  92. refill()
  93. turtle.forward()
  94. end
  95. end
  96. righthook = function()
  97. empty()
  98. turtle.turnRight()
  99. destroy()
  100. refill()
  101. turtle.forward()
  102. turtle.turnRight()
  103. end
  104. lefthook = function()
  105. empty()
  106. turtle.turnLeft()
  107. destroy()
  108. refill()
  109. turtle.forward()
  110. turtle.turnLeft()
  111. end
  112. square = function(Length, Depth)
  113. empty()
  114. if Length % 2 == 0 then
  115. for i = 1, Length, 2
  116. do
  117. row(Depth)
  118. righthook()
  119. row(Depth)
  120. lefthook()
  121. end
  122. row(Depth)
  123. righthook()
  124. row(Depth)
  125. lastdestroy()
  126. turtle.turnRight()
  127. for i = 0, Length, 1
  128. do
  129. refill()
  130. turtle.forward()
  131. end
  132. turtle.turnRight()
  133. elseif Length % 2 ~= 0 then
  134. for i = 0, Length, 2
  135. do
  136. row(Depth)
  137. righthook()
  138. row(Depth)
  139. lefthook()
  140. end
  141. row(Depth)
  142. lastdestroy()
  143. turtle.turnLeft()
  144. turtle.turnLeft()
  145. for i = 0, Depth, 1
  146. do
  147. refill()
  148. turtle.forward()
  149. end
  150. turtle.turnRight()
  151. for i = 0, Length, 1
  152. do
  153. refill()
  154. turtle.forward()
  155. end
  156. turtle.turnRight()
  157. elseif Length == 0 then
  158. row(Depth)
  159. turtle.turnLeft()
  160. turtle.turnLeft()
  161. for i = 0, Depth, 1
  162. do
  163. refill()
  164. turtle.forward()
  165. end
  166. turtle.turnRight()
  167. turtle.turnRight()
  168. elseif Depth == 0 then
  169. turtle.turnRight()
  170. row(Length)
  171. turtle.turnLeft()
  172. turtle.turnLeft()
  173. for i = 0, Length, 1
  174. do
  175. refill()
  176. turtle.forward()
  177. end
  178. turtle.turnRight()
  179. end
  180. lastempty()
  181. end
  182.  
  183. term.write("Select Depth: ")
  184. local depth = read()
  185. depth = depth - 2
  186. term.write("Select Length: ")
  187. local length = read()
  188. length = length - 2
  189.  
  190. blockrefill()
  191. refill()
  192.  
  193. square(length, depth)
  194. print("Mining Completed")
Advertisement
Add Comment
Please, Sign In to add comment