From 671c63f953af1c9e32f4f0b6821da729205424c4 Mon Sep 17 00:00:00 2001 From: LinkIsGrim Date: Fri, 1 Mar 2024 18:16:48 -0300 Subject: [PATCH 1/4] add bandaged hook --- addons/medical_treatment/functions/fnc_bandage.sqf | 7 +++++-- addons/medical_treatment/functions/fnc_bandageLocal.sqf | 7 ++++--- docs/wiki/framework/events-framework.md | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_bandage.sqf b/addons/medical_treatment/functions/fnc_bandage.sqf index a4fb2c76980..f238f03531e 100644 --- a/addons/medical_treatment/functions/fnc_bandage.sqf +++ b/addons/medical_treatment/functions/fnc_bandage.sqf @@ -8,6 +8,7 @@ * 1: Patient * 2: Body Part * 3: Treatment + * 4: Bandage effectiveness coefficient (default: 1) * * Return Value: * None @@ -18,8 +19,10 @@ * Public: No */ -params ["_medic", "_patient", "_bodyPart", "_classname"]; +[QGVAR(bandaged), _this] call CBA_fnc_localEvent; // Raise event with reference so mods can modify this + +params ["_medic", "_patient", "_bodyPart", "_classname", ["_bandageEffectiveness", 1]]; [_patient, "activity", LSTRING(Activity_bandagedPatient), [[_medic, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); -[QGVAR(bandageLocal), [_patient, _bodyPart, _classname], _patient] call CBA_fnc_targetEvent; +[QGVAR(bandageLocal), [_patient, _bodyPart, _classname, _bandageEffectiveness], _patient] call CBA_fnc_targetEvent; diff --git a/addons/medical_treatment/functions/fnc_bandageLocal.sqf b/addons/medical_treatment/functions/fnc_bandageLocal.sqf index 0f695c4c611..3367bc0d7b5 100644 --- a/addons/medical_treatment/functions/fnc_bandageLocal.sqf +++ b/addons/medical_treatment/functions/fnc_bandageLocal.sqf @@ -7,6 +7,7 @@ * 0: Patient * 1: Body Part * 2: Treatment + * 3: Bandage effectiveness coefficient (default: 1) * * Return Value: * None @@ -17,8 +18,8 @@ * Public: No */ -params ["_patient", "_bodyPart", "_bandage"]; -TRACE_3("bandageLocal",_patient,_bodyPart,_bandage); +params ["_patient", "_bodyPart", "_bandage", ["_bandageEffectiveness", 1]]; +TRACE_4("bandageLocal",_patient,_bodyPart,_bandage,_bandageEffectiveness); _bodyPart = toLower _bodyPart; private _openWounds = GET_OPEN_WOUNDS(_patient); @@ -26,7 +27,7 @@ private _woundsOnPart = _openWounds getOrDefault [_bodyPart, []]; if (_woundsOnPart isEqualTo []) exitWith {}; // Figure out which injuries for this bodypart are the best choice to bandage -private _targetWounds = [_patient, _bandage, _bodyPart, GVAR(bandageEffectiveness)] call FUNC(findMostEffectiveWounds); +private _targetWounds = [_patient, _bandage, _bodyPart, _bandageEffectiveness * GVAR(bandageEffectiveness)] call FUNC(findMostEffectiveWounds); // Everything is patched up on this body part already if (count _targetWounds == 0) exitWith {}; diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index c29f271719c..f9cb041c91d 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -42,6 +42,7 @@ The vehicle events will also have the following local variables available `_gunn |`ace_treatmentSucceded` | [_caller, _target, _selectionName, _className, _itemUser, _usedItem] | Local | Listen | Treatment action is completed (local on the _caller) |`ace_treatmentFailed` | [_caller, _target, _selectionName, _className, _itemUser, _usedItem] | Local | Listen | Treatment action has been interrupted (local on the _caller) |`ace_medical_handleUnitVitals` | [_unit, _deltaT] | Local | Listen | Vitals update ran for unit, _deltaT is the time elapsed since the previous vitals update (local to _unit) +|`ace_medical_treatment_bandaged` | [_medic, _patient, _bodyPart, _className, _bandageEffectiveness] | Local | Listen | _medic has bandaged _patient, the array can be modified to change target or effectiveness (local to _medic) ### 2.3 Interaction Menu (`ace_interact_menu`) MenuType: 0 = Interaction, 1 = Self Interaction From d04cc7fa66de09b1f6d4f0fddffe0870d4ecc563 Mon Sep 17 00:00:00 2001 From: LinkIsGrim Date: Fri, 1 Mar 2024 18:18:22 -0300 Subject: [PATCH 2/4] better event description --- docs/wiki/framework/events-framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index f9cb041c91d..78c03cb8968 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -42,7 +42,7 @@ The vehicle events will also have the following local variables available `_gunn |`ace_treatmentSucceded` | [_caller, _target, _selectionName, _className, _itemUser, _usedItem] | Local | Listen | Treatment action is completed (local on the _caller) |`ace_treatmentFailed` | [_caller, _target, _selectionName, _className, _itemUser, _usedItem] | Local | Listen | Treatment action has been interrupted (local on the _caller) |`ace_medical_handleUnitVitals` | [_unit, _deltaT] | Local | Listen | Vitals update ran for unit, _deltaT is the time elapsed since the previous vitals update (local to _unit) -|`ace_medical_treatment_bandaged` | [_medic, _patient, _bodyPart, _className, _bandageEffectiveness] | Local | Listen | _medic has bandaged _patient, the array can be modified to change target or effectiveness (local to _medic) +|`ace_medical_treatment_bandaged` | [_medic, _patient, _bodyPart, _className, _bandageEffectiveness] | Local | Listen | _medic has bandaged _patient, the array can be modified to change treatment parameters (local to _medic) ### 2.3 Interaction Menu (`ace_interact_menu`) MenuType: 0 = Interaction, 1 = Self Interaction From ff044bed9d5ddfeb1e6f9236739df515a7ef069c Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Tue, 5 Mar 2024 03:51:39 -0300 Subject: [PATCH 3/4] Set default bandage effectiveness param Co-authored-by: PabstMirror --- addons/medical_treatment/functions/fnc_bandage.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/medical_treatment/functions/fnc_bandage.sqf b/addons/medical_treatment/functions/fnc_bandage.sqf index f238f03531e..8b19b203c83 100644 --- a/addons/medical_treatment/functions/fnc_bandage.sqf +++ b/addons/medical_treatment/functions/fnc_bandage.sqf @@ -19,6 +19,7 @@ * Public: No */ +_this set [4, _this param [4, 1]]; // set default Bandage effectiveness coefficient [QGVAR(bandaged), _this] call CBA_fnc_localEvent; // Raise event with reference so mods can modify this params ["_medic", "_patient", "_bodyPart", "_classname", ["_bandageEffectiveness", 1]]; From 6e5b5a554d4e19b8577563e2ea0bb0f81395b68c Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 9 Mar 2024 13:20:17 -0300 Subject: [PATCH 4/4] Update addons/medical_treatment/functions/fnc_bandage.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_treatment/functions/fnc_bandage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_bandage.sqf b/addons/medical_treatment/functions/fnc_bandage.sqf index 8b19b203c83..80475fa2c34 100644 --- a/addons/medical_treatment/functions/fnc_bandage.sqf +++ b/addons/medical_treatment/functions/fnc_bandage.sqf @@ -22,7 +22,7 @@ _this set [4, _this param [4, 1]]; // set default Bandage effectiveness coefficient [QGVAR(bandaged), _this] call CBA_fnc_localEvent; // Raise event with reference so mods can modify this -params ["_medic", "_patient", "_bodyPart", "_classname", ["_bandageEffectiveness", 1]]; +params ["_medic", "_patient", "_bodyPart", "_classname", "_bandageEffectiveness"]; [_patient, "activity", LSTRING(Activity_bandagedPatient), [[_medic, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);