summaryrefslogtreecommitdiff
path: root/engine-ecs
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs')
-rw-r--r--engine-ecs/src/component.rs3
-rw-r--r--engine-ecs/src/lib.rs22
2 files changed, 14 insertions, 11 deletions
diff --git a/engine-ecs/src/component.rs b/engine-ecs/src/component.rs
index f881128..2734731 100644
--- a/engine-ecs/src/component.rs
+++ b/engine-ecs/src/component.rs
@@ -334,7 +334,8 @@ impl Default for PartsBuilder
}
#[derive(Debug, Clone, Component)]
-pub struct Type
+pub struct Info
{
pub type_reflection: &'static crate::reflection::Type,
+ pub name: &'static str,
}
diff --git a/engine-ecs/src/lib.rs b/engine-ecs/src/lib.rs
index 2e30bb8..1c157e3 100644
--- a/engine-ecs/src/lib.rs
+++ b/engine-ecs/src/lib.rs
@@ -15,10 +15,10 @@ use crate::component::storage::archetype::EntityComponent as ArchetypeEntityComp
use crate::component::storage::{EntityAlreadyExistsError, Storage as ComponentStorage};
use crate::component::{
Component,
+ Info as ComponentInfo,
IntoParts as IntoComponentParts,
Parts as ComponentParts,
Sequence as ComponentSequence,
- Type as ComponentType,
};
use crate::entity::{Declaration as EntityDeclaration, Handle as EntityHandle};
use crate::error::{
@@ -566,8 +566,9 @@ impl World
}
if let Some(type_reflection) = component_parts.type_reflection {
- Self::create_component_type_entity(
+ Self::create_component_info_entity(
comp_id,
+ comp_name,
type_reflection,
component_storage,
);
@@ -583,15 +584,16 @@ impl World
}
}
- fn create_component_type_entity(
+ fn create_component_info_entity(
comp_id: Uid,
+ comp_name: &'static str,
type_reflection: &'static TypeReflection,
component_storage: &mut ComponentStorage,
)
{
if let Some(comp_ent_archetype) = component_storage.get_entity_archetype(comp_id)
{
- if comp_ent_archetype.contains_component_with_exact_id(ComponentType::id()) {
+ if comp_ent_archetype.contains_component_with_exact_id(ComponentInfo::id()) {
return;
}
} else {
@@ -603,16 +605,16 @@ impl World
}
let ComponentParts {
- id: comp_type_id,
- name: comp_type_name,
+ id: comp_info_id,
+ name: comp_info_name,
type_reflection: _,
- data: comp_type_data,
- } = ComponentType { type_reflection }.into_parts();
+ data: comp_info_data,
+ } = ComponentInfo { type_reflection, name: comp_name }.into_parts();
if let Err(err) = component_storage
- .add_entity_component(comp_id, (comp_type_id, comp_type_name, comp_type_data))
+ .add_entity_component(comp_id, (comp_info_id, comp_info_name, comp_info_data))
{
- tracing::error!("Failed to add component {comp_type_name} to entity: {err}");
+ tracing::error!("Failed to add component {comp_info_name} to entity: {err}");
}
}