Advertisement
DanFrmSpace

Strip

Sep 28th, 2024 (edited)
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. -- Configuration variables
  2. local tunnelLength = 10 -- Length of each tunnel
  3. local numTunnels = 5 -- Number of tunnels to mine
  4. local tunnelSpacing = 3 -- Spacing between tunnels
  5.  
  6. -- Function to check if inventory is full
  7. local function isInventoryFull()
  8. for i = 1, 16 do
  9. if turtle.getItemCount(i) == 0 then
  10. return false
  11. end
  12. end
  13. return true
  14. end
  15.  
  16. -- Function to return to start and unload items
  17. local function returnAndUnload()
  18. turtle.turnRight()
  19. turtle.turnRight()
  20. for i = 1, tunnelLength do
  21. turtle.forward()
  22. end
  23. for i = 1, 16 do
  24. turtle.select(i)
  25. turtle.drop()
  26. end
  27. turtle.select(1)
  28. end
  29.  
  30. -- Function to mine a 1x3x1 section
  31. local function mineSection()
  32. turtle.digUp()
  33. turtle.digDown()
  34. turtle.dig()
  35. turtle.forward()
  36. end
  37.  
  38. -- Function to mine a single tunnel
  39. local function mineTunnel()
  40. for i = 1, tunnelLength do
  41. mineSection()
  42. if isInventoryFull() then
  43. local distanceMined = i
  44. returnAndUnload()
  45. for j = 1, distanceMined do
  46. turtle.forward()
  47. -- Add checks for obstacles here
  48. while turtle.detect() do
  49. turtle.dig()
  50. end
  51. end
  52. end
  53. end
  54. returnAndUnload()
  55. end
  56.  
  57. -- Main mining operation
  58. for tunnel = 1, numTunnels do
  59. mineTunnel()
  60. if tunnel < numTunnels then
  61. turtle.turnLeft()
  62. for i = 1, tunnelSpacing do
  63. while turtle.detect() do
  64. turtle.dig()
  65. end
  66. turtle.forward()
  67. end
  68. turtle.turnRight()
  69. end
  70. end
  71.  
  72. -- Return to the starting position
  73. turtle.turnRight()
  74. for i = 1, (numTunnels - 1) * tunnelSpacing do
  75. turtle.forward()
  76. end
  77. turtle.turnRight()
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement