From 68cd17ebb23a47ac9a022e7f303720ff5e28499f Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 13 Sep 2025 15:18:34 +0200 Subject: feat(ecs): add entity::Handle::has_component fn --- ecs/src/entity.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ecs/src') 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, -- cgit v1.2.3-18-g5258