diff options
author | HampusM <hampus@hampusmat.com> | 2025-09-13 15:19:09 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2025-09-13 15:19:09 +0200 |
commit | 1bf48462393099d971b7a8613bd945d863d97273 (patch) | |
tree | a5b961a6fa978ccc8e0fc72a291c935ec9bc5b54 /ecs/src/entity/obtainer.rs | |
parent | 68cd17ebb23a47ac9a022e7f303720ff5e28499f (diff) |
Diffstat (limited to 'ecs/src/entity/obtainer.rs')
-rw-r--r-- | ecs/src/entity/obtainer.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ecs/src/entity/obtainer.rs b/ecs/src/entity/obtainer.rs new file mode 100644 index 0000000..6c2ea96 --- /dev/null +++ b/ecs/src/entity/obtainer.rs @@ -0,0 +1,29 @@ +use crate::entity::Handle as EntityHandle; +use crate::system::{Metadata as SystemMetadata, Param as SystemParam}; +use crate::uid::Uid; +use crate::World; + +#[derive(Debug)] +pub struct Obtainer<'world> +{ + world: &'world World, +} + +impl<'world> SystemParam<'world> for Obtainer<'world> +{ + type Input = (); + + fn new(world: &'world World, _system_metadata: &SystemMetadata) -> Self + { + Self { world } + } +} + +impl Obtainer<'_> +{ + #[must_use] + pub fn get_entity(&self, entity_id: Uid) -> Option<EntityHandle<'_>> + { + self.world.get_entity(entity_id) + } +} |