identifier for a logistics network?

Place to get help with not working mods / modding interface.
User avatar
mrudat
Fast Inserter
Fast Inserter
Posts: 248
Joined: Fri Feb 16, 2018 5:21 am
Contact:

identifier for a logistics network?

Post by mrudat »

I want to store some data associated with a logistics network (specifically ghosts within the build area of a logistics network), and I'm wondering if there's some sort of identifier that I can use.

It appears that a LuaLogisticNetwork is derived on the fly upon request (or at least, a new Lua object gets instantiated even if there's been no topological change to the network), so I can't index a table directly with LuaLogisticNetwork (and I have this suspicion that doing so might hurt in multiplayer?).

I could perhaps use logistic_network.cells[1].owner.unit_number as an identifier (which at least in limited testing, seems to be the lowest (oldest) unit_number of all cells in the logistics network).

I realise that I'm going to eventually need to also deal with logistics networks merging/splitting/vanishing as roboports are built/deconstructed/destroyed/run out of power, etc. I figure I can determine that logistics network 1 and logistics network 2 merged/split based on the cells that are/were members, and merge/split the data appropriately when that happens.

It's possible that I'm trying too hard and it would be reasonable to associate ghosts with logistics networks by making the appropriate API calls, or perhaps by building an index on force+surface+position that I can use to cross-reference ghosts and roboport build areas.
Post Reply

Return to “Modding help”