From 631e8d66f65231d0ec021ba7549961c61b81fb1a Mon Sep 17 00:00:00 2001 From: Jaffa Date: Fri, 3 Jan 2020 22:55:47 +0000 Subject: [PATCH 1/9] Update ACE medical function name in ModuleACEHeal --- .../modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf index 7a4c9093..66f1903e 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf @@ -36,10 +36,10 @@ if (isClass (configfile >> "CfgPatches" >> "ace_medical")) exitWith { if (local _x) then { - [_x, _x] call ace_medical_fnc_treatmentAdvanced_fullHealLocal + [_x, _x] call ace_medical_treatment_fnc_fullHealLocal } else { - [_x, _x] remoteExecCall ["ace_medical_fnc_treatmentAdvanced_fullHealLocal", _x] + [_x, _x] remoteExecCall ["ace_medical_treatment_fnc_fullHealLocal", _x] }; } forEach _selected_units; }; From 46d59c51d8031c4c9e4b8f8ed10bbea6cc328ddc Mon Sep 17 00:00:00 2001 From: Jaffa Date: Fri, 3 Jan 2020 22:57:33 +0000 Subject: [PATCH 2/9] Update ACE medical function name in ModuleACEImmersiveHeal --- .../ACE/functions/fn_ModuleACEImmersiveHeal.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf index 9a3e63e6..91a3872e 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf @@ -56,10 +56,10 @@ private _fnc_reviveUnit = { { if (local _player) then { - [_player, _player] call ace_medical_fnc_treatmentAdvanced_fullHealLocal + [_player, _player] call ace_medical_treatment_fnc_fullHealLocal } else { - [_player, _player] remoteExecCall ["ace_medical_fnc_treatmentAdvanced_fullHealLocal", _player] + [_player, _player] remoteExecCall ["ace_medical_treatment_fnc_fullHealLocal", _player] }; }; From 866e49d26e3bb78f33b26f5a88b6ef3c7ec46c9b Mon Sep 17 00:00:00 2001 From: Jaffa Date: Fri, 3 Jan 2020 23:09:38 +0000 Subject: [PATCH 3/9] Remove deprecated function from setACEInjury --- .../functions_f_achilles/functions/features/fn_setACEInjury.sqf | 2 -- 1 file changed, 2 deletions(-) diff --git a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_setACEInjury.sqf b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_setACEInjury.sqf index c11baeb4..1aaa71da 100644 --- a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_setACEInjury.sqf +++ b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_setACEInjury.sqf @@ -16,8 +16,6 @@ params ["_unit","_injury_type","_injury_value_list","_hits"]; -[_unit] call ace_medical_fnc_addVitalLoop; - { private _value = _injury_value_list select _forEachIndex; From 47c71c23f4b46f666ec55618986ef03d3ced12c1 Mon Sep 17 00:00:00 2001 From: Jaffa Date: Sun, 12 Jan 2020 01:42:52 +0000 Subject: [PATCH 4/9] fn_ModuleACEHeal.sqf back-compat Needs testing --- .../ACE/functions/fn_ModuleACEHeal.sqf | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf index 66f1903e..4560a3cc 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf @@ -33,14 +33,16 @@ if (isClass (configfile >> "CfgPatches" >> "ace_medical")) exitWith if (isNil "_selected_units") exitWith {}; if (_selected_units isEqualTo []) exitWith {}; + // Determine what function we need to call (are we ace v3.13+? (medical rewrite)) + private _func = switch (true) do { + case (!isNil "ace_medical_treatment_fnc_fullHeal"): {ace_medical_treatment_fnc_fullHeal}; + case (!isNil "ace_medical_fnc_treatmentAdvanced_fullHeal"): {ace_medical_fnc_treatmentAdvanced_fullHeal}; + default {{}}; + }; + { - if (local _x) then - { - [_x, _x] call ace_medical_treatment_fnc_fullHealLocal - } else - { - [_x, _x] remoteExecCall ["ace_medical_treatment_fnc_fullHealLocal", _x] - }; + // Let ace handle propagating the heal (through CBA_fnc_targetEvent) + [player, _target] call _func; } forEach _selected_units; }; From 0d16441bb858adafd3d3d90919518145659872fa Mon Sep 17 00:00:00 2001 From: Jaffa Date: Sun, 12 Jan 2020 01:45:06 +0000 Subject: [PATCH 5/9] fn_ModuleACEImmersiveHeal back-compat Needs testing --- .../ACE/functions/fn_ModuleACEImmersiveHeal.sqf | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf index 91a3872e..6abf3419 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf @@ -54,13 +54,15 @@ private _fnc_reviveUnit = { // do the actual revive if (isClass (configfile >> "CfgPatches" >> "ace_medical")) then { - if (local _player) then - { - [_player, _player] call ace_medical_treatment_fnc_fullHealLocal - } else - { - [_player, _player] remoteExecCall ["ace_medical_treatment_fnc_fullHealLocal", _player] - }; + // Determine what function we need to call (are we ace v3.13+? (medical rewrite)) + private _func = switch (true) do { + case (!isNil "ace_medical_treatment_fnc_fullHeal"): {ace_medical_treatment_fnc_fullHeal}; + case (!isNil "ace_medical_fnc_treatmentAdvanced_fullHeal"): {ace_medical_fnc_treatmentAdvanced_fullHeal}; + default {{}}; + }; + + // Let ace handle propagating the heal (through CBA_fnc_targetEvent) + [player, _target] call _func; }; if (!isNil "FAR_ReviveMode") then From 11cfcbc7eea5e763e41d7e1c5e15be8961e61b40 Mon Sep 17 00:00:00 2001 From: Jaffa Date: Sun, 12 Jan 2020 01:48:59 +0000 Subject: [PATCH 6/9] fn_setACEInjury back-compat Needs testing --- .../functions/features/fn_setACEInjury.sqf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_setACEInjury.sqf b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_setACEInjury.sqf index 1aaa71da..ac000e2e 100644 --- a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_setACEInjury.sqf +++ b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_setACEInjury.sqf @@ -16,6 +16,11 @@ params ["_unit","_injury_type","_injury_value_list","_hits"]; +// Add vital loop if ace medical is pre-rewrite +if (!isNil "ace_medical_fnc_treatmentAdvanced_fullHeal") then { + [_unit] call ace_medical_fnc_addVitalLoop; +}; + { private _value = _injury_value_list select _forEachIndex; From 35a85142fdcb4ffbf316f0fcdf77938f3798af0b Mon Sep 17 00:00:00 2001 From: Jaffa Date: Sun, 12 Jan 2020 01:50:45 +0000 Subject: [PATCH 7/9] Fix vars --- .../ACE/functions/fn_ModuleACEImmersiveHeal.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf index 6abf3419..c816efd9 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf @@ -62,7 +62,7 @@ private _fnc_reviveUnit = { }; // Let ace handle propagating the heal (through CBA_fnc_targetEvent) - [player, _target] call _func; + [_ai, _player] call _func; }; if (!isNil "FAR_ReviveMode") then From 1c42a375b14ca2c85f06db8ef8e6f3cade02706a Mon Sep 17 00:00:00 2001 From: Jaffa Date: Sun, 12 Jan 2020 01:51:19 +0000 Subject: [PATCH 8/9] Fix var --- .../modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf index 4560a3cc..05fe9e8a 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf @@ -42,7 +42,7 @@ if (isClass (configfile >> "CfgPatches" >> "ace_medical")) exitWith { // Let ace handle propagating the heal (through CBA_fnc_targetEvent) - [player, _target] call _func; + [player, _x] call _func; } forEach _selected_units; }; From fbb741f64ed1d06dbb3c07443b77e720d1cb3b3a Mon Sep 17 00:00:00 2001 From: Ralfs Garkaklis Date: Wed, 15 Jan 2020 15:44:11 +0200 Subject: [PATCH 9/9] Removed duplicate code by extracting code --- .../functions_f_achilles/cfgFunctions.hpp | 1 + .../common/fn_getAceMedicalFunction.sqf | 23 +++++++++++++++++++ .../ACE/functions/fn_ModuleACEHeal.sqf | 9 +------- .../functions/fn_ModuleACEImmersiveHeal.sqf | 9 +------- 4 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 @AresModAchillesExpansion/addons/functions_f_achilles/functions/common/fn_getAceMedicalFunction.sqf diff --git a/@AresModAchillesExpansion/addons/functions_f_achilles/cfgFunctions.hpp b/@AresModAchillesExpansion/addons/functions_f_achilles/cfgFunctions.hpp index 4837adfd..5e3ea5fb 100644 --- a/@AresModAchillesExpansion/addons/functions_f_achilles/cfgFunctions.hpp +++ b/@AresModAchillesExpansion/addons/functions_f_achilles/cfgFunctions.hpp @@ -58,6 +58,7 @@ class CfgFunctions class vectDirUpFromDirPitchBank; class arrayStdDev; class transferOwnership; + class getAceMedicalFunction; }; class interpolation diff --git a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/common/fn_getAceMedicalFunction.sqf b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/common/fn_getAceMedicalFunction.sqf new file mode 100644 index 00000000..2ba2dc84 --- /dev/null +++ b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/common/fn_getAceMedicalFunction.sqf @@ -0,0 +1,23 @@ +/* + * Author: DeliciousJaffa + * Determines what function we need to call (are we ACE v3.13+? (medical rewrite)). + * + * Arguments: + * None + * + * Return Value: + * Return Value + * + * Example: + * [] call Achilles_fnc_getAceMedicalFunction + * + * Public: No + */ + + private _function = switch (true) do { + case (!isNil "ace_medical_treatment_fnc_fullHeal"): {ace_medical_treatment_fnc_fullHeal}; + case (!isNil "ace_medical_fnc_treatmentAdvanced_fullHeal"): {ace_medical_fnc_treatmentAdvanced_fullHeal}; + default {{}}; +}; + +_function \ No newline at end of file diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf index 05fe9e8a..d8a98516 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEHeal.sqf @@ -33,16 +33,9 @@ if (isClass (configfile >> "CfgPatches" >> "ace_medical")) exitWith if (isNil "_selected_units") exitWith {}; if (_selected_units isEqualTo []) exitWith {}; - // Determine what function we need to call (are we ace v3.13+? (medical rewrite)) - private _func = switch (true) do { - case (!isNil "ace_medical_treatment_fnc_fullHeal"): {ace_medical_treatment_fnc_fullHeal}; - case (!isNil "ace_medical_fnc_treatmentAdvanced_fullHeal"): {ace_medical_fnc_treatmentAdvanced_fullHeal}; - default {{}}; - }; - { // Let ace handle propagating the heal (through CBA_fnc_targetEvent) - [player, _x] call _func; + [player, _x] call (call Achilles_fnc_getAceMedicalFunction); } forEach _selected_units; }; diff --git a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf index c816efd9..6b5b9bee 100644 --- a/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf @@ -54,15 +54,8 @@ private _fnc_reviveUnit = { // do the actual revive if (isClass (configfile >> "CfgPatches" >> "ace_medical")) then { - // Determine what function we need to call (are we ace v3.13+? (medical rewrite)) - private _func = switch (true) do { - case (!isNil "ace_medical_treatment_fnc_fullHeal"): {ace_medical_treatment_fnc_fullHeal}; - case (!isNil "ace_medical_fnc_treatmentAdvanced_fullHeal"): {ace_medical_fnc_treatmentAdvanced_fullHeal}; - default {{}}; - }; - // Let ace handle propagating the heal (through CBA_fnc_targetEvent) - [_ai, _player] call _func; + [_ai, _player] call (call Achilles_fnc_getAceMedicalFunction); }; if (!isNil "FAR_ReviveMode") then