Advertisement
SY573M_404

Untitled

May 28th, 2023
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. relative_x = 0
  2. relative_y = 0
  3. rotation = 0
  4.  
  5. function rotateTo(targetRotation)
  6. while rotation % 4 ~= targetRotation do
  7. turtle.turnRight()
  8. rotation = rotation + 1
  9. end
  10.  
  11. rotation = rotation % 4
  12. end
  13.  
  14.  
  15. function goTo(x, y)
  16. if x ~= relative_x then
  17. if x > relative_x then
  18. rotateTo(1)
  19. else
  20. rotateTo(3)
  21. end
  22.  
  23. while x ~= relative_x do
  24. while true do
  25. local exists, _ = turtle.inspect()
  26.  
  27. if exists then
  28. if not turtle.dig() then
  29. break
  30. end
  31. else
  32. break
  33. end
  34. end
  35.  
  36. assert(turtle.forward())
  37.  
  38. if x > relative_x then
  39. relative_x = relative_x + 1
  40. else
  41. relative_x = relative_x - 1
  42. end
  43. end
  44. end
  45.  
  46. if y ~= relative_y then
  47. if y > relative_y then
  48. rotateTo(0)
  49. else
  50. rotateTo(2)
  51. end
  52.  
  53. while y ~= relative_y do
  54. while true do
  55. local exists, _ = turtle.inspect()
  56.  
  57. if exists then
  58. if not turtle.dig() then
  59. break
  60. end
  61. else
  62. break
  63. end
  64. end
  65.  
  66. assert(turtle.forward())
  67.  
  68. if y > relative_y then
  69. relative_y = relative_y + 1
  70. else
  71. relative_y = relative_y - 1
  72. end
  73. end
  74. end
  75. end
  76.  
  77. for y = 0,20 do
  78. for x = 0,64 do
  79. if x % 2 == 0 then
  80. goTo(x, 0)
  81. goTo(x, 64)
  82. else
  83. goTo(x, 64)
  84. goTo(x, 0)
  85. end
  86.  
  87. for slot = 1,16 do
  88. turtle.select(slot)
  89. detail = turtle.getItemDetail()
  90.  
  91. if detail ~= nil then
  92. turtle.refuel(64)
  93.  
  94. if not string.find(detail["name"], "ore") and not string.find(detail["name"], "raw") and not string.find(detail["name"], "diamond") and not string.find(detail["name"], "redstone") then
  95. turtle.drop(64)
  96. end
  97. end
  98. end
  99. end
  100.  
  101. goTo(0, 0)
  102. rotateTo(2)
  103.  
  104. for i = 1,y do
  105. turtle.up()
  106. end
  107.  
  108. for slot = 1,16 do
  109. turtle.select(slot)
  110. turtle.drop(64)
  111. end
  112.  
  113. for i = 1,y do
  114. turtle.down()
  115. end
  116.  
  117. rotateTo(0)
  118.  
  119. if y ~= -40 then
  120. turtle.digDown()
  121. assert(turtle.down())
  122. end
  123. end
  124.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement