Replies: 3 comments 1 reply
-
Something that I've used for this is the |
Beta Was this translation helpful? Give feedback.
-
In addition to what Alice said, I recommend refactoring your app where all your plugins are purely additive and do not cause panics in others. This coincides with the "features are additive" suggestion in Rust. |
Beta Was this translation helpful? Give feedback.
-
This makes sense and I suspect is the exact right thing to do in normal cases. The problem I'm up against is that I have a bunch of type parametric components, so I need to add type specialized systems to handle them. So I couldn't actually know about all the systems I need at some kind of plugin initialization time. (Whether this parametricity of components is a good idea is a separate question, but I don't see a way around it without putting boxes everywhere which kinda defeats the purpose of ECS which brings all the data into one table for faster processing.) |
Beta Was this translation helpful? Give feedback.
-
The behavior of
add_systems
is that if you add a system a second time it will run twice. I want to be able to "register" systems, so that if they have already been added as part of initialization, they will not be added again.My situation is that I would like to create an easy way for users of my code to add groups of associated entities along with any systems they require to interact correctly. Requiring systems to be added exactly once would require a separation between the entity creation and the system setup phases which would add complexity to the process of setting up the system and increase the potential for tricky bugs like having a missing system (which is a silent failure by definition).
This seems like something that COULD be possible because systems already have a way to write dependencies (
s1.before(s2)
) and the schedule can check if the dependency exists twice in the schedule. But I can't find any way to just checksched.has_system(s2)
.I can obviously work around the problem by adding an additional initialization step to the system, but I'd rather not if there is a better solution.
Beta Was this translation helpful? Give feedback.
All reactions