factorio-miniloader
factorio-miniloader copied to clipboard
Make filter settings independent of entity order
This seems to be the cause in many cases, if not the only cause, for split belt filter miniloaders to lose the settings.
I'm not sure order of inserters coming from find_entities_filtered
(and so util.get_loader_inserters
) is really defined to be stable in any way, But it does seem to be fairly stable so if fixup
is actually getting called in all cases that it changes then adding this should actually fix the problem completely.
One note is that the changes that util.update_inserters
makes frequently (always?) causes the inserter order from find_entities_filtered
to change, so the filter update has to be done after that call.
After some conversation on the mod discussion forum it's clear that the root problem of depending on the order of entities is what really needs to be fixed, so I've moved in that direction now. My current goal is to get the filter configuration fully independent.
So I think this now has filters working for all cases, although there are a few internal and at least one user visible spot that could still use cleaning up. But it's probably more critical to get circuits fixed at this point.
Before I do too much more though it would be nice to get some feedback on what you think of this approach.