From 6d99395b6883d09009f800939f234c5116aa1a21 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Wed, 13 Mar 2024 13:10:10 -0500 Subject: [PATCH] - Fixed: Fear checks were incorrect when accounting for player being present or not. --- src/playsim/p_enemy.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/playsim/p_enemy.cpp b/src/playsim/p_enemy.cpp index 722b5c602..ffc40197f 100644 --- a/src/playsim/p_enemy.cpp +++ b/src/playsim/p_enemy.cpp @@ -2245,14 +2245,18 @@ bool AActor::CanPathfind() return true; // Can't pathfind while feared. - if (!(flags4 & MF4_FRIGHTENED)) - { - if (!target) - return true; + if (flags4 & MF4_FRIGHTENED) + return false; - if (!target->flags8 & MF8_FRIGHTENING) - return (!target->player || !(target->player->cheats & CF_FRIGHTENING)); + if (target) + { + if (target->flags8 & MF8_FRIGHTENING) + return false; + + if (target->player && target->player->cheats & CF_FRIGHTENING) + return false; } + return true; } return false; }