Fix villagers seeing cultists and familiar enemies through objects.

This commit is contained in:
holychowders
2022-05-01 15:06:43 +00:00
committed by Isse
parent a22f035638
commit 914b44c714
4 changed files with 112 additions and 123 deletions

View File

@ -121,3 +121,8 @@ fn should_let_target_escape(
) -> f32 {
(dist_to_home_sqrd / own_health_fraction) * dur_since_last_attacked as f32 * 0.005
}
// FIXME: `Alignment::Npc` doesn't necessarily mean villager.
pub fn is_villager(alignment: Option<&Alignment>) -> bool {
alignment.map_or(false, |alignment| matches!(alignment, Alignment::Npc))
}