summaryrefslogtreecommitdiff
path: root/dungeon
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-11-15 11:48:27 -0500
committerFreya Murphy <freya@freyacat.org>2025-11-15 11:48:27 -0500
commitab20683e387d5ef09d52d1647492e819bf93380b (patch)
tree420c0eb27f7c56167291d3e57a61f790d21d4d01 /dungeon
parentdungeon: randomize floor brick accents (diff)
downloadDungeonCrawl-ab20683e387d5ef09d52d1647492e819bf93380b.tar.gz
DungeonCrawl-ab20683e387d5ef09d52d1647492e819bf93380b.tar.bz2
DungeonCrawl-ab20683e387d5ef09d52d1647492e819bf93380b.zip
graphics: add astar paths to debug rendering
Diffstat (limited to 'dungeon')
-rw-r--r--dungeon/src/entity.rs17
-rw-r--r--dungeon/src/msg.rs1
2 files changed, 18 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
diff --git a/dungeon/src/msg.rs b/dungeon/src/msg.rs
index 68a6cbd..032a201 100644
--- a/dungeon/src/msg.rs
+++ b/dungeon/src/msg.rs
@@ -48,6 +48,7 @@ impl Message {
if self.waiting && !input.interact {
return false;
}
+ self.waiting = false;
if self.last.elapsed() < DURATION_PER {
return false;