From 07aa59a122cc5e14d2fb2e2c6e3d8f82e4397bde Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 14 Aug 2024 20:05:30 +0200 Subject: feat(ecs): add component added event --- ecs/src/actions.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'ecs/src/actions.rs') diff --git a/ecs/src/actions.rs b/ecs/src/actions.rs index 7698b45..32fcfb9 100644 --- a/ecs/src/actions.rs +++ b/ecs/src/actions.rs @@ -8,7 +8,6 @@ use crate::component::{ Sequence as ComponentSequence, }; use crate::entity::Uid as EntityUid; -use crate::lock::{Lock, WriteGuard}; use crate::system::{NoInitParamFlag, Param as SystemParam, System}; use crate::{ActionQueue, World}; @@ -16,8 +15,8 @@ use crate::{ActionQueue, World}; #[derive(Debug)] pub struct Actions<'world> { - action_queue: WriteGuard<'world, ActionQueue>, - action_queue_weak: Weak>, + action_queue: &'world ActionQueue, + action_queue_weak: Weak, } impl<'world> Actions<'world> @@ -64,12 +63,10 @@ impl<'world> Actions<'world> } } - fn new(action_queue: &'world Arc>) -> Self + fn new(action_queue: &'world Arc) -> Self { Self { - action_queue: action_queue - .write_nonblock() - .expect("Failed to aquire read-write action queue lock"), + action_queue: &*action_queue, action_queue_weak: Arc::downgrade(action_queue), } } @@ -111,7 +108,7 @@ unsafe impl<'world> SystemParam<'world> for Actions<'world> #[derive(Debug, Clone)] pub struct WeakRef { - action_queue: Weak>, + action_queue: Weak, } impl WeakRef @@ -134,7 +131,7 @@ impl WeakRef #[derive(Debug, Clone)] pub struct Ref<'weak_ref> { - action_queue: Arc>, + action_queue: Arc, _pd: PhantomData<&'weak_ref ()>, } -- cgit v1.2.3-18-g5258