summaryrefslogtreecommitdiff
path: root/ecs/src/component.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-08-16 20:13:22 +0200
committerHampusM <hampus@hampusmat.com>2024-08-16 20:13:22 +0200
commit7d218b2525f90dfedcae02f3b3d0d2f7b9c99bd2 (patch)
treebc9523b82d138a7048ff583dd75e0a8c26fe5e6b /ecs/src/component.rs
parent0f7811f3cba24c8a5927d5bcdfb30dd94de87102 (diff)
feat(ecs): make relationships creatable without reference to world
Diffstat (limited to 'ecs/src/component.rs')
-rw-r--r--ecs/src/component.rs7
1 files changed, 5 insertions, 2 deletions
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<Item = &'component EntityComponent>,
+ world: &'component World,
) -> Self::Refs<'component>;
}
@@ -203,6 +204,7 @@ pub trait FromOptional<'comp>
{
fn from_optional_component(
optional_component: Option<WriteGuard<'comp, Box<dyn Component>>>,
+ world: &'comp World,
) -> Self;
}
@@ -235,6 +237,7 @@ macro_rules! inner {
fn from_components<'component>(
components: impl Iterator<Item = &'component EntityComponent>,
+ 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),
)*)
}
}