2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2022-02-17 20:03:12 +00:00
|
|
|
/*
|
|
|
|
* Author: Pterolatypus
|
|
|
|
* Handle woundReceived event and pass to individual wound handlers
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit That Was Hit <OBJECT>
|
|
|
|
* 1: Damage done to each body part <ARRAY>
|
|
|
|
* 2: Shooter <OBJECT>
|
|
|
|
* 3: Ammo classname or damage type <STRING>
|
|
|
|
*
|
|
|
|
* ReturnValue:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [_target, [[0.5, "LeftLeg", 1]], _shooter, "B_65x39_Caseless"] call ace_medical_damage_fnc_woundReceived
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2024-08-11 23:28:51 +00:00
|
|
|
|
2022-02-17 20:03:12 +00:00
|
|
|
params ["_unit", "_allDamages", "_shooter", "_ammo"];
|
|
|
|
|
|
|
|
private _typeOfDamage = _ammo call FUNC(getTypeOfDamage);
|
2024-08-11 23:28:51 +00:00
|
|
|
|
2022-02-17 20:03:12 +00:00
|
|
|
if (_typeOfDamage in GVAR(damageTypeDetails)) then {
|
|
|
|
(GVAR(damageTypeDetails) get _typeOfDamage) params ["", "", "_woundHandlers"];
|
2024-02-05 17:04:24 +00:00
|
|
|
|
2022-02-17 20:03:12 +00:00
|
|
|
private _damageData = [_unit, _allDamages, _typeOfDamage];
|
2024-08-11 23:28:51 +00:00
|
|
|
|
2022-02-17 20:03:12 +00:00
|
|
|
{
|
|
|
|
_damageData = _damageData call _x;
|
2024-02-05 17:04:24 +00:00
|
|
|
TRACE_1("Wound handler returned",_damageData);
|
2024-08-11 23:28:51 +00:00
|
|
|
|
|
|
|
// If invalid return, exit
|
|
|
|
if (isNil "_damageData" || {!(_damageData isEqualType [])} || {(count _damageData) < 3}) exitWith {
|
|
|
|
TRACE_1("Return invalid, skipping wound handling",_damageData);
|
2022-02-17 20:03:12 +00:00
|
|
|
};
|
|
|
|
} forEach _woundHandlers;
|
|
|
|
};
|