Module Switcher Attachment


Use inserters to add/remove modules from a building, through an attached chest

Utilities
3 months ago
2.0
30
Circuit network Storage
Owner:
StephenB
Source:
https://github.com/StephenBarnes/Modu...
Homepage:
N/A
License:
MIT
Created:
3 months ago
Latest Version:
1.0.0 (3 months ago)
Factorio version:
2.0
Downloaded by:
30 users

Adds a chest that you can place next to anything that uses modules. The chest mirrors the contents of the machine's module inventory, so you can add/remove modules from the machine using inserters, via the chest.

(This uses the engine's new "proxy container" feature. The only runtime scripting this mod does is to link attachments to machines when they're placed.)

Example uses:

  • Add/remove quality modules from furnaces to balance production/consumption of different quality levels.
  • For systems that set recipes in assemblers automatically, such as the "omni-crafter", you can add prod/quality modules only if the recipe allows them.
  • For modded modules that spoil. For example Legendary Space Age has spoiling modules, though they're currently only allowed in beacons because this mod didn't exist when I was designing LSA.

The attachment works for everything with modules: furnaces, assemblers, rocket silos, labs, mining drills, and beacons. It's actually not necessary for beacons, which can already interact with inserters.

Some edge cases: Machines can link to multiple attachments, but each attachment only links to one machine. If you place 2 attachments linked to the same machine, and an inserter between them, the inserter will move modules from the one attachment to the other one, repeating forever. If you put a machine with module inventory next to an unlinked attachment, they will link. If the attachment is already linked to a machine, it won't link to the new machine. If you put an attachment next to multiple machines with module inventories, it links to the first one it finds (checking top, then bottom, then left, then right). If you put an attachment next to 2 machines, and delete the one it's linked to, it doesn't automatically link to the new one, because linking only happens when an entity is built. If you have an attachment linked to a machine, and you delete the machine, and place a new machine, the attachment will link to the new machine. Mining an attachment doesn't give you the modules, but mining the machine does.

Ideas for additional features:

  • Show arrow to attached building. Show warning icon if no attached building.
  • You could make a mod with similar attachments for other inventories - fuel, ingredients, products, trash, chest, rocket cargo, etc.
  • You could make a mod that adds attachments that attach to other attachments. So you could string together like 10 attachments on a chest, allowing you to insert/output from any of those 10 points. You could replace transport belts with lines of connected chests.