herobrinethree

miner

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