diff options
Diffstat (limited to 'engine-ecs/src/lib.rs')
| -rw-r--r-- | engine-ecs/src/lib.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/engine-ecs/src/lib.rs b/engine-ecs/src/lib.rs index 88acca9..190eab7 100644 --- a/engine-ecs/src/lib.rs +++ b/engine-ecs/src/lib.rs @@ -127,13 +127,13 @@ impl World /// Creates a entity with the given components. A new unique [`Uid`] will be generated /// for this entity. - pub fn create_entity<Comps>(&mut self, components: Comps) -> Uid + pub fn spawn<Comps>(&mut self, components: Comps) -> Uid where Comps: ComponentSequence, { let entity_uid = Uid::new_unique(); - self.create_entity_with_uid(entity_uid, components); + self.spawn_with_uid(entity_uid, components); entity_uid } @@ -141,7 +141,7 @@ impl World /// Creates a entity with the given components. The entity will have the specified /// [`Uid`]. #[tracing::instrument(skip_all)] - pub fn create_entity_with_uid<Comps>(&mut self, entity_uid: Uid, components: Comps) + pub fn spawn_with_uid<Comps>(&mut self, entity_uid: Uid, components: Comps) where Comps: ComponentSequence, { @@ -158,12 +158,12 @@ impl World ); } - pub fn create_declared_entity(&mut self, entity_decl: &EntityDeclaration) + pub fn spawn_declared_entity(&mut self, entity_decl: &EntityDeclaration) { - entity_decl.create(self); + entity_decl.spawn(self); } - /// Adds a singleton. + /// Adds a singleton component. /// /// # Errors /// Returns `Err` if this [`Sole`] has already been added. @@ -214,12 +214,11 @@ impl World { let (type_erased_system, mut system_callbacks) = system.finish(); - let system_ent_id = - self.create_entity((SystemComponent { system: type_erased_system },)); + let system_ent_id = self.spawn((SystemComponent { system: type_erased_system },)); system_callbacks.on_created(self, SystemMetadata { ent_id: system_ent_id }); - self.create_entity_with_uid( + self.spawn_with_uid( phase_euid, (Pair::builder() .relation::<PhaseHasSystem>() |
