# HG changeset patch # User Adam Kaminski # Date 1638401906 18000 # Wed Dec 01 18:38:26 2021 -0500 # Node ID df3283988718347be977a8ba3e8badb471257432 # Parent 0f3542403c1565af49d3368a9f77a798bddccc36 Fixed actors with the NODAMAGE flag not entering their pain states if they also triggered a damage event script. diff -r 0f3542403c15 -r df3283988718 src/gamemode.cpp --- a/src/gamemode.cpp Wed Dec 01 17:56:12 2021 -0500 +++ b/src/gamemode.cpp Wed Dec 01 18:38:26 2021 -0500 @@ -1123,6 +1123,7 @@ return true; const GAMEEVENT_e DamageEvent = bBeforeArmor ? GAMEEVENT_ACTOR_ARMORDAMAGED : GAMEEVENT_ACTOR_DAMAGED; + const int originalDamage = damage; // [AK] We somehow need to pass all the actor pointers into the script itself. A simple way // to do this is temporarily spawn a temporary actor and change its actor pointers to the target, @@ -1141,7 +1142,8 @@ temp->Destroy( ); // [AK] If the new damage is zero, that means the target shouldn't take damage in P_DamageMobj. - return ( damage != 0 ); + // Allow P_DamageMobj to execute anyways if the original damage was zero (i.e. NODAMAGE flag). + return ( originalDamage == 0 || damage != 0 ); } //*****************************************************************************