From 213e4cfc698f0e0f9fcfbe43cf8c49f8f331e699 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 8 Jul 2026 23:19:06 +0200 Subject: refactor(engine-ecs): rename entity creation fns to use 'spawn' terminology --- engine-ecs/src/lib.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'engine-ecs/src/lib.rs') 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(&mut self, components: Comps) -> Uid + pub fn spawn(&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(&mut self, entity_uid: Uid, components: Comps) + pub fn spawn_with_uid(&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::() -- cgit v1.2.3-18-g5258