Advertisement
superjaja05

Untitled

Sep 15th, 2021
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. local args = {...}
  2.  
  3. function reset()
  4. turn1 = 0
  5. RX = 0
  6. RZ = 0
  7. done2 = false
  8. end
  9.  
  10. reset()
  11.  
  12. function rs()
  13. if args[1] == "up" then
  14. turtle.digUp()
  15. end
  16. if args[1] == "down" then
  17. turtle.digDown()
  18. end
  19. end
  20.  
  21. function turn()
  22. if (turn1 % 2 == 0) then
  23. turtle.turnRight()
  24. if turtle.inspect() == true then
  25. done2 = true
  26. end
  27. turtle.forward()
  28. turtle.turnRight()
  29. else
  30. turtle.turnLeft()
  31. if turtle.inspect() == true then
  32. done2 = true
  33. end
  34. turtle.forward()
  35. turtle.turnLeft()
  36. end
  37. turn1 = turn1+1
  38. RZ = RZ+1
  39. end
  40.  
  41. function insD()
  42. if args[1] == "down" then
  43. if turtle.inspectDown() then
  44. X1, X2 = turtle.inspectDown()
  45. return X2
  46. end
  47. else
  48. if turtle.inspectUp() then
  49. X1, X2 = turtle.inspectUp()
  50. return X2
  51. end
  52. end
  53. end
  54.  
  55. function insfix()
  56. if args[1] == "down" then
  57. X1, X2 = turtle.inspectDown()
  58. else
  59. X1, X2 = turtle.inspectUp()
  60. end
  61. return X1, X2
  62. end
  63.  
  64. function start()
  65. rs()
  66. repeat
  67. repeat
  68. turtle.forward()
  69. if (turn1 % 2 == 0) then
  70. RX = RX+1
  71. else
  72. RX = RX-1
  73. end
  74. rs()
  75. until turtle.inspect() == true
  76. turn()
  77. if done2 == true then break end
  78. rs()
  79. until turtle.inspect() == true or done2 == true
  80. print("Done!")
  81.  
  82. turtle.turnRight()
  83. i1 = 0
  84. repeat
  85. turtle.forward()
  86. i1 = i1+1
  87. until i1 == RZ
  88.  
  89. turtle.turnRight()
  90.  
  91. if RX ~= 0 then
  92. i2 = 0
  93. repeat
  94. turtle.back()
  95. i2 = i2+1
  96. until i2 == RX
  97. end
  98.  
  99. print("Layer Mining Done!")
  100. end
  101.  
  102. function tonumber1(x)
  103. if x ~= nil then
  104. return tonumber(x)
  105. else
  106. return 1
  107. end
  108. end
  109.  
  110. count1 = 0
  111.  
  112. repeat
  113. if count1 ~= tonumber1(args[2]) then
  114. start()
  115. count1 = count1+1
  116. print(count1.."/"..tonumber1(args[2]))
  117. else
  118. break
  119. end
  120. if args[2] ~= nil then
  121. if tonumber(args[2]) > 1 then
  122. reset()
  123. if args[1] == "up" then
  124. turtle.up()
  125. else
  126. turtle.down()
  127. end
  128. restart = true
  129. end
  130. else
  131. restart = false
  132. end
  133. until restart == false
  134.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement