diff options
| -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; |
