From f7c65f3397972acd95058cf068951a2c1ee71405 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 31 Aug 2022 01:21:39 -0600 Subject: [PATCH 01/11] open medical menu from Zeus --- .../medical_gui/functions/fnc_canOpenMenu.sqf | 2 +- addons/medical_gui/functions/fnc_menuPFH.sqf | 2 +- .../functions/fnc_treatment.sqf | 128 +++++++++--------- addons/zeus/CfgVehicles.hpp | 7 + addons/zeus/XEH_PREP.hpp | 9 +- addons/zeus/config.cpp | 3 +- .../zeus/functions/fnc_moduleMedicalMenu.sqf | 38 ++++++ addons/zeus/stringtable.xml | 16 +++ 8 files changed, 135 insertions(+), 70 deletions(-) create mode 100644 addons/zeus/functions/fnc_moduleMedicalMenu.sqf diff --git a/addons/medical_gui/functions/fnc_canOpenMenu.sqf b/addons/medical_gui/functions/fnc_canOpenMenu.sqf index f94c73bb9ee..08747647b73 100644 --- a/addons/medical_gui/functions/fnc_canOpenMenu.sqf +++ b/addons/medical_gui/functions/fnc_canOpenMenu.sqf @@ -21,5 +21,5 @@ params ["_player", "_target"]; alive _player && {!IS_UNCONSCIOUS(_player)} && {!isNull _target} -&& {_player distance _target < GVAR(maxDistance) || {vehicle _player == vehicle _target}} +&& {_player distance _target < GVAR(maxDistance) || {vehicle _player == vehicle _target} || {!isNull findDisplay 312}} && {GVAR(enableMedicalMenu) == 1 || {GVAR(enableMedicalMenu) == 2 && {vehicle _player != _player || {vehicle _target != _target}}}} diff --git a/addons/medical_gui/functions/fnc_menuPFH.sqf b/addons/medical_gui/functions/fnc_menuPFH.sqf index c2dc7a277fe..a653fc4c62c 100644 --- a/addons/medical_gui/functions/fnc_menuPFH.sqf +++ b/addons/medical_gui/functions/fnc_menuPFH.sqf @@ -16,7 +16,7 @@ */ // Check if menu should stay open for target -if !([ACE_player, GVAR(target), ["isNotInside", "isNotSwimming"]] call EFUNC(common,canInteractWith) && {[ACE_player, GVAR(target)] call FUNC(canOpenMenu)}) then { +if !([ACE_player, GVAR(target), ["isNotInside", "isNotSwimming", "isNotInZeus"]] call EFUNC(common,canInteractWith) && {[ACE_player, GVAR(target)] call FUNC(canOpenMenu)}) then { closeDialog 0; // Show hint if distance condition failed if ((ACE_player distance GVAR(target) > GVAR(maxDistance)) && {vehicle ACE_player != vehicle GVAR(target)}) then { diff --git a/addons/medical_treatment/functions/fnc_treatment.sqf b/addons/medical_treatment/functions/fnc_treatment.sqf index b99e703f226..0444f47d943 100644 --- a/addons/medical_treatment/functions/fnc_treatment.sqf +++ b/addons/medical_treatment/functions/fnc_treatment.sqf @@ -54,88 +54,90 @@ private _userAndItem = if (GET_NUMBER_ENTRY(_config >> "consumeItem") == 1) then _userAndItem params ["_itemUser", "_usedItem"]; -// Get treatment animation for the medic -private _medicAnim = if (_medic isEqualTo _patient) then { - getText (_config >> ["animationMedicSelf", "animationMedicSelfProne"] select (stance _medic == "PRONE")); -} else { - getText (_config >> ["animationMedic", "animationMedicProne"] select (stance _medic == "PRONE")); -}; +if !(_medic isEqualTo player && {!isNull findDisplay 312}) then { + // Get treatment animation for the medic + private _medicAnim = if (_medic isEqualTo _patient) then { + getText (_config >> ["animationMedicSelf", "animationMedicSelfProne"] select (stance _medic == "PRONE")); + } else { + getText (_config >> ["animationMedic", "animationMedicProne"] select (stance _medic == "PRONE")); + }; -_medic setVariable [QGVAR(selectedWeaponOnTreatment), weaponState _medic]; + _medic setVariable [QGVAR(selectedWeaponOnTreatment), weaponState _medic]; -// Adjust animation based on the current weapon of the medic -private _wpn = ["non", "rfl", "lnr", "pst"] param [["", primaryWeapon _medic, secondaryWeapon _medic, handgunWeapon _medic] find currentWeapon _medic, "non"]; -_medicAnim = [_medicAnim, "[wpn]", _wpn] call CBA_fnc_replace; + // Adjust animation based on the current weapon of the medic + private _wpn = ["non", "rfl", "lnr", "pst"] param [["", primaryWeapon _medic, secondaryWeapon _medic, handgunWeapon _medic] find currentWeapon _medic, "non"]; + _medicAnim = [_medicAnim, "[wpn]", _wpn] call CBA_fnc_replace; -// This animation is missing, use alternative -if (_medicAnim == "AinvPknlMstpSlayWlnrDnon_medic") then { - _medicAnim = "AinvPknlMstpSlayWlnrDnon_medicOther"; -}; + // This animation is missing, use alternative + if (_medicAnim == "AinvPknlMstpSlayWlnrDnon_medic") then { + _medicAnim = "AinvPknlMstpSlayWlnrDnon_medicOther"; + }; -// Determine the animation length -private _animDuration = GVAR(animDurations) getVariable _medicAnim; -if (isNil "_animDuration") then { - WARNING_2("animation [%1] for [%2] has no duration defined",_medicAnim,_classname); - _animDuration = 10; -}; + // Determine the animation length + private _animDuration = GVAR(animDurations) getVariable _medicAnim; + if (isNil "_animDuration") then { + WARNING_2("animation [%1] for [%2] has no duration defined",_medicAnim,_classname); + _animDuration = 10; + }; -// These animations have transitions that take a bit longer... -if (weaponLowered _medic) then { - _animDuration = _animDuration + 0.5; + // These animations have transitions that take a bit longer... + if (weaponLowered _medic) then { + _animDuration = _animDuration + 0.5; - // Fix problems with lowered weapon transitions by raising the weapon first - if (currentWeapon _medic != "" && {_medicAnim != ""}) then { - _medic action ["WeaponInHand", _medic]; + // Fix problems with lowered weapon transitions by raising the weapon first + if (currentWeapon _medic != "" && {_medicAnim != ""}) then { + _medic action ["WeaponInHand", _medic]; + }; }; -}; -if (binocular _medic != "" && {binocular _medic == currentWeapon _medic}) then { - _animDuration = _animDuration + 1; -}; + if (binocular _medic != "" && {binocular _medic == currentWeapon _medic}) then { + _animDuration = _animDuration + 1; + }; -// Play treatment animation for medic and determine the ending animation -if (vehicle _medic == _medic && {_medicAnim != ""}) then { - // Speed up animation based on treatment time (but cap max to prevent odd animiations/cam shake) - private _animRatio = _animDuration / _treatmentTime; - TRACE_3("setAnimSpeedCoef",_animRatio,_animDuration,_treatmentTime); + // Play treatment animation for medic and determine the ending animation + if (vehicle _medic == _medic && {_medicAnim != ""}) then { + // Speed up animation based on treatment time (but cap max to prevent odd animiations/cam shake) + private _animRatio = _animDuration / _treatmentTime; + TRACE_3("setAnimSpeedCoef",_animRatio,_animDuration,_treatmentTime); - // Don't slow down animation too much to prevent it looking funny. - if (_animRatio < ANIMATION_SPEED_MIN_COEFFICIENT) then { - _animRatio = ANIMATION_SPEED_MIN_COEFFICIENT; - }; + // Don't slow down animation too much to prevent it looking funny. + if (_animRatio < ANIMATION_SPEED_MIN_COEFFICIENT) then { + _animRatio = ANIMATION_SPEED_MIN_COEFFICIENT; + }; - // Skip animation enitrely if progress bar too quick. - if (_animRatio > ANIMATION_SPEED_MAX_COEFFICIENT) exitWith {}; + // Skip animation enitrely if progress bar too quick. + if (_animRatio > ANIMATION_SPEED_MAX_COEFFICIENT) exitWith {}; - [QEGVAR(common,setAnimSpeedCoef), [_medic, _animRatio]] call CBA_fnc_globalEvent; + [QEGVAR(common,setAnimSpeedCoef), [_medic, _animRatio]] call CBA_fnc_globalEvent; - // Play animation - private _endInAnim = "AmovP[pos]MstpS[stn]W[wpn]Dnon"; + // Play animation + private _endInAnim = "AmovP[pos]MstpS[stn]W[wpn]Dnon"; - private _pos = ["knl", "pne"] select (stance _medic == "PRONE"); - private _stn = "non"; + private _pos = ["knl", "pne"] select (stance _medic == "PRONE"); + private _stn = "non"; - if (_wpn != "non") then { - _stn = ["ras", "low"] select (weaponLowered _medic); - }; + if (_wpn != "non") then { + _stn = ["ras", "low"] select (weaponLowered _medic); + }; - _endInAnim = [_endInAnim, "[pos]", _pos] call CBA_fnc_replace; - _endInAnim = [_endInAnim, "[stn]", _stn] call CBA_fnc_replace; - _endInAnim = [_endInAnim, "[wpn]", _wpn] call CBA_fnc_replace; + _endInAnim = [_endInAnim, "[pos]", _pos] call CBA_fnc_replace; + _endInAnim = [_endInAnim, "[stn]", _stn] call CBA_fnc_replace; + _endInAnim = [_endInAnim, "[wpn]", _wpn] call CBA_fnc_replace; - [_medic, _medicAnim] call EFUNC(common,doAnimation); - [_medic, _endInAnim] call EFUNC(common,doAnimation); - _medic setVariable [QGVAR(endInAnim), _endInAnim]; + [_medic, _medicAnim] call EFUNC(common,doAnimation); + [_medic, _endInAnim] call EFUNC(common,doAnimation); + _medic setVariable [QGVAR(endInAnim), _endInAnim]; - if (!isNil QEGVAR(advanced_fatigue,setAnimExclusions)) then { - EGVAR(advanced_fatigue,setAnimExclusions) pushBack QUOTE(ADDON); + if (!isNil QEGVAR(advanced_fatigue,setAnimExclusions)) then { + EGVAR(advanced_fatigue,setAnimExclusions) pushBack QUOTE(ADDON); + }; }; -}; -// Play a random treatment sound globally if defined -if (isArray (_config >> "sounds")) then { - selectRandom getArray (_config >> "sounds") params ["_file", ["_volume", 1], ["_pitch", 1], ["_distance", 10]]; - playSound3D [_file, objNull, false, getPosASL _medic, _volume, _pitch, _distance]; + // Play a random treatment sound globally if defined + if (isArray (_config >> "sounds")) then { + selectRandom getArray (_config >> "sounds") params ["_file", ["_volume", 1], ["_pitch", 1], ["_distance", 10]]; + playSound3D [_file, objNull, false, getPosASL _medic, _volume, _pitch, _distance]; + }; }; GET_FUNCTION(_callbackStart,_config >> "callbackStart"); @@ -156,7 +158,7 @@ if (_callbackProgress isEqualTo {}) then { FUNC(treatmentFailure), getText (_config >> "displayNameProgress"), _callbackProgress, - ["isNotInside"] + ["isNotInside", "isNotInZeus"] ] call EFUNC(common,progressBar); true diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index 737f2acc098..5d2c9a87bbf 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -331,6 +331,13 @@ class CfgVehicles { function = QFUNC(moduleBurn); icon = QPATHTOF(ui\Icon_Module_Zeus_Burn_ca.paa); }; + class GVAR(moduleMedicalMenu): GVAR(moduleBase) { + curatorCanAttach = 1; + category = QGVAR(Medical); + displayName = CSTRING(ModuleMedicalMenu_DisplayName); + function = QFUNC(moduleMedicalMenu); + icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa); + }; class Man; class CAManBase: Man { diff --git a/addons/zeus/XEH_PREP.hpp b/addons/zeus/XEH_PREP.hpp index c92c98b2114..3398dfc1570 100644 --- a/addons/zeus/XEH_PREP.hpp +++ b/addons/zeus/XEH_PREP.hpp @@ -8,11 +8,11 @@ PREP(bi_moduleRemoteControl); PREP(canCreateModule); PREP(getModuleDestination); PREP(handleZeusUnitAssigned); -PREP(moduleAddArsenal); PREP(moduleAddAceArsenal); +PREP(moduleAddArsenal); +PREP(moduleAddOrRemoveFRIES); PREP(moduleAddSpareTrack); PREP(moduleAddSpareWheel); -PREP(moduleAddOrRemoveFRIES); PREP(moduleBurn); PREP(moduleCaptive); PREP(moduleCargoParadrop); @@ -22,13 +22,14 @@ PREP(moduleGlobalSetSkill); PREP(moduleGroupSide); PREP(moduleHeal); PREP(moduleLoadIntoCargo); -PREP(moduleRemoveArsenal); +PREP(moduleMedicalMenu); PREP(moduleRemoveAceArsenal); +PREP(moduleRemoveArsenal); PREP(moduleSearchNearby); PREP(moduleSetEngineer); PREP(moduleSetMedic); -PREP(moduleSetMedicalVehicle); PREP(moduleSetMedicalFacility); +PREP(moduleSetMedicalVehicle); PREP(moduleSetRepairFacility); PREP(moduleSetRepairVehicle); PREP(moduleSimulation); diff --git a/addons/zeus/config.cpp b/addons/zeus/config.cpp index fba513760e9..661bfbe3c19 100644 --- a/addons/zeus/config.cpp +++ b/addons/zeus/config.cpp @@ -49,7 +49,8 @@ class CfgPatches { QGVAR(moduleUnconscious), QGVAR(moduleSetMedic), QGVAR(moduleSetMedicalVehicle), - QGVAR(moduleSetMedicalFacility) + QGVAR(moduleSetMedicalFacility), + QGVAR(moduleMedicalMenu) }; }; class GVAR(cargo): ADDON { diff --git a/addons/zeus/functions/fnc_moduleMedicalMenu.sqf b/addons/zeus/functions/fnc_moduleMedicalMenu.sqf new file mode 100644 index 00000000000..83242aacf2d --- /dev/null +++ b/addons/zeus/functions/fnc_moduleMedicalMenu.sqf @@ -0,0 +1,38 @@ +#include "script_component.hpp" +/* + * Author: BaerMitUmlaut + * Inflames a unit. + * + * Arguments: + * 0: The module logic + * + * Return Value: + * None + * + * Example: + * [LOGIC] call ace_zeus_fnc_moduleBurn + * + * Public: No + */ + +params ["_logic"]; + +if !(local _logic) exitWith {}; + +private _unit = attachedTo _logic; +deleteVehicle _logic; + +switch (false) do { + case !(isNull _unit): { + [LSTRING(NothingSelected)] call FUNC(showMessage); + }; + case (_unit isKindOf "CAManBase"): { + [LSTRING(OnlyInfantry)] call FUNC(showMessage); + }; + case (["ace_medical_gui"] call EFUNC(common,isModLoaded)): { + [LSTRING(RequiresAddon)] call FUNC(showMessage); + }; + default { + [_unit] call EFUNC(medical_gui,openMenu); + }; +}; diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 1e84c3fc6ce..c4f09711538 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -1931,5 +1931,21 @@ Podpal Jednostkę ユニットを燃やす + + Medical Menu + Sanitätsmenü + Menu medyczne + Menu Médico + Медицинское меню + Menú médico + Zdravotnická nabídka + Menù Medico + Menu médical + 治療メニュー + 의료 메뉴 + 医疗菜单 + 醫療選單 + Medikal Menü + From 553ebef639d115719abaf30ff7aa2e0f4f161921 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 31 Aug 2022 01:24:05 -0600 Subject: [PATCH 02/11] fix function header --- addons/zeus/functions/fnc_moduleMedicalMenu.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/zeus/functions/fnc_moduleMedicalMenu.sqf b/addons/zeus/functions/fnc_moduleMedicalMenu.sqf index 83242aacf2d..778cb75df0a 100644 --- a/addons/zeus/functions/fnc_moduleMedicalMenu.sqf +++ b/addons/zeus/functions/fnc_moduleMedicalMenu.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* - * Author: BaerMitUmlaut - * Inflames a unit. + * Author: Brett Mayson + * Opens the medical menu for the unit * * Arguments: * 0: The module logic @@ -10,7 +10,7 @@ * None * * Example: - * [LOGIC] call ace_zeus_fnc_moduleBurn + * [LOGIC] call ace_zeus_fnc_moduleMedicalMenu * * Public: No */ From ea0540c38778f97649dfb5bd6170a2c808c65c86 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 31 Aug 2022 18:54:58 -0600 Subject: [PATCH 03/11] Zeus can use every action, add room for more buttons in medical menu --- addons/medical_gui/gui.hpp | 22 ++++++---- addons/medical_gui/script_component.hpp | 4 +- .../functions/fnc_canTreat.sqf | 40 +++++++++++-------- .../functions/fnc_useItem.sqf | 4 ++ 4 files changed, 45 insertions(+), 25 deletions(-) diff --git a/addons/medical_gui/gui.hpp b/addons/medical_gui/gui.hpp index 6aa6c7d3541..c79fd66cf5d 100644 --- a/addons/medical_gui/gui.hpp +++ b/addons/medical_gui/gui.hpp @@ -87,9 +87,9 @@ class GVAR(BodyImage): RscControlsGroupNoScrollbars { class GVAR(TriageToggle): RscButton { idc = -1; onButtonClick = QUOTE([ctrlParent (_this select 0)] call FUNC(toggleTriageSelect)); - x = POS_X(13.33); + x = POS_X(15.495); y = POS_Y(15.5); - w = POS_W(12.33); + w = POS_W(8); h = POS_H(1.1); colorFocused[] = {0, 0, 0, 0}; colorBackground[] = {0, 0, 0, 0}; @@ -98,9 +98,9 @@ class GVAR(TriageToggle): RscButton { class GVAR(TriageSelect): RscControlsGroupNoScrollbars { idc = IDC_TRIAGE_SELECT; - x = POS_X(13.33); + x = POS_X(15.495); y = POS_Y(16.6); - w = POS_W(12.33); + w = POS_W(8); h = POS_H(5.5); class controls { class None: RscButton { @@ -110,7 +110,7 @@ class GVAR(TriageSelect): RscControlsGroupNoScrollbars { text = ECSTRING(medical_treatment,Triage_Status_None); x = 0; y = 0; - w = POS_W(12.33); + w = POS_W(8); h = POS_H(1.1); shadow = 0; colorText[] = {TRIAGE_TEXT_COLOR_NONE}; @@ -339,6 +339,14 @@ class ACE_Medical_Menu { idc = IDC_ACTION_9; y = POS_Y(13.2); }; + class Action10: Action1 { + idc = IDC_ACTION_10; + y = POS_Y(14.3); + }; + class Action11: Action1 { + idc = IDC_ACTION_11; + y = POS_Y(15.4); + }; class BodyImage: GVAR(BodyImage) {}; class SelectHead: RscButton { idc = -1; @@ -420,9 +428,9 @@ class ACE_Medical_Menu { class TriageStatus: RscText { idc = IDC_TRIAGE_STATUS; style = ST_CENTER; - x = POS_X(13.33); + x = POS_X(15.495); y = POS_Y(15.5); - w = POS_W(12.33); + w = POS_W(8); h = POS_H(1.1); shadow = 0; }; diff --git a/addons/medical_gui/script_component.hpp b/addons/medical_gui/script_component.hpp index 48382ed6fa0..a247131797e 100644 --- a/addons/medical_gui/script_component.hpp +++ b/addons/medical_gui/script_component.hpp @@ -60,8 +60,10 @@ #define IDC_ACTION_7 1560 #define IDC_ACTION_8 1570 #define IDC_ACTION_9 1580 +#define IDC_ACTION_10 1590 +#define IDC_ACTION_11 1600 -#define IDCS_ACTION_BUTTONS [IDC_ACTION_1, IDC_ACTION_2, IDC_ACTION_3, IDC_ACTION_4, IDC_ACTION_5, IDC_ACTION_6, IDC_ACTION_7, IDC_ACTION_8, IDC_ACTION_9] +#define IDCS_ACTION_BUTTONS [IDC_ACTION_1, IDC_ACTION_2, IDC_ACTION_3, IDC_ACTION_4, IDC_ACTION_5, IDC_ACTION_6, IDC_ACTION_7, IDC_ACTION_8, IDC_ACTION_9, IDC_ACTION_10, IDC_ACTION_11] #define IDC_BODY_GROUP 6000 #define IDC_BODY_HEAD 6005 diff --git a/addons/medical_treatment/functions/fnc_canTreat.sqf b/addons/medical_treatment/functions/fnc_canTreat.sqf index f7790e548da..bb1549c1090 100644 --- a/addons/medical_treatment/functions/fnc_canTreat.sqf +++ b/addons/medical_treatment/functions/fnc_canTreat.sqf @@ -20,19 +20,23 @@ params ["_medic", "_patient", "_bodyPart", "_classname"]; +private _skipForZeus = (_medic isEqualTo player && {!isNull findDisplay 312}); + private _config = configFile >> QGVAR(actions) >> _classname; isClass _config && {_patient isKindOf "CAManBase"} -&& {_medic != _patient || {GET_NUMBER_ENTRY(_config >> "allowSelfTreatment") == 1}} -&& {[_medic, GET_NUMBER_ENTRY(_config >> "medicRequired")] call FUNC(isMedic)} -&& {[_medic, _patient, _config] call FUNC(canTreat_holsterCheck)} +&& {_skipForZeus || {_medic != _patient || {GET_NUMBER_ENTRY(_config >> "allowSelfTreatment") == 1}}} +&& {_skipForZeus || {[_medic, GET_NUMBER_ENTRY(_config >> "medicRequired")] call FUNC(isMedic)}} +&& {_skipForZeus || {[_medic, _patient, _config] call FUNC(canTreat_holsterCheck)}} && { private _selections = getArray (_config >> "allowedSelections") apply {toLower _x}; "all" in _selections || {_bodyPart in _selections} } && { - private _items = getArray (_config >> "items"); - _items isEqualTo [] || {[_medic, _patient, _items] call FUNC(hasItem)} + _skipForZeus || { + private _items = getArray (_config >> "items"); + _items isEqualTo [] || {[_medic, _patient, _items] call FUNC(hasItem)} + } } && { GET_FUNCTION(_condition,_config >> "condition"); @@ -46,17 +50,19 @@ isClass _config _condition } && { - switch (GET_NUMBER_ENTRY(_config >> "treatmentLocations")) do { - case TREATMENT_LOCATIONS_ALL: {true}; - case TREATMENT_LOCATIONS_VEHICLES: { - IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)} - }; - case TREATMENT_LOCATIONS_FACILITIES: { - IN_MED_FACILITY(_medic) || {IN_MED_FACILITY(_patient)} + _skipForZeus || { + switch (GET_NUMBER_ENTRY(_config >> "treatmentLocations")) do { + case TREATMENT_LOCATIONS_ALL: {true}; + case TREATMENT_LOCATIONS_VEHICLES: { + IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)} + }; + case TREATMENT_LOCATIONS_FACILITIES: { + IN_MED_FACILITY(_medic) || {IN_MED_FACILITY(_patient)} + }; + case TREATMENT_LOCATIONS_VEHICLES_AND_FACILITIES: { + IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)} || {IN_MED_FACILITY(_medic)} || {IN_MED_FACILITY(_patient)} + }; + default {false}; }; - case TREATMENT_LOCATIONS_VEHICLES_AND_FACILITIES: { - IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)} || {IN_MED_FACILITY(_medic)} || {IN_MED_FACILITY(_patient)} - }; - default {false}; - }; + } } diff --git a/addons/medical_treatment/functions/fnc_useItem.sqf b/addons/medical_treatment/functions/fnc_useItem.sqf index 5425e0848c7..2460b8247e8 100644 --- a/addons/medical_treatment/functions/fnc_useItem.sqf +++ b/addons/medical_treatment/functions/fnc_useItem.sqf @@ -19,6 +19,10 @@ params ["_medic", "_patient", "_items"]; +if (_medic isEqualTo player && {!isNull findDisplay 312}) exitWith { + [_medic, _items select 0] +}; + scopeName "Main"; private _useOrder = [[_patient, _medic], [_medic, _patient], [_medic]] select GVAR(allowSharedEquipment); From de7006b9b2f4351af147923febbbd8ef730f9cde Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Wed, 31 Aug 2022 18:56:00 -0600 Subject: [PATCH 04/11] Update addons/medical_treatment/functions/fnc_treatment.sqf --- addons/medical_treatment/functions/fnc_treatment.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_treatment.sqf b/addons/medical_treatment/functions/fnc_treatment.sqf index 0444f47d943..7147425a16c 100644 --- a/addons/medical_treatment/functions/fnc_treatment.sqf +++ b/addons/medical_treatment/functions/fnc_treatment.sqf @@ -54,7 +54,7 @@ private _userAndItem = if (GET_NUMBER_ENTRY(_config >> "consumeItem") == 1) then _userAndItem params ["_itemUser", "_usedItem"]; -if !(_medic isEqualTo player && {!isNull findDisplay 312}) then { +if (_medic isNotEqualTo player || {isNull findDisplay 312}) then { // Get treatment animation for the medic private _medicAnim = if (_medic isEqualTo _patient) then { getText (_config >> ["animationMedicSelf", "animationMedicSelfProne"] select (stance _medic == "PRONE")); From 32af647e3ac673b0a8289bd3e18a10ccee4c7475 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Wed, 6 Sep 2023 21:01:40 +0200 Subject: [PATCH 05/11] Added zeus treatment time coeff --- .../medical_gui/functions/fnc_canOpenMenu.sqf | 17 +++++++++++------ .../medical_gui/functions/fnc_handleToggle.sqf | 3 +++ addons/medical_gui/functions/fnc_menuPFH.sqf | 5 ++++- addons/medical_treatment/initSettings.sqf | 8 ++++++++ addons/medical_treatment/stringtable.xml | 6 ++++++ 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/addons/medical_gui/functions/fnc_canOpenMenu.sqf b/addons/medical_gui/functions/fnc_canOpenMenu.sqf index 08747647b73..a9612e5eb3e 100644 --- a/addons/medical_gui/functions/fnc_canOpenMenu.sqf +++ b/addons/medical_gui/functions/fnc_canOpenMenu.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" /* - * Author: Glowbal, mharis001 + * Author: Glowbal, mharis001, johnb43 * Checks if the player can open the Medical Menu for the target. * * Arguments: @@ -18,8 +18,13 @@ params ["_player", "_target"]; -alive _player -&& {!IS_UNCONSCIOUS(_player)} -&& {!isNull _target} -&& {_player distance _target < GVAR(maxDistance) || {vehicle _player == vehicle _target} || {!isNull findDisplay 312}} -&& {GVAR(enableMedicalMenu) == 1 || {GVAR(enableMedicalMenu) == 2 && {vehicle _player != _player || {vehicle _target != _target}}}} +// If in Zeus +if (!isNull findDisplay 312) exitWith { + !isNull _target && + GVAR(enableMedicalMenu) > 0 +}; + +_player call EFUNC(common,isAwake) && +{!isNull _target} && +{_player distance _target < GVAR(maxDistance) || {vehicle _player == vehicle _target}} && +{GVAR(enableMedicalMenu) == 1 || {GVAR(enableMedicalMenu) == 2 && {vehicle _player != _player || {vehicle _target != _target}}}} diff --git a/addons/medical_gui/functions/fnc_handleToggle.sqf b/addons/medical_gui/functions/fnc_handleToggle.sqf index c2634affdbe..1f9efb0abff 100644 --- a/addons/medical_gui/functions/fnc_handleToggle.sqf +++ b/addons/medical_gui/functions/fnc_handleToggle.sqf @@ -15,6 +15,9 @@ * Public: No */ + // If in Zeus, ignore + if (!isNull findDisplay 312) exitWith {}; + // Find new target to switch to private _target = if ( GVAR(target) == ACE_player diff --git a/addons/medical_gui/functions/fnc_menuPFH.sqf b/addons/medical_gui/functions/fnc_menuPFH.sqf index a653fc4c62c..5703882cdd3 100644 --- a/addons/medical_gui/functions/fnc_menuPFH.sqf +++ b/addons/medical_gui/functions/fnc_menuPFH.sqf @@ -16,7 +16,10 @@ */ // Check if menu should stay open for target -if !([ACE_player, GVAR(target), ["isNotInside", "isNotSwimming", "isNotInZeus"]] call EFUNC(common,canInteractWith) && {[ACE_player, GVAR(target)] call FUNC(canOpenMenu)}) then { +if !( + ([ACE_player, GVAR(target), ["isNotInside", "isNotSwimming"]] call EFUNC(common,canInteractWith) || {!isNull findDisplay 312}) && // Allow player to look at himself when unconsious and in Zeus + {[ACE_player, GVAR(target)] call FUNC(canOpenMenu)} +) then { closeDialog 0; // Show hint if distance condition failed if ((ACE_player distance GVAR(target) > GVAR(maxDistance)) && {vehicle ACE_player != vehicle GVAR(target)}) then { diff --git a/addons/medical_treatment/initSettings.sqf b/addons/medical_treatment/initSettings.sqf index f66868aac97..f658a036bf6 100644 --- a/addons/medical_treatment/initSettings.sqf +++ b/addons/medical_treatment/initSettings.sqf @@ -287,6 +287,14 @@ true ] call CBA_fnc_addSetting; +[ + QGVAR(treatmentTimeCoeffZeus), + "SLIDER", + [LSTRING(TreatmentTimeCoeffZeus_DisplayName), LSTRING(TreatmentTimeCoeffZeus_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [0, 10, 1, 2] +] call CBA_fnc_addSetting; + [ QGVAR(holsterRequired), "LIST", diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index 051b0e6d009..59f1ba8817d 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -4686,5 +4686,11 @@ 身体抽搐了一下,可能还没死! 꿈틀대는걸 보니 죽은 것 같지는 않습니다! + + Zeus treatment time coefficient + + + Multiply all treatment times with this coefficient when in Zeus. + From 7925c36807f14a9d37ced87caeac8470cb93f0de Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 9 Sep 2023 04:40:42 -0700 Subject: [PATCH 06/11] Update addons/medical_gui/functions/fnc_canOpenMenu.sqf Co-authored-by: PabstMirror --- addons/medical_gui/functions/fnc_canOpenMenu.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_gui/functions/fnc_canOpenMenu.sqf b/addons/medical_gui/functions/fnc_canOpenMenu.sqf index a9612e5eb3e..b21057459f6 100644 --- a/addons/medical_gui/functions/fnc_canOpenMenu.sqf +++ b/addons/medical_gui/functions/fnc_canOpenMenu.sqf @@ -20,7 +20,7 @@ params ["_player", "_target"]; // If in Zeus if (!isNull findDisplay 312) exitWith { - !isNull _target && + !isNull _target && {missionNamespace getVariable [QGVAR(enableZeusModule), true]} && GVAR(enableMedicalMenu) > 0 }; From 15fcd2c4ad1e5395fb4c5292ff73ceb049814e15 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 9 Sep 2023 13:41:59 +0200 Subject: [PATCH 07/11] Update fnc_canOpenMenu.sqf --- addons/medical_gui/functions/fnc_canOpenMenu.sqf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/medical_gui/functions/fnc_canOpenMenu.sqf b/addons/medical_gui/functions/fnc_canOpenMenu.sqf index b21057459f6..5751b687689 100644 --- a/addons/medical_gui/functions/fnc_canOpenMenu.sqf +++ b/addons/medical_gui/functions/fnc_canOpenMenu.sqf @@ -20,8 +20,9 @@ params ["_player", "_target"]; // If in Zeus if (!isNull findDisplay 312) exitWith { - !isNull _target && {missionNamespace getVariable [QGVAR(enableZeusModule), true]} && - GVAR(enableMedicalMenu) > 0 + !isNull _target && + {missionNamespace getVariable [QGVAR(enableZeusModule), true]} && + {GVAR(enableMedicalMenu) > 0} }; _player call EFUNC(common,isAwake) && From 78c0aa1e8be6083ae1218e07fcc5ed0f26314e78 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Tue, 3 Oct 2023 08:44:19 +0200 Subject: [PATCH 08/11] Update initSettings.sqf --- addons/medical_treatment/initSettings.sqf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/medical_treatment/initSettings.sqf b/addons/medical_treatment/initSettings.sqf index 9a0bcf73b3c..083468b14fe 100644 --- a/addons/medical_treatment/initSettings.sqf +++ b/addons/medical_treatment/initSettings.sqf @@ -296,6 +296,14 @@ true ] call CBA_fnc_addSetting; +[ + QGVAR(treatmentTimeCoeffZeus), + "SLIDER", + [LSTRING(TreatmentTimeCoeffZeus_DisplayName), LSTRING(TreatmentTimeCoeffZeus_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [0, 10, 1, 2] +] call CBA_fnc_addSetting; + [ QGVAR(allowBodyBagUnconscious), "CHECKBOX", @@ -305,14 +313,6 @@ true ] call CBA_fnc_addSetting; -[ - QGVAR(treatmentTimeCoeffZeus), - "SLIDER", - [LSTRING(TreatmentTimeCoeffZeus_DisplayName), LSTRING(TreatmentTimeCoeffZeus_Description)], - [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], - [0, 10, 1, 2] -] call CBA_fnc_addSetting; - [ QGVAR(holsterRequired), "LIST", From 9030d0049591a3ad0eae8a016c30118c6e22d0ca Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Tue, 3 Oct 2023 08:47:37 +0200 Subject: [PATCH 09/11] Update fnc_moduleMedicalMenu.sqf --- addons/zeus/functions/fnc_moduleMedicalMenu.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/zeus/functions/fnc_moduleMedicalMenu.sqf b/addons/zeus/functions/fnc_moduleMedicalMenu.sqf index 778cb75df0a..9a34c5d76c9 100644 --- a/addons/zeus/functions/fnc_moduleMedicalMenu.sqf +++ b/addons/zeus/functions/fnc_moduleMedicalMenu.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: Brett Mayson * Opens the medical menu for the unit From 04a130e28160ee9b242ac49ae67ae9c75841a395 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:26:23 +0100 Subject: [PATCH 10/11] Added check + documentation --- addons/zeus/functions/fnc_moduleMedicalMenu.sqf | 3 +++ addons/zeus/stringtable.xml | 3 +++ docs/wiki/framework/medical-treatment-framework.md | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/addons/zeus/functions/fnc_moduleMedicalMenu.sqf b/addons/zeus/functions/fnc_moduleMedicalMenu.sqf index 9a34c5d76c9..a69a65fb742 100644 --- a/addons/zeus/functions/fnc_moduleMedicalMenu.sqf +++ b/addons/zeus/functions/fnc_moduleMedicalMenu.sqf @@ -32,6 +32,9 @@ switch (false) do { case (["ace_medical_gui"] call EFUNC(common,isModLoaded)): { [LSTRING(RequiresAddon)] call FUNC(showMessage); }; + case ([objNull, _unit] call EFUNC(medical_gui,canOpenMenu)): { + [LSTRING(MedicalMenuDisabled)] call FUNC(showMessage); + }; default { [_unit] call EFUNC(medical_gui,openMenu); }; diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 9597ec49597..bf8e511fdb1 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -1949,6 +1949,9 @@ 醫療選單 Medikal Menü + + The medical menu is disabled + Lay Trenchline diff --git a/docs/wiki/framework/medical-treatment-framework.md b/docs/wiki/framework/medical-treatment-framework.md index ca10a9878ad..e42cb21e3bc 100644 --- a/docs/wiki/framework/medical-treatment-framework.md +++ b/docs/wiki/framework/medical-treatment-framework.md @@ -70,3 +70,8 @@ The object's rotation can also be modified, if necessary. ```sqf ace_medical_treatment_graveRotation = 0; // rotation angle (will depend on model classname) ``` + +### 2.2 Zeus Medical Menu Module + +If a mission maker wishes to disable Zeus access to the medical menu, they can set the variable below: +ace_medical_gui_enableZeusModule = false; // default is true From 1fa82aff90a68b86bbb9f9d2f9e26bc7430a2675 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 11 Nov 2023 11:38:03 +0100 Subject: [PATCH 11/11] Update fnc_canTreat.sqf --- .../functions/fnc_canTreat.sqf | 64 ++++++++++--------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_canTreat.sqf b/addons/medical_treatment/functions/fnc_canTreat.sqf index 700ac42aabb..995965dfe5c 100644 --- a/addons/medical_treatment/functions/fnc_canTreat.sqf +++ b/addons/medical_treatment/functions/fnc_canTreat.sqf @@ -10,7 +10,7 @@ * 3: Treatment * * Return Value: - * Can Treat + * Can treat * * Example: * [player, cursorObject, "Head", "SurgicalKit"] call ace_medical_treatment_fnc_canTreat @@ -20,23 +20,16 @@ params ["_medic", "_patient", "_bodyPart", "_classname"]; -private _skipForZeus = (_medic isEqualTo player && {!isNull findDisplay 312}); - private _config = configFile >> QGVAR(actions) >> _classname; -isClass _config -&& {_patient isKindOf "CAManBase"} -&& {_skipForZeus || {_medic != _patient || {GET_NUMBER_ENTRY(_config >> "allowSelfTreatment") == 1}}} -&& {_skipForZeus || {[_medic, GET_NUMBER_ENTRY(_config >> "medicRequired")] call FUNC(isMedic)}} -&& {_skipForZeus || {[_medic, _patient, _config] call FUNC(canTreat_holsterCheck)}} -&& { +// Conditions that apply, regardless of curator status +( + isClass _config +) && { + _patient isKindOf "CAManBase" +} && { private _selections = getArray (_config >> "allowedSelections") apply {toLower _x}; "all" in _selections || {_bodyPart in _selections} -} && { - _skipForZeus || { - private _items = getArray (_config >> "items"); - _items isEqualTo [] || {[_medic, _patient, _items] call FUNC(hasItem)} - } } && { GET_FUNCTION(_condition,_config >> "condition"); @@ -50,21 +43,34 @@ isClass _config _condition } && { - _skipForZeus || { - switch (GET_NUMBER_ENTRY(_config >> "treatmentLocations")) do { - case TREATMENT_LOCATIONS_ALL: {true}; - case TREATMENT_LOCATIONS_VEHICLES: { - IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)} + // If in Zeus, the rest of the condition checks can be omitted + (_medic isEqualTo player && {!isNull findDisplay 312}) || { + // Conditions that apply when not in Zeus + ( + _medic != _patient || {GET_NUMBER_ENTRY(_config >> "allowSelfTreatment") == 1} + ) && { + [_medic, GET_NUMBER_ENTRY(_config >> "medicRequired")] call FUNC(isMedic) + } && { + [_medic, _patient, _config] call FUNC(canTreat_holsterCheck) + } && { + private _items = getArray (_config >> "items"); + _items isEqualTo [] || {[_medic, _patient, _items] call FUNC(hasItem)} + } && { + switch (GET_NUMBER_ENTRY(_config >> "treatmentLocations")) do { + case TREATMENT_LOCATIONS_ALL: {true}; + case TREATMENT_LOCATIONS_VEHICLES: { + IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)} + }; + case TREATMENT_LOCATIONS_FACILITIES: { + IN_MED_FACILITY(_medic) || {IN_MED_FACILITY(_patient)} + }; + case TREATMENT_LOCATIONS_VEHICLES_AND_FACILITIES: { + IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)} || {IN_MED_FACILITY(_medic)} || {IN_MED_FACILITY(_patient)} + }; + default {false}; }; - case TREATMENT_LOCATIONS_FACILITIES: { - IN_MED_FACILITY(_medic) || {IN_MED_FACILITY(_patient)} - }; - case TREATMENT_LOCATIONS_VEHICLES_AND_FACILITIES: { - IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)} || {IN_MED_FACILITY(_medic)} || {IN_MED_FACILITY(_patient)} - }; - default {false}; - }; + } && { + !(_medic call EFUNC(common,isSwimming)) || {getNumber (_config >> "allowedUnderwater") == 1} + } } -} && { - _skipForZeus || {((getNumber (_config >> "allowedUnderwater")) == 1) || {!([_medic] call EFUNC(common,isSwimming))}} }