summaryrefslogtreecommitdiff
path: root/engine-ecs/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs/src/lib.rs')
-rw-r--r--engine-ecs/src/lib.rs36
1 files changed, 14 insertions, 22 deletions
diff --git a/engine-ecs/src/lib.rs b/engine-ecs/src/lib.rs
index 7965bcd..397605c 100644
--- a/engine-ecs/src/lib.rs
+++ b/engine-ecs/src/lib.rs
@@ -246,13 +246,11 @@ impl World
return Err(SoleAlreadyExistsError);
}
- let name = sole.name();
-
self.create_ent(
SoleT::id(),
[
sole.into_parts(),
- EntityName { name: name.into() }.into_parts(),
+ EntityName { name: SoleT::name() }.into_parts(),
crate::sole::Is.into_parts(),
],
&ComponentAddingFlags { allow_soles: true },
@@ -626,13 +624,13 @@ impl World
self.data.component_storage.create_entity(sole_parts.id)
{
tracing::error!(
- name = sole_parts.name,
+ name = %sole_parts.name,
"Can not create sole that already exists"
);
continue;
}
- let name = sole_parts.name;
+ let name = sole_parts.name.clone();
Self::add_entity_components(
sole_parts.id,
@@ -674,10 +672,9 @@ impl World
let comp_name = component_parts.name;
let comp_type_id = (*component_parts.data).type_id();
- if let Err(err) = component_storage.add_entity_component(
- entity_uid,
- (comp_id, comp_name, component_parts.data),
- ) {
+ if let Err(err) = component_storage
+ .add_entity_component(entity_uid, (comp_id, component_parts.data))
+ {
let ent_name = Self::get_component_of_entity::<EntityName>(
component_storage,
entity_uid,
@@ -687,7 +684,7 @@ impl World
entity = %entity_uid,
entity_name = ent_name.as_ref().map(|ent_name| ent_name.name.as_ref()),
component = %comp_id,
- component_name = comp_name,
+ component_name = %comp_name,
"Failed to add component to entity: {err}"
);
@@ -696,7 +693,7 @@ impl World
if comp_id.is_pair() {
if let Some(pair_relation_metadata) =
- &component_parts.pair_relation_metadata
+ component_parts.pair_relation_metadata
{
Self::create_component_info_entity_if_missing(
component_storage,
@@ -710,8 +707,7 @@ impl World
);
}
- if let Some(pair_target_metadata) = &component_parts.pair_target_metadata
- {
+ if let Some(pair_target_metadata) = component_parts.pair_target_metadata {
Self::create_component_info_entity_if_missing(
component_storage,
comp_id.target(),
@@ -767,14 +763,9 @@ impl World
let comp_info_parts = comp_info.into_parts();
- match component_storage.add_entity_component(
- comp_id,
- (
- comp_info_parts.id,
- comp_info_parts.name,
- comp_info_parts.data,
- ),
- ) {
+ match component_storage
+ .add_entity_component(comp_id, (comp_info_parts.id, comp_info_parts.data))
+ {
Ok(()) => {}
Err(ComponentStorageError::EntityDoesNotExist(_)) => {
// Entity is created if it does not exist
@@ -819,7 +810,8 @@ impl World
component = %component_id,
component_name = component_info
.as_ref()
- .map(|component_info| component_info.name),
+ .map(|comp_info| comp_info.name.as_ref())
+ .map(tracing::field::display),
"Failed to remove component from entity: {err}"
);
}