-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Extensible builder syntax for system insertion #1978
Copy link
Copy link
Closed
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!
What problem does this solve or what need does it fill?
As we create more and more interesting ways to initialize systems, the number of AppBuilder methods we require explodes in an exponential fashion.
add_systembecomesadd_startup_systembecomesadd_startup_system_to_stagebecomeadd_startup_system_set_to_stagebecomes...What solution would you like?
Use two base methods
add_systemandadd_system_set. Then, use the builder pattern (seeEntityCommandsfor an example) to replicate the existing API using method chaining.For example,
add_startup_system_set_to_stage(my_stage, my_system_set)would becomeadd_system_set(my_system_set).startup().to_stage(my_stage).What alternative(s) have you considered?
Continue expanding our API and method names. That's what IDEs are for right? ;)
Additional context
This would help enable the subworlds RFC and similar extensions.
This is a very nice building block for "labels of mass description", hinted at in #1375. It also opens the door to principled modification of systems added by plugins (e.g. to move them into the required States).