summaryrefslogtreecommitdiff
path: root/engine-ecs/src/entity.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs/src/entity.rs')
-rw-r--r--engine-ecs/src/entity.rs9
1 files changed, 8 insertions, 1 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)