@@ -960,7 +960,7 @@ impl EntityCommands<'_> {
960960 /// ```
961961 #[ track_caller]
962962 pub fn insert ( self , bundle : impl Bundle ) -> Self {
963- self . add ( insert ( bundle, InsertMode :: Replace ) )
963+ self . enqueue ( insert ( bundle, InsertMode :: Replace ) )
964964 }
965965
966966 /// Similar to [`Self::insert`] but will only insert if the predicate returns true.
@@ -998,7 +998,7 @@ impl EntityCommands<'_> {
998998 F : FnOnce ( ) -> bool ,
999999 {
10001000 if condition ( ) {
1001- self . add ( insert ( bundle, InsertMode :: Replace ) )
1001+ self . enqueue ( insert ( bundle, InsertMode :: Replace ) )
10021002 } else {
10031003 self
10041004 }
@@ -1018,7 +1018,7 @@ impl EntityCommands<'_> {
10181018 /// To avoid a panic in this case, use the command [`Self::try_insert_if_new`]
10191019 /// instead.
10201020 pub fn insert_if_new ( self , bundle : impl Bundle ) -> Self {
1021- self . add ( insert ( bundle, InsertMode :: Keep ) )
1021+ self . enqueue ( insert ( bundle, InsertMode :: Keep ) )
10221022 }
10231023
10241024 /// Adds a dynamic component to an entity.
@@ -1043,7 +1043,7 @@ impl EntityCommands<'_> {
10431043 ) -> Self {
10441044 let caller = Location :: caller ( ) ;
10451045 // SAFETY: same invariants as parent call
1046- self . add ( unsafe { insert_by_id ( component_id, value, move |entity| {
1046+ self . enqueue ( unsafe { insert_by_id ( component_id, value, move |entity| {
10471047 panic ! ( "error[B0003]: {caller}: Could not insert a component {component_id:?} (with type {}) for entity {entity:?} because it doesn't exist in this World. See: https://bevyengine.org/learn/errors/b0003" , std:: any:: type_name:: <T >( ) ) ;
10481048 } ) } )
10491049 }
@@ -1062,7 +1062,7 @@ impl EntityCommands<'_> {
10621062 value : T ,
10631063 ) -> Self {
10641064 // SAFETY: same invariants as parent call
1065- self . add ( unsafe { insert_by_id ( component_id, value, |_| { } ) } )
1065+ self . enqueue ( unsafe { insert_by_id ( component_id, value, |_| { } ) } )
10661066 }
10671067
10681068 /// Tries to add a [`Bundle`] of components to the entity.
@@ -1115,7 +1115,7 @@ impl EntityCommands<'_> {
11151115 /// ```
11161116 #[ track_caller]
11171117 pub fn try_insert ( self , bundle : impl Bundle ) -> Self {
1118- self . add ( try_insert ( bundle, InsertMode :: Replace ) )
1118+ self . enqueue ( try_insert ( bundle, InsertMode :: Replace ) )
11191119 }
11201120
11211121 /// Similar to [`Self::try_insert`] but will only try to insert if the predicate returns true.
@@ -1150,7 +1150,7 @@ impl EntityCommands<'_> {
11501150 F : FnOnce ( ) -> bool ,
11511151 {
11521152 if condition ( ) {
1153- self . add ( try_insert ( bundle, InsertMode :: Replace ) )
1153+ self . enqueue ( try_insert ( bundle, InsertMode :: Replace ) )
11541154 } else {
11551155 self
11561156 }
@@ -1166,7 +1166,7 @@ impl EntityCommands<'_> {
11661166 ///
11671167 /// Unlike [`Self::insert_if_new`], this will not panic if the associated entity does not exist.
11681168 pub fn try_insert_if_new ( self , bundle : impl Bundle ) -> Self {
1169- self . add ( try_insert ( bundle, InsertMode :: Keep ) )
1169+ self . enqueue ( try_insert ( bundle, InsertMode :: Keep ) )
11701170 }
11711171
11721172 /// Removes a [`Bundle`] of components from the entity.
@@ -1208,17 +1208,17 @@ impl EntityCommands<'_> {
12081208 where
12091209 T : Bundle ,
12101210 {
1211- self . add ( remove :: < T > )
1211+ self . enqueue ( remove :: < T > )
12121212 }
12131213
12141214 /// Removes a component from the entity.
12151215 pub fn remove_by_id ( self , component_id : ComponentId ) -> Self {
1216- self . add ( remove_by_id ( component_id) )
1216+ self . enqueue ( remove_by_id ( component_id) )
12171217 }
12181218
12191219 /// Removes all components associated with the entity.
12201220 pub fn clear ( self ) -> Self {
1221- self . add ( clear ( ) )
1221+ self . enqueue ( clear ( ) )
12221222 }
12231223
12241224 /// Despawns the entity.
@@ -1250,7 +1250,7 @@ impl EntityCommands<'_> {
12501250 /// ```
12511251 #[ track_caller]
12521252 pub fn despawn ( self ) -> Self {
1253- self . add ( despawn ( ) )
1253+ self . enqueue ( despawn ( ) )
12541254 }
12551255
12561256 /// Pushes an [`EntityCommand`] to the queue, which will get executed for the current [`Entity`].
@@ -1263,14 +1263,14 @@ impl EntityCommands<'_> {
12631263 /// commands
12641264 /// .spawn_empty()
12651265 /// // Closures with this signature implement `EntityCommand`.
1266- /// .add (|entity: EntityWorldMut| {
1266+ /// .enqueue (|entity: EntityWorldMut| {
12671267 /// println!("Executed an EntityCommand for {:?}", entity.id());
12681268 /// });
12691269 /// # }
12701270 /// # bevy_ecs::system::assert_is_system(my_system);
12711271 /// ```
12721272 #[ allow( clippy:: should_implement_trait) ]
1273- pub fn add < M : ' static > ( mut self , command : impl EntityCommand < M > ) -> Self {
1273+ pub fn enqueue < M : ' static > ( mut self , command : impl EntityCommand < M > ) -> Self {
12741274 self . commands . enqueue ( command. with_entity ( self . entity ) ) ;
12751275 self
12761276 }
@@ -1316,7 +1316,7 @@ impl EntityCommands<'_> {
13161316 where
13171317 T : Bundle ,
13181318 {
1319- self . add ( retain :: < T > )
1319+ self . enqueue ( retain :: < T > )
13201320 }
13211321
13221322 /// Logs the components of the entity at the info level.
@@ -1325,7 +1325,7 @@ impl EntityCommands<'_> {
13251325 ///
13261326 /// The command will panic when applied if the associated entity does not exist.
13271327 pub fn log_components ( self ) -> Self {
1328- self . add ( log_components)
1328+ self . enqueue ( log_components)
13291329 }
13301330
13311331 /// Returns the underlying [`Commands`].
@@ -1344,7 +1344,7 @@ impl EntityCommands<'_> {
13441344
13451345 /// Creates an [`Observer`] listening for a trigger of type `T` that targets this entity.
13461346 pub fn observe < E : Event , B : Bundle , M > ( self , system : impl IntoObserverSystem < E , B , M > ) -> Self {
1347- self . add ( observe ( system) )
1347+ self . enqueue ( observe ( system) )
13481348 }
13491349}
13501350
0 commit comments