-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Add new method entity_commands to EntityWorldMut
#24266
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,7 @@ use crate::{ | |||||
| relationship::RelationshipHookMode, | ||||||
| resource::Resource, | ||||||
| storage::{SparseSets, Table}, | ||||||
| system::EntityCommands, | ||||||
| template::{EntityScopes, ScopedEntities, Template, TemplateContext}, | ||||||
| world::{ | ||||||
| error::EntityComponentError, unsafe_world_cell::UnsafeEntityCell, ComponentEntry, | ||||||
|
|
@@ -1877,6 +1878,17 @@ impl<'w> EntityWorldMut<'w> { | |||||
| f(guard.entity_mut.world) | ||||||
| } | ||||||
|
|
||||||
| /// Creates a new [`EntityCommands`] instance that writes to the world's command queue | ||||||
| /// Use [`World::flush`] to apply all queued commands | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this new function is in
Suggested change
|
||||||
| #[inline] | ||||||
| pub fn entity_commands(&mut self) -> EntityCommands<'_> { | ||||||
| let id = self.id(); | ||||||
| EntityCommands { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks ok, but I wonder if the reborrow that happens in I wouldn’t change anything as a result of this comment, just noting for anyone else reading |
||||||
| entity: id, | ||||||
| commands: self.world.commands(), | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| /// Updates the internal entity location to match the current location in the internal | ||||||
| /// [`World`]. | ||||||
| /// | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this should explain that the commands are related to this
EntityWorldMut'sEntity, but I can't figure out the wording.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps something like: