diff options
| author | HampusM <hampus@hampusmat.com> | 2026-10-31 14:46:39 +0100 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-10-31 14:46:39 +0100 |
| commit | 89724815230c4fcab81111f626bd4bb8b12db7bd (patch) | |
| tree | 31e3f90eb35850afb991320bd0cab6f6c75e987d /engine-ecs/src/lib.rs | |
| parent | 2d977a7b3089193080365c66219914081a9347ae (diff) | |
feat(engine-ecs): add Actions fn to create sole
Diffstat (limited to 'engine-ecs/src/lib.rs')
| -rw-r--r-- | engine-ecs/src/lib.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/engine-ecs/src/lib.rs b/engine-ecs/src/lib.rs index 6028cf7..188ca7a 100644 --- a/engine-ecs/src/lib.rs +++ b/engine-ecs/src/lib.rs @@ -667,6 +667,27 @@ impl World &ComponentAddingFlags { allow_soles: false }, ); } + Action::CreateSole(sole_parts) => { + if let Err(EntityAlreadyExistsError) = + self.data.component_storage.create_entity(sole_parts.id) + { + tracing::error!( + name = sole_parts.name, + "Can not create sole that already exists" + ); + continue; + } + + let name = sole_parts.name; + + Self::add_entity_components( + sole_parts.id, + [sole_parts, EntityName { name: name.into() }.into_parts()], + &mut self.data.component_storage, + &EventSubmitter::new(&self.data.new_events), + &ComponentAddingFlags { allow_soles: true }, + ); + } Action::Stop => { self.stop.store(true, Ordering::Relaxed); } |
