There is no way to uniquely identify logistic sections, so you have to rely on indexes ("names" (groups) don't work since they introduce special behaviour and are also visible to the player). So you can't create a section and say "this is the network section" with something like an ID that you can later query (that would've been ideal). You have to create the section, note down its index, and store "the network section for the combinator with unit number x
is at index i
. It is a bit jank but works out well enough. This is required to know which sections to use for network and Cybersyn signals, and which sections to show in the output signals area.
Unless someone specificaly asked for having proper sections being configurable in the UI I don't really understand why you would implement it. To me it seems that it is treating symptoms instead of fixing root cause of the problem.
Having sections support is quite crucial, so that you can do what you can with the new vanilla constant combinators: Set up requests that you can share between multiple stations (like having multiple stations that request iron ore). Then you can update the iron ore request in one place without having to update each station (for example).
But perhaps more importantly, it removes the need to have all the sorting code which is currently necessary to handle the fact that multiple sections can exist (when copied or upgraded from a constant combinator) while the old design relied on there not being any sections at all (in 1.1, where the different types of signals were stored at different offsets in the signal table).
control signals also have to be in specific order
(Cybersyn) control signals are all stored at fixed indices in their signal section but are managed completely internally by the combinator. It would make no sense to have multiple threshold signals for example. They all get merged to a single value by the game anyway and which signal would you show and update in the text field?
or just don't care and put everything in one section (since it will be read by same logic once it is open again and all signals will be summed up again)
This would break fantastically if the player wants to organize their requests in a certain way, maybe have some sections be shared while others are specific to the station for example. It's basically what the current version does (for cargo signals) and it's not great now that sections exist. I've seen some people use the vanilla combinators instead since this one lacks section support (understandably, I would do the same depending on my needs for a particular station).
With the sections support, combinators on placement/copy/upgrade will instead:
- Move any network (virtual) signals to the network signal section (merging if any of the same name+quality exist). (If it's a grouped section, they are copied instead to not have unintentional effects elsewhere in the circuit network.) (It might be desirable to be able to have multiple network signal sections, but I would need to find a way to make the UI be able to display and let the player manage them without being a mess.)
- Move any Cybersyn control signals to the Cybersyn signal section (likewise, also merged if there are multiple, and grouped sections are once again left intact).
- Any non-grouped sections left empty after the above two steps are pruned.
- Meaning any remaining sections are output signal sections and display similar to a regular constant combinator (with the caveat that due to lacking API support, not all features are available).
It could make sense to have the network signals be dynamically read from all sections, but the issue becomes that it's then unclear what section they belong to, and the output signal area will be confusing to look at when the sections don't display what they actually contain (assuming the network signals would be filtered out of that display), that latter part may be a minor thing though.
It would mean that the only section with special handling would be the Cybersyn signal section, and I might approach this route if I manage to figure out a way to allow multiple network signal groups to work in the UI. You could then have the same section appear in both lists, with the network side filtered to show network signals of that section, and the output signals side showing cargo signals. That would make it work mostly the way you describe, with the exception of control signals.
Edit: Created an issue for tracking multiple section support for network signals, although such a feature is probably far off from being realised.