Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent API between observers and commands for entity-targetting #14272

Open
benfrankel opened this issue Jul 10, 2024 · 0 comments
Open
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Uncontroversial This work is generally agreed upon

Comments

@benfrankel
Copy link
Contributor

benfrankel commented Jul 10, 2024

Global command vs event:

commands.add(command);
commands.trigger(event);

Entity-local command vs event:

commands.spawn(bundle).add(entity_command).set_parent(parent);
{
    let entity = commands.spawn(bundle).id();
    commands.trigger_targets(event, entity);
    commands.entity(entity)
}.set_parent(parent);

Or with a more ergonomic API (#14233):

commands.spawn(bundle).add(entity_command).set_parent(parent);
commands.spawn(bundle).trigger(event).set_parent(parent);

The difference remains that commands statically distinguish Command and EntityCommand, while events only have Event, with observers having to determine at runtime whether their Trigger includes an entity (currently that entails checking trigger.entity() == Entity::PLACEHOLDER, see #14236).

@benfrankel benfrankel added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jul 10, 2024
@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Uncontroversial This work is generally agreed upon and removed C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jul 14, 2024
@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Jul 14, 2024
@alice-i-cecile alice-i-cecile removed this from the 0.15 milestone Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Uncontroversial This work is generally agreed upon
Projects
None yet
Development

No branches or pull requests

2 participants