Update GMS_fnc_processAIKill.sqf

Moved code to remove event handlers so that this is done for both legal and illegal kills.
This commit is contained in:
Ghostrider-DbD- 2017-06-04 09:30:45 -04:00 committed by GitHub
parent e7104cf0d1
commit 27e31c5f48

View File

@ -1,6 +1,6 @@
/*
Handle AI Deaths
Last Modified 3/23/17
Last Modified 5/31/17
By Ghostrider-DBD-
Copyright 2016
--------------------------
@ -17,14 +17,6 @@ params["_unit","_killer","_isLegal"];
_unit setVariable ["blck_cleanupAt", (diag_tickTime) + blck_bodyCleanUpTimer, true];
/*
if (vehicle _unit != _unit) then {
if (count crew (vehicle _unit) isEqualTo 0) then
{
[vehicle _unit] call blck_fnc_releaseVehicleToPlayers;
};
};*/
blck_deadAI pushback _unit;
_group = group _unit;
[_unit] joinSilent grpNull;
@ -35,11 +27,13 @@ if !(isPlayer _killer) exitWith {};
//[_unit,_killer] call blck_fnc_alertNearbyUnits;
[_unit,_killer] call blck_fnc_alertNearbyLeader;
_group = group _unit;
//_group setBehavior "COMBAT";
_wp = [_group, currentWaypoint _group];
_wp setWaypointBehaviour "COMBAT";
_group setCombatMode "RED";
_wp setWaypointCombatMode "RED";
{
_unit removeAllEventHandlers _x;
}forEach ["Killed","Fired","HandleDamage","HandleHeal","FiredNear","Hit"];
_isLegal = [_unit,_killer] call blck_fnc_processIlleagalAIKills;
@ -70,8 +64,6 @@ if (blck_useKillMessages) then
//diag_log format["[blck] unit killed message is %1",_message,""];
[["aikilled",_message,"victory"],playableUnits] call blck_fnc_messageplayers;
};
[_unit,_killer,_kills] call blck_fnc_rewardKiller;
{
_unit removeAllEventHandlers _x;
}forEach ["Killed","Fired","HandleDamage","HandleHeal","FiredNear","Hit"]
[_unit,_killer] call blck_fnc_rewardKiller;