diff options
author | HampusM <hampus@hampusmat.com> | 2024-08-14 20:05:30 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-08-14 20:05:30 +0200 |
commit | 07aa59a122cc5e14d2fb2e2c6e3d8f82e4397bde (patch) | |
tree | 0ac63f5262d97d3d7f50ab1c72d1ace61935608c /ecs/src/extension.rs | |
parent | e9074af15cae7b3c354e524e9fa78cbddb20ff84 (diff) |
feat(ecs): add component added event
Diffstat (limited to 'ecs/src/extension.rs')
-rw-r--r-- | ecs/src/extension.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ecs/src/extension.rs b/ecs/src/extension.rs index fc5a345..99320cb 100644 --- a/ecs/src/extension.rs +++ b/ecs/src/extension.rs @@ -1,7 +1,9 @@ use crate::component::Sequence as ComponentSequence; -use crate::event::Event; +use crate::event::component::ComponentToAddedEvent; +use crate::event::{Event, Sequence as EventSequence}; use crate::sole::Sole; use crate::system::System; +use crate::tuple::Reduce as TupleReduce; use crate::{SoleAlreadyExistsError, World}; /// A collection of systems, entities & soles that can be added to a [`World`]. @@ -38,7 +40,8 @@ impl<'world> Collector<'world> /// Adds a entity to the [`World`]. pub fn add_entity<Comps>(&mut self, components: Comps) where - Comps: ComponentSequence, + Comps: ComponentSequence + TupleReduce<ComponentToAddedEvent>, + Comps::Out: EventSequence, { self.world.create_entity(components); } |