From 01066718b0f13846587d26b1869f03e3713082c6 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 12 Mar 2024 20:54:42 +0100 Subject: feat(ecs): make components internally mutable --- ecs/src/actions.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ecs/src/actions.rs') diff --git a/ecs/src/actions.rs b/ecs/src/actions.rs index d67f895..edfee55 100644 --- a/ecs/src/actions.rs +++ b/ecs/src/actions.rs @@ -9,7 +9,7 @@ use crate::WorldData; #[derive(Debug)] pub struct Actions<'world> { - world_data: &'world mut WorldData, + world_data: &'world WorldData, } impl<'world> Actions<'world> @@ -19,6 +19,7 @@ impl<'world> Actions<'world> { self.world_data .action_queue + .borrow_mut() .push(Action::Spawn(components.into_vec())); } } @@ -28,13 +29,16 @@ unsafe impl<'world> SystemParam<'world> for Actions<'world> type Flags = NoInitParamFlag; type Input = TupleFilterExclude; - fn initialize(_system: &mut impl System, _input: Self::Input) + fn initialize( + _system: &mut impl System<'world, SystemImpl>, + _input: Self::Input, + ) { } fn new( - _system: &'world mut impl System, - world_data: &'world mut WorldData, + _system: &'world impl System<'world, SystemImpl>, + world_data: &'world WorldData, ) -> Self { Self { world_data } -- cgit v1.2.3-18-g5258