diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-11-15 11:48:27 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-11-15 11:48:27 -0500 |
| commit | ab20683e387d5ef09d52d1647492e819bf93380b (patch) | |
| tree | 420c0eb27f7c56167291d3e57a61f790d21d4d01 /dungeon/src/entity.rs | |
| parent | dungeon: randomize floor brick accents (diff) | |
| download | DungeonCrawl-ab20683e387d5ef09d52d1647492e819bf93380b.tar.gz DungeonCrawl-ab20683e387d5ef09d52d1647492e819bf93380b.tar.bz2 DungeonCrawl-ab20683e387d5ef09d52d1647492e819bf93380b.zip | |
graphics: add astar paths to debug rendering
Diffstat (limited to 'dungeon/src/entity.rs')
| -rw-r--r-- | dungeon/src/entity.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/dungeon/src/entity.rs b/dungeon/src/entity.rs index 6ed46cc..7c16418 100644 --- a/dungeon/src/entity.rs +++ b/dungeon/src/entity.rs @@ -125,6 +125,15 @@ impl EnemyMoveState { } } } + + /// Returns an optional reference to the current path this entity is moving + pub const fn moves(&self) -> Option<&[Pos]> { + match self { + Self::Idle(_) => None, + Self::Roam(moves) => Some(moves.as_slice()), + Self::Attack(moves, _) => Some(moves.as_slice()), + } + } } impl Default for EnemyMoveState { fn default() -> Self { @@ -229,6 +238,14 @@ impl Entity { self.fpos = FPos::from_pos(pos); self.moving_to = None; } + + /// Returns a reference to this entities current AI + pub const fn get_ai(&self) -> Option<&EnemyMoveState> { + match &self.kind { + EntityKind::Zombie(ai) => Some(ai), + _ => None, + } + } } /// The `Player` type represents the main player entity |