diff options
| author | HampusM <hampus@hampusmat.com> | 2026-08-30 06:50:48 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-08-30 06:50:48 +0200 |
| commit | aab9155405ebead3eff92ffcfb262c825b29d106 (patch) | |
| tree | bd1009712910f0b859f8cfed5ee71a51f5b5dc70 /engine-ecs/src | |
| parent | 80d2cee1b457fc25c32fa780fb349c97889e0df1 (diff) | |
Diffstat (limited to 'engine-ecs/src')
| -rw-r--r-- | engine-ecs/src/lib.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/engine-ecs/src/lib.rs b/engine-ecs/src/lib.rs index b987f65..0d7df79 100644 --- a/engine-ecs/src/lib.rs +++ b/engine-ecs/src/lib.rs @@ -225,6 +225,15 @@ impl World where SoleT: Sole, { + if self + .data + .component_storage + .get_entity_archetype(SoleT::id()) + .is_some() + { + return Err(SoleAlreadyExistsError); + } + let name = sole.name(); self.create_ent( @@ -962,5 +971,5 @@ impl ActionQueue } #[derive(Debug, thiserror::Error)] -#[error("Sole {0} already exists")] -pub struct SoleAlreadyExistsError(pub &'static str); +#[error("Sole already exists")] +pub struct SoleAlreadyExistsError; |
