Advertisement
colhaydutu

atm10 loot fabricator automation

Feb 12th, 2025 (edited)
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. local modem = peripheral.wrap("left")
  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, "sophisticatedstorage:chest_") then
  12. table.insert(sourceChests, peripheral.wrap(name))
  13. elseif string.match(name, "hostilenetworks:sim_chamber") then
  14. table.insert(targetChests, peripheral.wrap(name))
  15. elseif string.match(name, "hostilenetworks:loot_fabricator") then
  16. table.insert(targetChests, peripheral.wrap(name))
  17. end
  18. end
  19.  
  20. for _, sourceChest in ipairs(sourceChests) do
  21. for _, targetChest in ipairs(targetChests) do
  22. local targetName = peripheral.getName(targetChest)
  23.  
  24. for slot, item in pairs(sourceChest.list()) do
  25. if item.name == "hostilenetworks:prediction_matrix" then
  26. sourceChest.pushItems(targetName, slot, item.count, 2)
  27. end
  28. end
  29.  
  30. for slot = 2, 4 do
  31. local item = targetChest.list()[slot]
  32. if item then
  33. targetChest.pushItems(peripheral.getName(sourceChest), slot, item.count, 1)
  34. end
  35. end
  36.  
  37. if targetChest.getItemDetail(2) then
  38. local item = targetChest.getItemDetail(2)
  39. if item then
  40. targetChest.pushItems(peripheral.getName(sourceChest), 2, item.count, 1)
  41. end
  42. end
  43. end
  44. end
  45.  
  46. sleep(1)
  47. end
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement