diff --git a/ecs/src/updates.rs b/ecs/src/updates.rs index 2190d0a..f77f29a 100644 --- a/ecs/src/updates.rs +++ b/ecs/src/updates.rs @@ -292,4 +292,4 @@ impl_update_filter!(Nonuple, [R, r], [S, s], [T, t], [U, u], [V, v], [W, w], #[rustfmt::skip] impl_update_filter!(Decuple, [R, r], [S, s], [T, t], [U, u], [V, v], [W, w], [X, x], [Y, y], [Z, z], [A, a]); -implement_updates!(5, 6); +implement_updates!(2, 2); diff --git a/ecs/src/world.rs b/ecs/src/world.rs index 20c819f..5d322a7 100644 --- a/ecs/src/world.rs +++ b/ecs/src/world.rs @@ -10,7 +10,7 @@ use utilities::prelude::{remove_life_time, remove_life_time_mut}; use crate::{entity_object_manager::EntityObjectManager, *}; -pub trait AddSystem { +pub trait AddSystem { fn add_system(&mut self, priority: u32, f: Func); } diff --git a/update_macros/src/update.rs b/update_macros/src/update.rs index e842024..cdfc00a 100644 --- a/update_macros/src/update.rs +++ b/update_macros/src/update.rs @@ -351,7 +351,7 @@ impl Update { } } - impl AddSystem<#resource_types, Func> for WorldBuilder + impl AddSystem<#resource_types, Func, ()> for WorldBuilder where Func: Fn(&mut Commands, #resources ) -> Result + Send + Sync + 'static, #reource_requirement @@ -365,7 +365,20 @@ impl Update { } } - + impl AddSystem<#resource_types, Func, World> for WorldBuilder + where + Func: Fn(&World, &mut Commands, #resources ) -> Result + Send + Sync + 'static, + #reource_requirement + { + fn add_system(&mut self, priority: u32, func: Func) { + self.systems.push((priority, Box::new(move |world: &mut World, commands: &mut Commands| { + let w = unsafe { utilities::unsafe_life_time::remove_life_time(world) }; + #resource_store + func(w, commands, #( #resource_idents, )*) + }))); + self.systems.sort_by_key(|(priority, _)| *priority); + } + } } } }