summaryrefslogtreecommitdiff
path: root/ecs/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-09-13 15:16:01 +0200
committerHampusM <hampus@hampusmat.com>2025-09-13 15:16:01 +0200
commit28f7ce3d4305d45293b371e1d66431a2e42053bf (patch)
tree363905022898e5316c6c138cf8660ed1b02a1521 /ecs/src
parentcd4170beb5275fd3acac406a8bd2ee63c1809f9f (diff)
feat(ecs): add add_observer fn to extension::Collector
Diffstat (limited to 'ecs/src')
-rw-r--r--ecs/src/extension.rs10
1 files changed, 10 insertions, 0 deletions
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<Comps>(&mut self, components: Comps)
where