Advertisement
InsideIntel

Untitled

Jan 14th, 2024 (edited)
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. turtle.refuel()
  2. local x, y, z = 1, 1, 1
  3.  
  4. while true do
  5. if not turtle.forward() then
  6. turtle.dig()
  7. end
  8. os.sleep(0.1)
  9. end
  10.  
  11.  
  12. local function gotoChest(newX, newY, newZ)
  13. local direction = nil
  14. if x < newX then direction = "right" turtle.turnRight() elseif x > newX then direction = "left" turtle.turnLeft() end
  15. while x < newX do
  16. turtle.forward()
  17. x = x + 1
  18. end
  19. while x > newX do
  20. turtle.forward()
  21. x = x - 1
  22. end
  23. if direction == "right" then turtle.turnLeft() elseif direction == "left" then turtle.turnRight() end
  24. while z < newZ do
  25. turtle.forward()
  26. z = z + 1
  27. end
  28. while z > newZ do
  29. turtle.back()
  30. z = z - 1
  31. end
  32. while y < newY do
  33. turtle.digUp()
  34. turtle.up()
  35. y = y + 1
  36. end
  37. while y > newY do
  38. turtle.digDown()
  39. turtle.down()
  40. y = y - 1
  41. end
  42. while x == 9 and z == 9 do
  43. turtle.digDown()
  44. turtle.down()
  45. y = y - 1
  46. gotoChest(1, y, 1)
  47. end
  48. end
  49. -- for lookups:
  50. -- local chests = {
  51. -- {1, 1, 1}, -- 1
  52. -- {3, 1, 4}, -- x y z
  53. -- {...}
  54. -- }
  55. local chests = {...}
  56.  
  57. for x = 1, 9 do
  58. for y = 1, 1 do
  59. for z = 1, 9 do
  60. table.insert(chests, {x, y, z})
  61. end
  62. end
  63. end
  64. local function parkC(chest)
  65. local coords = chests[chest]
  66. gotoChest(coords[1], coords[2],coords[3])
  67. end
  68. for i = 1, 81 do
  69. parkC(i)
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement