summaryrefslogtreecommitdiff
path: root/engine-ecs/src/lib.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-08-03 14:28:41 +0200
committerHampusM <hampus@hampusmat.com>2026-08-03 17:03:02 +0200
commit7d578700747928fca0f0f1a4fae2c0cde0fe74f6 (patch)
tree1403ece3be1a44d56e6286b9da75d8d470280f9d /engine-ecs/src/lib.rs
parent22f2a5321162dc42d652949eda36cff63e3ebe64 (diff)
feat(engine-ecs): create component info ents for components from pairsHEADmaster
Diffstat (limited to 'engine-ecs/src/lib.rs')
-rw-r--r--engine-ecs/src/lib.rs36
1 files changed, 27 insertions, 9 deletions
diff --git a/engine-ecs/src/lib.rs b/engine-ecs/src/lib.rs
index 039661a..fcb9a8d 100644
--- a/engine-ecs/src/lib.rs
+++ b/engine-ecs/src/lib.rs
@@ -1,6 +1,6 @@
#![deny(clippy::all, clippy::pedantic)]
-use std::any::{Any, TypeId};
+use std::any::{Any, TypeId, type_name};
use std::borrow::Cow;
use std::fmt::Debug;
use std::hint::cold_path;
@@ -660,6 +660,26 @@ impl World
}
if comp_id.is_pair() {
+ if let Some(pair_relation_metadata) = &component_parts.pair_relation_metadata {
+ Self::create_component_info_entity_if_missing(
+ comp_id.relation(),
+ pair_relation_metadata.name,
+ pair_relation_metadata.ty,
+ pair_relation_metadata.ty_id,
+ component_storage,
+ );
+ }
+
+ if let Some(pair_target_metadata) = &component_parts.pair_target_metadata {
+ Self::create_component_info_entity_if_missing(
+ comp_id.target(),
+ pair_target_metadata.name,
+ pair_target_metadata.ty,
+ pair_target_metadata.ty_id,
+ component_storage,
+ );
+ }
+
continue;
}
@@ -702,12 +722,7 @@ impl World
}
}
- let ComponentParts {
- id: comp_info_id,
- name: comp_info_name,
- type_reflection: _,
- data: comp_info_data,
- } = ComponentInfo {
+ let comp_info_parts = ComponentInfo {
type_reflection,
name: comp_name,
ty_id: type_id,
@@ -715,9 +730,12 @@ impl World
.into_parts();
if let Err(err) = component_storage
- .add_entity_component(comp_id, (comp_info_id, comp_info_name, comp_info_data))
+ .add_entity_component(comp_id, (comp_info_parts.id, comp_info_parts.name, comp_info_parts.data))
{
- tracing::error!("Failed to add component {comp_info_name} to entity: {err}");
+ tracing::error!(
+ component = %type_name::<ComponentInfo>(),
+ "Failed to add component to entity: {err}"
+ );
}
}