mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Kill Tracker - Add setting to show kills from vehicle to crew (#10069)
* Kill Tracker - Add setting to show kills from vehicle to crew * Update addons/killtracker/XEH_postInit.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --------- Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
This commit is contained in:
parent
f3722bf5e8
commit
c28a3d6cdf
@ -73,11 +73,11 @@ GVAR(killCount) = 0;
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
private _unitIsPlayer = hasInterface && {_unit in [player, ace_player]}; // isPlayer check will fail at this point
|
private _unitIsPlayer = hasInterface && {_unit in [player, ace_player]}; // isPlayer check will fail at this point
|
||||||
private _killerIsPlayer = (!isNull _instigator) && {_unit != _instigator} && {[_instigator] call EFUNC(common,isPlayer)};
|
private _instigatorIsPlayer = (!isNull _instigator) && {_unit != _instigator} && {[_instigator] call EFUNC(common,isPlayer)};
|
||||||
TRACE_2("",_unitIsPlayer,_killerIsPlayer);
|
TRACE_2("",_unitIsPlayer,_instigatorIsPlayer);
|
||||||
|
|
||||||
// Don't do anything if neither are players
|
// Don't do anything if neither are players
|
||||||
if (!(_unitIsPlayer || _killerIsPlayer)) exitWith {};
|
if (!(_unitIsPlayer || _instigatorIsPlayer)) exitWith {};
|
||||||
|
|
||||||
// Log firendly fire
|
// Log firendly fire
|
||||||
private _fnc_getSideFromConfig = {
|
private _fnc_getSideFromConfig = {
|
||||||
@ -110,23 +110,23 @@ GVAR(killCount) = 0;
|
|||||||
|
|
||||||
// If unit was player then send event to self
|
// If unit was player then send event to self
|
||||||
if (_unitIsPlayer) then {
|
if (_unitIsPlayer) then {
|
||||||
private _killerName = "Self?";
|
private _instigatorName = "Self?";
|
||||||
if ((!isNull _killer) && {_unit != _killer}) then {
|
if ((!isNull _instigator) && {_unit != _instigator}) then {
|
||||||
if (_killerIsPlayer) then {
|
if (_instigatorIsPlayer) then {
|
||||||
_killerName = [_killer, true, false] call EFUNC(common,getName);
|
_instigatorName = [_instigator, true, false] call EFUNC(common,getName);
|
||||||
} else {
|
} else {
|
||||||
_killerName = _killer getVariable [QGVAR(aiName), ""]; // allow setting a custom AI name (e.g. VIP Target)
|
_instigatorName = _instigator getVariable [QGVAR(aiName), ""]; // allow setting a custom AI name (e.g. VIP Target)
|
||||||
if (_killerName == "") then {
|
if (_instigatorName == "") then {
|
||||||
_killerName = format ["*AI* - %1", getText ((configOf _killer) >> "displayName")];
|
_instigatorName = format ["*AI* - %1", getText ((configOf _instigator) >> "displayName")];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
TRACE_3("send death event",_unit,_killerName,_killInfo);
|
TRACE_3("send death event",_unit,_instigatorName,_killInfo);
|
||||||
[QGVAR(death), [_killerName, _killInfo]] call CBA_fnc_localEvent;
|
[QGVAR(death), [_instigatorName, _killInfo]] call CBA_fnc_localEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
// If killer was player then send event to killer
|
// If shooter was player then send event to them (and optionally the whole crew)
|
||||||
if (_killerIsPlayer) then {
|
if (_instigatorIsPlayer && {_unitIsPlayer || GVAR(trackAI)}) then {
|
||||||
private _unitName = "";
|
private _unitName = "";
|
||||||
if (_unitIsPlayer) then {
|
if (_unitIsPlayer) then {
|
||||||
_unitName = [_unit, true, false] call EFUNC(common,getName); // should be same as profileName
|
_unitName = [_unit, true, false] call EFUNC(common,getName); // should be same as profileName
|
||||||
@ -136,9 +136,18 @@ GVAR(killCount) = 0;
|
|||||||
_unitName = format ["*AI* - %1", getText ((configOf _unit) >> "displayName")];
|
_unitName = format ["*AI* - %1", getText ((configOf _unit) >> "displayName")];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
if (_unitIsPlayer || GVAR(trackAI)) then {
|
TRACE_3("send kill event",_instigator,_unitName,_killInfo);
|
||||||
TRACE_3("send kill event",_killer,_unitName,_killInfo);
|
[QGVAR(kill), [_unitName, _killInfo], _instigator] call CBA_fnc_targetEvent;
|
||||||
[QGVAR(kill), [_unitName, _killInfo], _killer] call CBA_fnc_targetEvent;
|
|
||||||
|
if (GVAR(showCrewKills) && {!(_killer isKindOf "CAManBase")}) then {
|
||||||
|
private _crew = [driver _killer, gunner _killer, commander _killer] - [_instigator];
|
||||||
|
_crew = _crew select {[_x] call EFUNC(common,isPlayer)};
|
||||||
|
_crew = _crew arrayIntersect _crew;
|
||||||
|
TRACE_1("showCrewKills",_crew);
|
||||||
|
_killInfo = format [" - [<t color='#99ff99'>%1</t>, %2", localize "str_a3_rscdisplaygarage_tab_crew", _killInfo select [4]];
|
||||||
|
{
|
||||||
|
[QGVAR(kill), [_unitName, _killInfo], _x] call CBA_fnc_targetEvent;
|
||||||
|
} forEach _crew;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -6,3 +6,12 @@
|
|||||||
true,
|
true,
|
||||||
1
|
1
|
||||||
] call CBA_fnc_addSetting;
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(showCrewKills),
|
||||||
|
"CHECKBOX",
|
||||||
|
[LSTRING(showCrewKills_DisplayName), LSTRING(showCrewKills_Description)],
|
||||||
|
LSTRING(Category),
|
||||||
|
false,
|
||||||
|
1
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
@ -119,5 +119,11 @@
|
|||||||
<German>Legt fest, ob getötete KIs während des Endbildschirms der Mission in den Abschüssen angezeigt werden.</German>
|
<German>Legt fest, ob getötete KIs während des Endbildschirms der Mission in den Abschüssen angezeigt werden.</German>
|
||||||
<Spanish>Define si las IAs matadas se mostrarán en el contador de muertes en el debiefring de la misión.</Spanish>
|
<Spanish>Define si las IAs matadas se mostrarán en el contador de muertes en el debiefring de la misión.</Spanish>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_KillTracker_showCrewKills_DisplayName">
|
||||||
|
<English>Show vehicle kills to other crew members</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_KillTracker_showCrewKills_Description">
|
||||||
|
<English>Show kills from a vehicle to driver, gunner and commander</English>
|
||||||
|
</Key>
|
||||||
</Package>
|
</Package>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -25,6 +25,7 @@ if (isNull _unit || {!isNil {_unit getVariable QEGVAR(medical,causeOfDeath)}}) e
|
|||||||
TRACE_4("enteredStateDeath",_this,_thisOrigin,_thisTransition,CBA_missionTime);
|
TRACE_4("enteredStateDeath",_this,_thisOrigin,_thisTransition,CBA_missionTime);
|
||||||
|
|
||||||
private _causeOfDeath = format ["%1:%2", _thisOrigin, _thisTransition];
|
private _causeOfDeath = format ["%1:%2", _thisOrigin, _thisTransition];
|
||||||
|
private _source = _unit getVariable [QEGVAR(medical,lastDamageSource), objNull];
|
||||||
private _instigator = _unit getVariable [QEGVAR(medical,lastInstigator), objNull];
|
private _instigator = _unit getVariable [QEGVAR(medical,lastInstigator), objNull];
|
||||||
|
|
||||||
[_unit, _causeOfDeath, _instigator] call EFUNC(medical_status,setDead);
|
[_unit, _causeOfDeath, _source, _instigator] call EFUNC(medical_status,setDead);
|
||||||
|
Loading…
Reference in New Issue
Block a user