Add new method entity_commands to EntityWorldMut#24266
Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨ |
| f(guard.entity_mut.world) | ||
| } | ||
|
|
||
| /// Creates a new [`EntityCommands`] instance that writes to the world's command queue |
There was a problem hiding this comment.
I feel this should explain that the commands are related to this EntityWorldMut's Entity, but I can't figure out the wording.
There was a problem hiding this comment.
perhaps something like:
| /// Creates a new [`EntityCommands`] instance that writes to the world's command queue | |
| /// Creates a new [`EntityCommands`] instance that writes commands | |
| /// pertaining to this [`EntityWorldMut`]’s entity to the world's command queue |
| } | ||
|
|
||
| /// Creates a new [`EntityCommands`] instance that writes to the world's command queue | ||
| /// Use [`World::flush`] to apply all queued commands |
There was a problem hiding this comment.
Since this new function is in EntityWorldMut, it seems more appropriate to reference EntityWorldMut’s version of flush.
| /// Use [`World::flush`] to apply all queued commands | |
| /// Use [`EntityWorldMut::flush`] to apply all queued commands |
| f(guard.entity_mut.world) | ||
| } | ||
|
|
||
| /// Creates a new [`EntityCommands`] instance that writes to the world's command queue |
There was a problem hiding this comment.
perhaps something like:
| /// Creates a new [`EntityCommands`] instance that writes to the world's command queue | |
| /// Creates a new [`EntityCommands`] instance that writes commands | |
| /// pertaining to this [`EntityWorldMut`]’s entity to the world's command queue |
| #[inline] | ||
| pub fn entity_commands(&mut self) -> EntityCommands<'_> { | ||
| let id = self.id(); | ||
| EntityCommands { |
There was a problem hiding this comment.
This looks ok, but I wonder if the reborrow that happens in self.world().commands().entity(self.id()) works better / this way is preferred cause it is more succinct and relies on other written functions
I wouldn’t change anything as a result of this comment, just noting for anyone else reading
Objective
Fixes #23512
Added a shortcut for getting
EntityCommands.Hi, this is my first PR to Bevy, I’m not sure if my approach is developer want.
Thanks for the review!