@@ -7864,10 +7864,12 @@ void ship_destroy_instantly(object *ship_objp, bool with_debris)
78647864 Assert(ship_objp->type == OBJ_SHIP);
78657865 Assert(!(ship_objp == Player_obj));
78667866
7867- // add scripting hook for 'On Ship Death Started' -- Goober5000
7868- // hook is placed at the beginning of this function to allow the scripter to
7869- // actually have access to the ship before any death routines (such as mission logging) are executed
7870- OnShipDeathStartedHook->run(scripting::hook_param_list(scripting::hook_param("Ship", 'o', ship_objp)));
7867+ if (OnShipDeathStartedHook->isActive()) {
7868+ // add scripting hook for 'On Ship Death Started' -- Goober5000
7869+ // hook is placed at the beginning of this function to allow the scripter to
7870+ // actually have access to the ship before any death routines (such as mission logging) are executed
7871+ OnShipDeathStartedHook->run(scripting::hook_param_list(scripting::hook_param("Ship", 'o', ship_objp)));
7872+ }
78717873
78727874 // undocking and death preparation
78737875 ship_stop_fire_primary(ship_objp);
@@ -10990,10 +10992,12 @@ int ship_launch_countermeasure(object *objp, int rand_val)
1099010992 send_NEW_countermeasure_fired_packet(objp, cmeasure_count, Objects[cobjnum].net_signature);
1099110993 }
1099210994
10993- // add scripting hook for 'On Countermeasure Fire' --wookieejedi
10994- OnCountermeasureFireHook->run(scripting::hook_param_list(scripting::hook_param("Ship", 'o', objp),
10995- scripting::hook_param("CountermeasuresLeft", 'i', shipp->cmeasure_count),
10996- scripting::hook_param("Countermeasure", 'o', &Objects[cobjnum])));
10995+ if (OnCountermeasureFireHook->isActive()) {
10996+ // add scripting hook for 'On Countermeasure Fire' --wookieejedi
10997+ OnCountermeasureFireHook->run(scripting::hook_param_list(scripting::hook_param("Ship", 'o', objp),
10998+ scripting::hook_param("CountermeasuresLeft", 'i', shipp->cmeasure_count),
10999+ scripting::hook_param("Countermeasure", 'o', &Objects[cobjnum])));
11000+ }
1099711001 }
1099811002
1099911003 return (cobjnum >= 0); // return 0 if not fired, 1 otherwise
0 commit comments