Advertisement
colhaydutu

Untitled

Nov 2nd, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. local modem = peripheral.wrap("back")
  2. modem.open(1)
  3.  
  4. local source = peripheral.getNames()
  5.  
  6. while true do
  7. local sourceChests = {}
  8. local targetChests = {}
  9.  
  10. for _, name in ipairs(source) do
  11. if string.match(name, "techreborn:recycler") then
  12. table.insert(sourceChests, peripheral.wrap(name))
  13. elseif string.match(name, "techreborn:auto_crafting_table") then
  14. table.insert(targetChests, peripheral.wrap(name))
  15. end
  16. end
  17.  
  18. for _, sourceChest in ipairs(sourceChests) do
  19. for _, targetChest in ipairs(targetChests) do
  20. local targetName = peripheral.getName(targetChest)
  21. for slot, item in pairs(sourceChest.list()) do
  22. if item.name == "techreborn:scrap" then
  23. sourceChest.pushItems(targetName, slot)
  24. end
  25. end
  26. end
  27. end
  28.  
  29. sleep(1)
  30. end
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement