From f3f7f2c492fb32dac12f6833041c7586587b2088 Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Sat, 6 Apr 2024 19:18:07 -0600 Subject: [PATCH] Medical Status - API to modify getBloodLoss (#9926) Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- addons/medical_status/functions/fnc_getBloodLoss.sqf | 8 +++++++- docs/wiki/framework/events-framework.md | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/addons/medical_status/functions/fnc_getBloodLoss.sqf b/addons/medical_status/functions/fnc_getBloodLoss.sqf index fd02f9042b..c2a6604679 100644 --- a/addons/medical_status/functions/fnc_getBloodLoss.sqf +++ b/addons/medical_status/functions/fnc_getBloodLoss.sqf @@ -23,4 +23,10 @@ if (_woundBleeding == 0) exitWith {0}; private _cardiacOutput = [_unit] call FUNC(getCardiacOutput); // even if heart stops blood will still flow slowly (gravity) -(_woundBleeding * (_cardiacOutput max CARDIAC_OUTPUT_MIN) * EGVAR(medical,bleedingCoefficient)) +private _bloodLoss = (_woundBleeding * (_cardiacOutput max CARDIAC_OUTPUT_MIN) * EGVAR(medical,bleedingCoefficient)); + +private _eventArgs = [_unit, _bloodLoss]; // Pass by reference + +[QGVAR(getBloodLoss), _eventArgs] call CBA_fnc_localEvent; + +_eventArgs select 1 // return diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index 37daa148fc..8a50912e02 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -146,7 +146,13 @@ MenuType: 0 = Interaction, 1 = Self Interaction |---------- |------------|----------|------|-------------| | `ace_medical_treatment_fullHealLocalMod` | [_patient] | Local | Listen | Called before a local unit is fully healed, mods can listen and apply their own healing logic -### 2.15 Interaction (`ace_interaction`) +### 2.15 Medical Status (`ace_medical_status`) + +| Event Key | Parameters | Locality | Type | Description | +|---------- |------------|----------|------|-------------| +| `ace_medical_status_getBloodLoss` | [_unit, _bloodLoss] | Local | Listen | Called when blood loss is calculated for a unit, mods can listen and modify the blood loss value by modifying the array + +### 2.16 Interaction (`ace_interaction`) | Event Key | Parameters | Locality | Type | Description | |---------- |------------|----------|------|-------------| @@ -271,4 +277,4 @@ Calls a globally synchronized event, which will also be run on JIP players unles // Event called on another machine (tapping above target machine) ["ace_interact_tapShoulder", [arguments], [target]] call CBA_fnc_targetEvent; -``` \ No newline at end of file +```