diff options
Diffstat (limited to 'ecs/src/component/storage')
| -rw-r--r-- | ecs/src/component/storage/archetype.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ecs/src/component/storage/archetype.rs b/ecs/src/component/storage/archetype.rs index d96632e..a7fe7ed 100644 --- a/ecs/src/component/storage/archetype.rs +++ b/ecs/src/component/storage/archetype.rs @@ -287,13 +287,17 @@ impl Entity &self.components } - pub fn remove_component(&mut self, component_id: Uid, archetype: &Archetype) + pub fn remove_component( + &mut self, + component_id: Uid, + archetype: &Archetype, + ) -> EntityComponent { let index = archetype .get_index_for_component(component_id) .expect("Archetype should contain component"); - self.components.remove(index); + self.components.remove(index) } pub fn insert_component( @@ -315,6 +319,7 @@ impl Entity pub struct EntityComponent { component: Lock<Box<dyn Any>>, + name: &'static str, } impl EntityComponent @@ -323,6 +328,7 @@ impl EntityComponent { Self { component: Lock::new(component, component_name), + name: component_name, } } @@ -330,6 +336,11 @@ impl EntityComponent { &self.component } + + pub fn name(&self) -> &str + { + self.name + } } /// Archetype ID. |
