From 28f7ce3d4305d45293b371e1d66431a2e42053bf Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 13 Sep 2025 15:16:01 +0200 Subject: feat(ecs): add add_observer fn to extension::Collector --- ecs/src/extension.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ecs/src') diff --git a/ecs/src/extension.rs b/ecs/src/extension.rs index e180ac7..9c6614b 100644 --- a/ecs/src/extension.rs +++ b/ecs/src/extension.rs @@ -1,6 +1,7 @@ use crate::component::Sequence as ComponentSequence; use crate::entity::Declaration as EntityDeclaration; use crate::sole::Sole; +use crate::system::observer::Observer; use crate::system::System; use crate::uid::Uid; use crate::{SoleAlreadyExistsError, World}; @@ -35,6 +36,15 @@ impl<'world> Collector<'world> self.world.register_system(phase_euid, system); } + /// Adds a observer system to the [`World`]. + pub fn add_observer<'this, SystemImpl>( + &'this mut self, + observer: impl Observer<'this, SystemImpl>, + ) + { + self.world.register_observer(observer); + } + /// Adds a entity to the [`World`]. pub fn add_entity(&mut self, components: Comps) where -- cgit v1.2.3-18-g5258