From e92c775480393b1cd14a836ec36da086149d7100 Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Fri, 1 Mar 2024 14:40:53 -0600 Subject: [PATCH 01/11] full heal local --- addons/medical_treatment/functions/fnc_fullHealLocal.sqf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/medical_treatment/functions/fnc_fullHealLocal.sqf b/addons/medical_treatment/functions/fnc_fullHealLocal.sqf index 7772db0a6ba..31be9ecde4f 100644 --- a/addons/medical_treatment/functions/fnc_fullHealLocal.sqf +++ b/addons/medical_treatment/functions/fnc_fullHealLocal.sqf @@ -25,6 +25,9 @@ if ((["ace_fire"] call EFUNC(common,isModLoaded)) && {[_patient] call EFUNC(fire _patient setVariable [QEGVAR(fire,intensity), 0, true]; }; +// Allow mods to heal +[QGVAR(fullHealLocal), _patient] call CBA_fnc_localEvent; + private _state = GET_SM_STATE(_patient); TRACE_1("start",_state); From 116fc5b2588b439fee9456c6d5bd0b470996cc03 Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Fri, 1 Mar 2024 15:28:50 -0600 Subject: [PATCH 02/11] update body image --- addons/medical_gui/functions/fnc_updateBodyImage.sqf | 2 ++ addons/medical_treatment/functions/fnc_fullHealLocal.sqf | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/medical_gui/functions/fnc_updateBodyImage.sqf b/addons/medical_gui/functions/fnc_updateBodyImage.sqf index 4d22b68a2d8..b8ee8ee240e 100644 --- a/addons/medical_gui/functions/fnc_updateBodyImage.sqf +++ b/addons/medical_gui/functions/fnc_updateBodyImage.sqf @@ -105,3 +105,5 @@ private _bodyPartBloodLoss = [0, 0, 0, 0, 0, 0]; [IDC_BODY_LEGLEFT, IDC_BODY_LEGLEFT_S, IDC_BODY_LEGLEFT_T, IDC_BODY_LEGLEFT_B], [IDC_BODY_LEGRIGHT, IDC_BODY_LEGRIGHT_S, IDC_BODY_LEGRIGHT_T, IDC_BODY_LEGRIGHT_B] ]; + +[QGVAR(updateBodyImage), [_ctrlGroup, _target, _selectionN]] call CBA_fnc_localEvent; diff --git a/addons/medical_treatment/functions/fnc_fullHealLocal.sqf b/addons/medical_treatment/functions/fnc_fullHealLocal.sqf index 31be9ecde4f..260745a8d6a 100644 --- a/addons/medical_treatment/functions/fnc_fullHealLocal.sqf +++ b/addons/medical_treatment/functions/fnc_fullHealLocal.sqf @@ -26,7 +26,7 @@ if ((["ace_fire"] call EFUNC(common,isModLoaded)) && {[_patient] call EFUNC(fire }; // Allow mods to heal -[QGVAR(fullHealLocal), _patient] call CBA_fnc_localEvent; +[QGVAR(fullHealLocal), [_patient]] call CBA_fnc_localEvent; private _state = GET_SM_STATE(_patient); TRACE_1("start",_state); From 5b87894cce47067e495d5c56cd64bccbe3afa058 Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Fri, 1 Mar 2024 15:39:02 -0600 Subject: [PATCH 03/11] log list --- addons/medical_gui/functions/fnc_updateLogList.sqf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/medical_gui/functions/fnc_updateLogList.sqf b/addons/medical_gui/functions/fnc_updateLogList.sqf index d2bb75b63fb..51240705f98 100644 --- a/addons/medical_gui/functions/fnc_updateLogList.sqf +++ b/addons/medical_gui/functions/fnc_updateLogList.sqf @@ -23,6 +23,8 @@ lbClear _ctrl; { _x params ["_message", "_timeStamp", "_arguments"]; + private _unlocalizedMessage = _message; + // Localize message and arguments if (isLocalized _message) then { _message = localize _message; @@ -33,5 +35,7 @@ lbClear _ctrl; // Format message with arguments _message = format ([_message] + _arguments); - _ctrl lbAdd format ["%1 %2", _timeStamp, _message]; + private _row = _ctrl lbAdd format ["%1 %2", _timeStamp, _message]; + + [QGVAR(logListAppended), [_ctrl, _row, _message, _unlocalizedMessage, _timeStamp, _arguments]] call CBA_fnc_localEvent; } forEach _logs; From 08339af8b13f4614abe083267b321826c03a2ba3 Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Fri, 1 Mar 2024 17:41:49 -0600 Subject: [PATCH 04/11] better _enable in categories --- addons/medical_gui/functions/fnc_updateCategories.sqf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/medical_gui/functions/fnc_updateCategories.sqf b/addons/medical_gui/functions/fnc_updateCategories.sqf index c9917a87581..c2f1d2a11c8 100644 --- a/addons/medical_gui/functions/fnc_updateCategories.sqf +++ b/addons/medical_gui/functions/fnc_updateCategories.sqf @@ -21,8 +21,9 @@ params ["_display"]; _x params ["_idc", "_category"]; private _ctrl = _display displayCtrl _idc; - private _enable = GVAR(actions) findIf {_category == _x select 1 && {call (_x select 2)}} > -1; - if (_category isEqualTo "triage") then {_enable = true}; + private _enable = if (_category == "triage") then { true } else { + GVAR(actions) findIf {_category == _x select 1 && {call (_x select 2)}} > -1 + }; _ctrl ctrlEnable _enable; private _selectedColor = [ From d2cf6f7186bc10c7b9efb6f663ffb94f8cf724a8 Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Fri, 1 Mar 2024 18:04:46 -0600 Subject: [PATCH 05/11] update injury list --- addons/medical_gui/functions/fnc_updateInjuryList.sqf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/medical_gui/functions/fnc_updateInjuryList.sqf b/addons/medical_gui/functions/fnc_updateInjuryList.sqf index 328e80242a2..0cf7b6f78a3 100644 --- a/addons/medical_gui/functions/fnc_updateInjuryList.sqf +++ b/addons/medical_gui/functions/fnc_updateInjuryList.sqf @@ -116,6 +116,8 @@ if (_selectionN == -1) exitWith { _ctrl lbSetCurSel -1; }; +[QGVAR(updateInjuryListGeneral), [_ctrl, _target, _selectionN, _entries]] call CBA_fnc_localEvent; + _entries pushBack ["", [1, 1, 1, 1]]; // Add selected body part name @@ -184,6 +186,8 @@ switch (GET_FRACTURES(_target) select _selectionN) do { }; }; +[QGVAR(updateInjuryListPart), [_ctrl, _target, _selectionN, _entries, _bodyPartName]] call CBA_fnc_localEvent; + // Add entries for open, bandaged, and stitched wounds private _woundEntries = []; @@ -216,6 +220,8 @@ private _fnc_processWounds = { [GET_BANDAGED_WOUNDS(_target), "[B] %1", [0.88, 0.7, 0.65, 1]] call _fnc_processWounds; [GET_STITCHED_WOUNDS(_target), "[S] %1", [0.7, 0.7, 0.7, 1]] call _fnc_processWounds; +[QGVAR(updateInjuryListWounds), [_ctrl, _target, _selectionN, _woundEntries, _bodyPartName]] call CBA_fnc_localEvent; + // Handle no wound entries if (_woundEntries isEqualTo []) then { _entries pushBack [localize ELSTRING(medical_treatment,NoInjuriesBodypart), _nonissueColor]; From 885873f8db4bfdf70e3c2c0ea283c7dfb990c6ff Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Fri, 1 Mar 2024 20:53:30 -0600 Subject: [PATCH 06/11] cardiac output internal variable --- addons/medical_engine/XEH_preInit.sqf | 1 + addons/medical_engine/script_macros_medical.hpp | 4 ++++ addons/medical_status/functions/fnc_getBloodLoss.sqf | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/medical_engine/XEH_preInit.sqf b/addons/medical_engine/XEH_preInit.sqf index dab2e7efe32..a7221ce1c1f 100644 --- a/addons/medical_engine/XEH_preInit.sqf +++ b/addons/medical_engine/XEH_preInit.sqf @@ -19,6 +19,7 @@ if (isNil QUOTE(BLOOD_LOSS_KNOCK_OUT_THRESHOLD)) then {BLOOD_LOSS_KNOCK_OUT_THRE if (isNil QUOTE(PAIN_FADE_TIME)) then {PAIN_FADE_TIME = PAIN_FADE_TIME_DEFAULT}; if (isNil QUOTE(LIMPING_DAMAGE_THRESHOLD)) then {LIMPING_DAMAGE_THRESHOLD = LIMPING_DAMAGE_THRESHOLD_DEFAULT}; if (isNil QUOTE(FRACTURE_DAMAGE_THRESHOLD)) then {FRACTURE_DAMAGE_THRESHOLD = FRACTURE_DAMAGE_THRESHOLD_DEFAULT}; +if (isNil QUOTE(CARIDAC_OUTPUT_MIN)) then {CARIDAC_OUTPUT_MIN = CARIDAC_OUTPUT_MIN_DEFAULT}; // Derive the alternate fatal damage coefficents if (isNil QUOTE(FATAL_SUM_DAMAGE_WEIBULL_K) || isNil QUOTE(FATAL_SUM_DAMAGE_WEIBULL_L)) then { private _x1 = 0.5; diff --git a/addons/medical_engine/script_macros_medical.hpp b/addons/medical_engine/script_macros_medical.hpp index 6f96478406b..bfb9531191c 100644 --- a/addons/medical_engine/script_macros_medical.hpp +++ b/addons/medical_engine/script_macros_medical.hpp @@ -108,6 +108,10 @@ #define FRACTURE_DAMAGE_THRESHOLD EGVAR(medical,const_fractureDamageThreshold) #define FRACTURE_DAMAGE_THRESHOLD_DEFAULT 0.50 +// Minimum cardiac output +#define CARIDAC_OUTPUT_MIN EGVAR(medical,const_minCardiacOutput) +#define CARIDAC_OUTPUT_MIND_DEFAULT 0.05 + // Minimum body part damage required for blood effect on uniform #define VISUAL_BODY_DAMAGE_THRESHOLD 0.35 diff --git a/addons/medical_status/functions/fnc_getBloodLoss.sqf b/addons/medical_status/functions/fnc_getBloodLoss.sqf index 8ff0fbff3ba..d1adbb98645 100644 --- a/addons/medical_status/functions/fnc_getBloodLoss.sqf +++ b/addons/medical_status/functions/fnc_getBloodLoss.sqf @@ -23,4 +23,4 @@ if (_woundBleeding == 0) exitWith {0}; private _cardiacOutput = [_unit] call FUNC(getCardiacOutput); // even if heart stops blood will still flow slowly (gravity) -(_woundBleeding * (_cardiacOutput max 0.05) * EGVAR(medical,bleedingCoefficient)) +(_woundBleeding * (_cardiacOutput max CARIDAC_OUTPUT_MIN) * EGVAR(medical,bleedingCoefficient)) From dbf1464113994687928dc9af80f2898dd7bfdcce Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Fri, 1 Mar 2024 20:54:20 -0600 Subject: [PATCH 07/11] typo --- addons/medical_engine/script_macros_medical.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_engine/script_macros_medical.hpp b/addons/medical_engine/script_macros_medical.hpp index bfb9531191c..f789caec9ea 100644 --- a/addons/medical_engine/script_macros_medical.hpp +++ b/addons/medical_engine/script_macros_medical.hpp @@ -110,7 +110,7 @@ // Minimum cardiac output #define CARIDAC_OUTPUT_MIN EGVAR(medical,const_minCardiacOutput) -#define CARIDAC_OUTPUT_MIND_DEFAULT 0.05 +#define CARIDAC_OUTPUT_MIN_DEFAULT 0.05 // Minimum body part damage required for blood effect on uniform #define VISUAL_BODY_DAMAGE_THRESHOLD 0.35 From fb9fa0d7dc2f3408b0d1e3f6c1fdc93a00f2654f Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Sat, 2 Mar 2024 20:16:04 -0600 Subject: [PATCH 08/11] remove duplicate event --- addons/medical_treatment/functions/fnc_fullHealLocal.sqf | 3 --- 1 file changed, 3 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_fullHealLocal.sqf b/addons/medical_treatment/functions/fnc_fullHealLocal.sqf index 260745a8d6a..7772db0a6ba 100644 --- a/addons/medical_treatment/functions/fnc_fullHealLocal.sqf +++ b/addons/medical_treatment/functions/fnc_fullHealLocal.sqf @@ -25,9 +25,6 @@ if ((["ace_fire"] call EFUNC(common,isModLoaded)) && {[_patient] call EFUNC(fire _patient setVariable [QEGVAR(fire,intensity), 0, true]; }; -// Allow mods to heal -[QGVAR(fullHealLocal), [_patient]] call CBA_fnc_localEvent; - private _state = GET_SM_STATE(_patient); TRACE_1("start",_state); From 5948a1454971621a8b825acc756448ac7c4c1158 Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Sat, 2 Mar 2024 20:19:21 -0600 Subject: [PATCH 09/11] rename event --- addons/medical_treatment/functions/fnc_fullHealLocal.sqf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/medical_treatment/functions/fnc_fullHealLocal.sqf b/addons/medical_treatment/functions/fnc_fullHealLocal.sqf index 7772db0a6ba..dc95c44185a 100644 --- a/addons/medical_treatment/functions/fnc_fullHealLocal.sqf +++ b/addons/medical_treatment/functions/fnc_fullHealLocal.sqf @@ -25,6 +25,9 @@ if ((["ace_fire"] call EFUNC(common,isModLoaded)) && {[_patient] call EFUNC(fire _patient setVariable [QEGVAR(fire,intensity), 0, true]; }; +// Allow mods to heal +[QGVAR(fullHealLocalMod), [_patient]] call CBA_fnc_localEvent; + private _state = GET_SM_STATE(_patient); TRACE_1("start",_state); From f0e098c86ad91edfd471defbfd63e1a5357dd03b Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Sun, 3 Mar 2024 18:54:37 -0600 Subject: [PATCH 10/11] add docs --- docs/wiki/framework/events-framework.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index c29f271719c..cf4fe31a95e 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -129,6 +129,22 @@ MenuType: 0 = Interaction, 1 = Self Interaction | `ace_trenches_placed` | [_unit, _trench] | Global | Listen | After trench object is placed by unit. | `ace_trenches_finished` | [_unit, _trench] | Global | Listen | After trench object is fully dug up by unit (100% progress). +### 2.13 Medical GUI (`ace_medical_gui`) + +| Event Key | Parameters | Locality | Type | Description | +|---------- |------------|----------|------|-------------| +| `ace_medical_gui_updateBodyImage` | [_ctrlGroup, _target, _selectionN] | Local | Listen | Allows mods to update any modifications they have made to the body image +| `ace_medical_gui_updateInjuryListGeneral` | [_ctrl, _target, _selectionN, _entries] | Local | Listen | Allows mods to update the general injury list by pushing to the _entries array +| `ace_medical_gui_updateInjuryListPart` | [_ctrl, _target, _selectionN, _entries, _bodyPartName] | Local | Listen | Allows mods to update the part injury list by pushing to the _entries array +| `ace_medical_gui_updateInjuryListWounds` | [_ctrl, _target, _selectionN, _woundEntries, _bodyPartName] | Local | Listen | Allows mods to update the wounds injury list by pushing to the _woundEntries array +| `ace_medical_gui_logListAppended` | [_ctrl, _row, _message, _unlocalizedMessage, _timeStamp, _arguments] | Local | Listen | After an entry is appended to the log list + +### 2.14 Medical Treatment (`ace_medical_treatment`) + +| Event Key | Parameters | Locality | Type | Description | +|---------- |------------|----------|------|-------------| +| `ace_medical_treatment_fullHealLocalMod` | [_patient] | Local | Listen | Called when a local unit is being fully healed, mods can listen and apply their own healing logic + ## 3. Usage Also Reference [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} documentation. From fef2334622a353cd64fd2dd45d07e8ff91736172 Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Mon, 4 Mar 2024 09:32:34 -0600 Subject: [PATCH 11/11] Update docs/wiki/framework/events-framework.md Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- 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 cf4fe31a95e..eb717bffe8c 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -143,7 +143,7 @@ MenuType: 0 = Interaction, 1 = Self Interaction | Event Key | Parameters | Locality | Type | Description | |---------- |------------|----------|------|-------------| -| `ace_medical_treatment_fullHealLocalMod` | [_patient] | Local | Listen | Called when a local unit is being fully healed, mods can listen and apply their own healing logic +| `ace_medical_treatment_fullHealLocalMod` | [_patient] | Local | Listen | Called before a local unit is fully healed, mods can listen and apply their own healing logic ## 3. Usage Also Reference [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} documentation.