forked from ocapmod/ocap-legacy
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
63 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,68 @@ | ||
#include "\ocap\script_macros.hpp" | ||
params ["_victim", "_killer", "_instigator"]; | ||
if (isNull _instigator) then {_instigator = UAVControl vehicle _killer select 0}; // UAV/UGV player operated road kill | ||
if (isNull _instigator) then {_instigator = _killer}; | ||
if ((isNull _instigator) || (_instigator == _victim)) then {_instigator = _victim getVariable ["ace_medical_lastDamageSource", _victim]}; | ||
if !(_victim getvariable ["ocapIsKilled",false]) then { | ||
_victim setvariable ["ocapIsKilled",true]; | ||
|
||
// [ocap_captureFrameNo, "killed", _victimId, ["null"], -1]; | ||
private _victimId = _victim getVariable ["ocap_id", -1]; | ||
if (_victimId == -1) exitWith {}; | ||
private _eventData = [ocap_captureFrameNo, "killed", _victimId, ["null"], -1]; | ||
[_victim, _killer, _instigator] spawn { | ||
params ["_victim", "_killer", "_instigator"]; | ||
private _frame = ocap_captureFrameNo; | ||
if (_killer == _victim) then { | ||
private _time = diag_tickTime; | ||
[_victim, { | ||
_this setVariable ["ace_medical_lastDamageSource", (_this getVariable "ace_medical_lastDamageSource"), 2]; | ||
}] remoteExec ["call", _victim]; | ||
waitUntil {diag_tickTime - _time > 10 || !(isNil {_victim getVariable "ace_medical_lastDamageSource"})}; | ||
_killer = _victim getVariable ["ace_medical_lastDamageSource", _killer]; | ||
} else { | ||
_killer | ||
}; | ||
if (isNull _instigator) then { | ||
_instigator = UAVControl vehicle _killer select 0 | ||
}; | ||
if ((isNull _instigator) || (_instigator == _victim)) then { | ||
_instigator = _killer | ||
}; | ||
if (_instigator isKindOf "AllVehicles") then { | ||
// _instigator = effectiveCommander _instigator | ||
_instigator = call { | ||
if(alive(gunner _instigator))exitWith{gunner _instigator}; | ||
if(alive(commander _instigator))exitWith{commander _instigator}; | ||
if(alive(driver _instigator))exitWith{driver _instigator}; | ||
effectiveCommander _instigator | ||
}; | ||
}; | ||
if (isNull _instigator) then { | ||
_instigator = _killer | ||
}; | ||
|
||
if (!isNull _instigator) then { | ||
_killerId = _instigator getVariable ["ocap_id", -1]; | ||
if (_killerId != -1) then { | ||
private _killerInfo = []; | ||
if (_instigator isKindOf "CAManBase") then { | ||
_killerInfo = [ | ||
_killerId, | ||
getText (configFile >> "CfgWeapons" >> currentWeapon _instigator >> "displayName") | ||
]; | ||
} else { | ||
_killerInfo = [_killerId]; | ||
}; | ||
// [ocap_captureFrameNo, "killed", _victimId, ["null"], -1]; | ||
private _victimId = _victim getVariable ["ocap_id", -1]; | ||
if (_victimId == -1) exitWith {}; | ||
private _eventData = [_frame, "killed", _victimId, ["null"], -1]; | ||
|
||
_eventData = [ | ||
ocap_captureFrameNo, | ||
"killed", | ||
_victimId, | ||
_killerInfo, | ||
round(_instigator distance _victim) | ||
]; | ||
}; | ||
}; | ||
if (!isNull _instigator) then { | ||
_killerId = _instigator getVariable ["ocap_id", -1]; | ||
if (_killerId != -1) then { | ||
private _killerInfo = []; | ||
if (_instigator isKindOf "CAManBase") then { | ||
_killerInfo = [ | ||
_killerId, | ||
getText (configFile >> "CfgWeapons" >> currentWeapon _instigator >> "displayName") | ||
]; | ||
} else { | ||
_killerInfo = [_killerId]; | ||
}; | ||
|
||
[":EVENT:", _eventData] call ocap_fnc_extension; | ||
_eventData = [ | ||
_frame, | ||
"killed", | ||
_victimId, | ||
_killerInfo, | ||
round(_instigator distance _victim) | ||
]; | ||
}; | ||
}; | ||
|
||
[":EVENT:", _eventData] call ocap_fnc_extension; | ||
}; | ||
|
||
}; |