diff options
author | tom barrett <spalf0@gmail.com> | 2019-08-27 03:33:50 -0500 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2019-08-27 03:33:50 -0500 |
commit | 0f85752b1657e7b8024fb2715578712295979b3a (patch) | |
tree | d336db48ae288d08f23f89a56d01b9fa097c3a52 /src/npc.rs | |
parent | ebf13bcd8e8ab799c56961e6bc1779bd8031a8dc (diff) |
cargo update and dialogbox now disappears and npc resumes wandering
Diffstat (limited to 'src/npc.rs')
-rw-r--r-- | src/npc.rs | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -116,6 +116,17 @@ impl NPC { self.dialogtree.clone() } + pub fn is_talking(&self) -> bool { + self.behavior == Behavior::Talking + } + + pub fn stop_talking(&mut self) { + self.behavior = Behavior::Wandering(random_nearby_point( + self.entity.spawn, + constants::WANDER_DISTANCE, + )); + } + pub fn build_npcs(context: &mut Context, tileset: &Tileset, map: &Map) -> Vec<NPC> { let mut npcs = Vec::new(); @@ -134,7 +145,7 @@ impl NPC { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] enum Behavior { Talking, Waiting(Instant), |