From 7d218b2525f90dfedcae02f3b3d0d2f7b9c99bd2 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 16 Aug 2024 20:13:22 +0200 Subject: feat(ecs): make relationships creatable without reference to world --- ecs/src/component.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ecs/src/component.rs') diff --git a/ecs/src/component.rs b/ecs/src/component.rs index 67ae453..5b1e7f5 100644 --- a/ecs/src/component.rs +++ b/ecs/src/component.rs @@ -6,7 +6,7 @@ use seq_macro::seq; use crate::lock::WriteGuard; use crate::system::{ComponentRefMut, Input as SystemInput}; use crate::type_name::TypeName; -use crate::EntityComponent; +use crate::{EntityComponent, World}; pub mod local; @@ -143,6 +143,7 @@ pub trait Sequence fn from_components<'component>( components: impl Iterator, + world: &'component World, ) -> Self::Refs<'component>; } @@ -203,6 +204,7 @@ pub trait FromOptional<'comp> { fn from_optional_component( optional_component: Option>>, + world: &'comp World, ) -> Self; } @@ -235,6 +237,7 @@ macro_rules! inner { fn from_components<'component>( components: impl Iterator, + world: &'component World, ) -> Self::Refs<'component> { #( @@ -251,7 +254,7 @@ macro_rules! inner { } (#( - Comp~I::RefMut::from_optional_component(comp_~I), + Comp~I::RefMut::from_optional_component(comp_~I, world), )*) } } -- cgit v1.2.3-18-g5258