summaryrefslogtreecommitdiff
path: root/ecs/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-09-13 15:18:34 +0200
committerHampusM <hampus@hampusmat.com>2025-09-13 15:18:34 +0200
commit68cd17ebb23a47ac9a022e7f303720ff5e28499f (patch)
tree2fac2506eb155409583517d9fadc0712c144cf48 /ecs/src
parent28f7ce3d4305d45293b371e1d66431a2e42053bf (diff)
feat(ecs): add entity::Handle::has_component fn
Diffstat (limited to 'ecs/src')
-rw-r--r--ecs/src/entity.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/ecs/src/entity.rs b/ecs/src/entity.rs
index ca867f9..16f881d 100644
--- a/ecs/src/entity.rs
+++ b/ecs/src/entity.rs
@@ -163,6 +163,14 @@ impl<'a> Handle<'a>
}
}
+ /// Returns whether or not this entity contains a component with the specified `Uid`.
+ #[must_use]
+ pub fn has_component(&self, component_uid: Uid) -> bool
+ {
+ self.archetype
+ .contains_component_with_exact_id(component_uid)
+ }
+
pub(crate) fn new(
archetype: &'a Archetype,
entity: &'a ArchetypeEntity,