-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Description
What problem does this solve or what need does it fill?
Hello! I maintain the moonshine-kind crate, which adds the Instance<T> type. The new changes for entity events in Bevy 0.17 make hard assumptions that the underlying target is exactly an Entity and nothing else.
This makes implementation of newtype wrappers around Entity (like Instance<T>) very awkward.
For example:
- The
EntityEventtrait demands a&mut Entityaccess which forces anyEntity-like struct to provide mutable entity access. This could be avoided if this trait had aset_event_targetmethod instead ofevent_target_mut. - The
EntityEventderive macro expects exactly anEntitytype. In my opinion, it should work with anyContainsEntitytype. - The
EntityCommands::triggermethod demands animpl FnOnce(Entity)constructor function. There should also be a function that lets you just trigger anyEntityEventas-is. I don't see the need to force the user to pass a constructor instead of the event itself.
What solution would you like?
- Refactor
EntityEvent::event_target_muttoEntityEvent::set_event_target - Support
ContainsEntityon#[derive(EntityEvent)] - Refactor
EntityCommands::triggerto take animpl EntityEvent, and addtrigger_withas the ctor version.trigger_withshould also supportContainsEntity.
What alternative(s) have you considered?
N/A
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!