# HG changeset patch # User Adam Kaminski # Date 1631454441 14400 # Sun Sep 12 09:47:21 2021 -0400 # Node ID 644fe66707197d3e85686096ed64e28c5950d24a # Parent ddfb188192b0990f985afe1804728c389c53101b Allow GAMEEVENT_ACTOR_SPAWNED and GAMEEVENT_ACTOR_DAMAGED scripts to be executed immediately when they're triggered. diff -r ddfb188192b0 -r 644fe6670719 src/gamemode.cpp --- a/src/gamemode.cpp Sun Sep 12 02:06:34 2021 -0400 +++ b/src/gamemode.cpp Sun Sep 12 09:47:21 2021 -0400 @@ -1032,11 +1032,17 @@ if ( NETWORK_InClientMode() ) return; + // [AK] Allow events that are triggered by an actor spawning or + // taking damage to be executed immediately, in case any of the + // actor pointers that were responsible for calling the event + // become NULL after one tic. + bool bRunNow = ( Event == GAMEEVENT_ACTOR_SPAWNED || Event == GAMEEVENT_ACTOR_DAMAGED ); + // [BB] The activator of the event activates the event script. // The first argument is the type, e.g. GAMEEVENT_PLAYERFRAGS, // the second and third are specific to the event, e.g. the second is the number of the fragged player. // The third argument will be zero if it isn't used in the script. - FBehavior::StaticStartTypedScripts( SCRIPT_Event, pActivator, true, Event, false, false, DataOne, DataTwo ); + FBehavior::StaticStartTypedScripts( SCRIPT_Event, pActivator, true, Event, bRunNow, false, DataOne, DataTwo ); } //*****************************************************************************