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.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/engine-ecs/src/entity.rs b/engine-ecs/src/entity.rs
index 7515f73..e85c49c 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)
@@ -327,7 +334,7 @@ macro_rules! declare_entity {
world.spawn_with_uid(
*$ident,
($components).with_elem($crate::entity::Name {
- name: concat!(module_path!(), stringify!($ident)).into()
+ name: concat!(module_path!(), "::", stringify!($ident)).into()
})
);
});