summaryrefslogtreecommitdiff
path: root/engine-ecs/src
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs/src')
-rw-r--r--engine-ecs/src/entity.rs9
-rw-r--r--engine-ecs/src/phase.rs3
2 files changed, 9 insertions, 3 deletions
diff --git a/engine-ecs/src/entity.rs b/engine-ecs/src/entity.rs
index 7515f73..4d472ad 100644
--- a/engine-ecs/src/entity.rs
+++ b/engine-ecs/src/entity.rs
@@ -232,9 +232,16 @@ impl<'a> Handle<'a>
}
}
+ /// Returns whether or not this entity contains the specified component.
+ #[must_use]
+ pub fn has_component<ComponentT: Component>(&self) -> bool
+ {
+ self.has_component_by_id(ComponentT::id())
+ }
+
/// Returns whether or not this entity contains a component with the specified `Uid`.
#[must_use]
- pub fn has_component(&self, component_uid: Uid) -> bool
+ pub fn has_component_by_id(&self, component_uid: Uid) -> bool
{
self.archetype
.contains_component_with_exact_id(component_uid)
diff --git a/engine-ecs/src/phase.rs b/engine-ecs/src/phase.rs
index e5008ad..8d09ab4 100644
--- a/engine-ecs/src/phase.rs
+++ b/engine-ecs/src/phase.rs
@@ -1,4 +1,3 @@
-use crate::component::WithAssociatedId as _;
use crate::{declare_entity, Component, World};
#[cfg(debug_assertions)]
use crate::{
@@ -57,7 +56,7 @@ pub(crate) fn check_parents(
continue;
};
- if !parent_ent.has_component(Phase::id()) {
+ if !parent_ent.has_component::<Phase>() {
let parent_ent_name = parent_ent.get::<EntityName>();
tracing::warn!(