summaryrefslogtreecommitdiff
path: root/ecs/src/pair.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-08-26 16:43:40 +0200
committerHampusM <hampus@hampusmat.com>2025-09-11 18:24:48 +0200
commit09981e0173a2427264e432226804292c91e1f920 (patch)
tree70112b6cda98a55da625ec9f6762927f00affe91 /ecs/src/pair.rs
parentce1bade2c21cc3129fa8bc2b4bc67bc4dc2c25c3 (diff)
feat(ecs): add component changed event
Diffstat (limited to 'ecs/src/pair.rs')
-rw-r--r--ecs/src/pair.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/ecs/src/pair.rs b/ecs/src/pair.rs
index 7b5f54a..553652e 100644
--- a/ecs/src/pair.rs
+++ b/ecs/src/pair.rs
@@ -133,7 +133,7 @@ where
fn get_field<'world>(
entity_handle: &EntityHandle<'world>,
- _world: &'world World,
+ world: &'world World,
) -> Self::Field<'world>
{
let target_component = entity_handle
@@ -141,12 +141,14 @@ where
.next()
.expect("Not possible");
- Self::Field::from_entity_component_ref(&target_component).unwrap_or_else(|err| {
- panic!(
- "Creating handle to target component {} failed: {err}",
- type_name::<Target>()
- );
- })
+ Self::Field::from_entity_component_ref(&target_component, world).unwrap_or_else(
+ |err| {
+ panic!(
+ "Creating handle to target component {} failed: {err}",
+ type_name::<Target>()
+ );
+ },
+ )
}
}
@@ -271,7 +273,7 @@ impl WildcardTargetHandle<'_>
unreachable!();
};
- Some(EntityHandle::new(archetype, archetype_entity))
+ Some(EntityHandle::new(archetype, archetype_entity, self.world))
}
/// Attempts to retrieve the target as a component, returning `None` if the component
@@ -317,6 +319,7 @@ impl WildcardTargetHandle<'_>
{
ComponentHandleMut::<ComponentData>::from_entity_component_ref(
&self.component_ref,
+ self.world,
)
.map_or_else(
|err| match err {