ACE3/addons/medical_damage/functions/fnc_woundReceived.sqf
pterolatypus 73a7dbdc1e
Medical - Rework wound handling (#8278)
- Add stackable wound handler system for easy 3rd party extensibility and overriding of default wound handler.
- Change mapping from wound type -> damage types, to damage type -> wound types. Improves the semantics and makes configuration easier to reason about.
- Allow damage types to influence wound properties (bleed, size, etc.) with configurable variance parameters.
- Allow configuration of wound type variance per damage type. Enabling more logically driven variance for sensible but still varied end results.
- Improve handling of non-selection-specific damage events. The wound handler now receives all incoming damages and may apply damage to multiple selections (previously only ever one) if the damage type is not configured to be selection specific (with new config property `selectionSpecific`).
- Add debug script for testing explosion damage events at varied ranges.
- Add custom fire wound handler.
2022-02-17 20:03:12 +00:00

36 lines
1.1 KiB
Plaintext

#include "script_component.hpp"
/*
* 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
*/
params ["_unit", "_allDamages", "_shooter", "_ammo"];
private _typeOfDamage = _ammo call FUNC(getTypeOfDamage);
if (_typeOfDamage in GVAR(damageTypeDetails)) then {
(GVAR(damageTypeDetails) get _typeOfDamage) params ["", "", "_woundHandlers"];
private _damageData = [_unit, _allDamages, _typeOfDamage];
{
_damageData = _damageData call _x;
TRACE_1("Wound handler returned", _damageData);
if !(_damageData isEqualType [] && {(count _damageData) >= 3}) exitWith {
TRACE_1("Return invalid, terminating wound handling", _damageData);
};
} forEach _woundHandlers;
};