MagmaLP

Me entleerung mit Logistic

Aug 26th, 2025 (edited)
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- CONSTANTS
  2. local INTERVAL = 120
  3. local PIPE_SIDE = "bottom"
  4. local REQUEST_IDS = {
  5.  
  6. --Swords      
  7. 267,   --Iron
  8. 268,   --Wood
  9. 272,   --Stone
  10. 276,   --Diamond
  11. 4369,  --Quarz
  12. 5648,  --Green Sapphire
  13. 5649,  --Ruby
  14. 5650,  --Blue Sapphire
  15. 30198, --Bronze
  16.  
  17. --Pickaxe
  18. 257,   --Iron
  19. 270,   --Wood
  20. 274,   --Stone
  21. 278,   --Diamond
  22. 4368,  --Quarz
  23. 5633,  --Green Sapphire
  24. 5634,  --Ruby
  25. 5635,  --Blue Sapphire
  26. 30200, --Bronze
  27.  
  28. --Axe
  29. 258,   --Iron
  30. 271,   --Wooden
  31. 275,   --Stone
  32. 279,   --Dia
  33. 4365,  --Quarz
  34. 5590,  --Green Sapphine
  35. 5591,  --Ruby
  36. 5592,  --Blue Sapphire
  37. 30199, --Bronze
  38.  
  39. --Shovel
  40. 256,   --Iron
  41. 269,   --Wooden
  42. 273,   --Stone
  43. 277,   --Dia
  44. 4367,  --Quarz
  45. 5637,  --Green Sapphire
  46. 5638,  --Ruby
  47. 5639,  --Blue Sapphire
  48. 30197, --Bronze
  49.  
  50. --Battle Axe
  51. 11532, --Iron
  52. 11530, --Wooden
  53. 11531, --Stone
  54. 11533, --Dia
  55.  
  56. --Hoe
  57. 292,   --Iron
  58. 290,   --Wood
  59. 291,   --Stone
  60. 293,   --Dia
  61. 4366,  --Quarz
  62. 5593,  --Green Sapphire
  63. 5597,  --Ruby
  64. 5598,  --Blue Sapphire
  65. 30196, --Bronze
  66.  
  67. --Warhammer
  68. 11537, --Iron
  69. 11535, --Wooden
  70. 11536, --Stone
  71. 11538, --Dia
  72.  
  73. 5577, --Diamond Handsaw
  74. 261,  --Bow
  75. 11555,--Crossbow
  76.  
  77. -------Armor-------
  78.  
  79. --Leather
  80. 298,
  81. 299,
  82. 300,
  83. 301,
  84.  
  85. --Chain
  86. 302,
  87. 303,
  88. 304,
  89. 305,
  90.  
  91. --Iron
  92. 306,
  93. 307,
  94. 308,
  95. 309,  
  96.    
  97. ------------------------
  98. }
  99.  
  100.  
  101. -- IMPLEMENTATION
  102. function convertNBT(nbt)
  103.     local conv = {}
  104.     if (nbt == nil) then
  105.         return nil
  106.     elseif (nbt["type"] == "NBTTagCompound") or (nbt["type"] == "NBTTagList") then
  107.         for key, value in pairs(nbt["value"]) do
  108.             conv[key] = convertNBT(value)
  109.         end
  110.     else
  111.         conv = nbt["value"]
  112.     end
  113.     return conv
  114. end
  115.  
  116. function getItems(pipe)
  117.     pipe.getAvailableItems()
  118.     local event, result = os.pullEvent("available_items_return")
  119.     return result
  120. end
  121.  
  122. function inList(item)
  123.     for _, id in pairs(REQUEST_IDS) do
  124.         if item.id == id then
  125.             return true
  126.         end
  127.     end
  128.     return false
  129. end
  130.  
  131.  
  132. -- MAIN
  133. local pipe = peripheral.wrap(PIPE_SIDE)
  134. while true do
  135.     for i, result in pairs(getItems(pipe)) do
  136.         local iid, amount = unpack(result)
  137.         local item = {
  138.             id = pipe.getItemID(iid),
  139.             dmg = pipe.getItemDamage(iid),
  140.             nbt = convertNBT(pipe.getNBTTagCompound(iid))
  141.         }
  142.         if inList(item) then
  143.             pipe.makeRequest(iid, amount)
  144.             sleep(2)
  145.         end
  146.     end
  147.     sleep(INTERVAL)
  148. end
Advertisement
Add Comment
Please, Sign In to add comment