Setting Circuit connections for a new entity

Place to get help with not working mods / modding interface.
Fortheking55
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Mar 21, 2025 8:13 pm
Contact:

Setting Circuit connections for a new entity

Post by Fortheking55 »

Hello follow modders!

In my mod, I delete an existing entity (in this case turrets) and replace it with a "copy" of itself, but just as an upgraded version. I have found where I can copy over the control behaviors from the old entity to the new entity but have not found a way to set the same circuit connections as the old entity had. Any suggestions?

Thanks!
robot256
Smart Inserter
Smart Inserter
Posts: 1121
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Setting Circuit connections for a new entity

Post by robot256 »

Simple. Use https://lua-api.factorio.com/latest/cla ... _connector and https://lua-api.factorio.com/latest/cla ... onnections to identify which wire connectors belonging to other entities are connected to your entity with each type of wire. Then use https://lua-api.factorio.com/latest/cla ... connect_to to reproduce the connections when the new entity is built.
Fortheking55
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Mar 21, 2025 8:13 pm
Contact:

Re: Setting Circuit connections for a new entity

Post by Fortheking55 »

Wow it was pretty simple! I guess I need to learn how to better read the documentation.. I kept looking for "circuit" or "network" and was getting no where. Thank you so much!
Post Reply

Return to “Modding help”