From b907c9d5477f385a6ac67c7fc403edd45ffb8c13 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 1 Apr 2019 09:40:02 -0500 Subject: [PATCH] Medical - Add self interaction when needed (#6912) * Medical - Add self interaction when needed * Update addons/medical_gui/XEH_postInit.sqf Co-Authored-By: PabstMirror * Update addons/medical_gui/XEH_postInit.sqf Co-Authored-By: PabstMirror --- addons/medical_gui/XEH_postInit.sqf | 10 ++++++++++ .../medical_gui/functions/fnc_addTreatmentActions.sqf | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/addons/medical_gui/XEH_postInit.sqf b/addons/medical_gui/XEH_postInit.sqf index 8b17c090b2..c6dd4e2722 100644 --- a/addons/medical_gui/XEH_postInit.sqf +++ b/addons/medical_gui/XEH_postInit.sqf @@ -12,9 +12,19 @@ GVAR(pendingReopen) = false; GVAR(menuPFH) = -1; +GVAR(selfInteractionActions) = []; [] call FUNC(addTreatmentActions); [] call FUNC(collectActions); +[QEGVAR(interact_menu,newControllableObject), { + params ["_type"]; // string of the object's classname + if (!(_type isKindOf "CAManBase")) exitWith {}; + { + _x set [0, _type]; + _x call EFUNC(interact_menu,addActionToClass); + } forEach GVAR(selfInteractionActions); +}] call CBA_fnc_addEventHandler; + ["ace_treatmentSucceded", { if (GVAR(openAfterTreatment) && {GVAR(pendingReopen)}) then { GVAR(pendingReopen) = false; diff --git a/addons/medical_gui/functions/fnc_addTreatmentActions.sqf b/addons/medical_gui/functions/fnc_addTreatmentActions.sqf index 79dde30136..541c308ff0 100644 --- a/addons/medical_gui/functions/fnc_addTreatmentActions.sqf +++ b/addons/medical_gui/functions/fnc_addTreatmentActions.sqf @@ -10,7 +10,7 @@ * None * * Example: - * [] call ace_medical_gui_fnc_addInteractActions + * [] call ace_medical_gui_fnc_addTreatmentActions * * Public: No */ @@ -60,6 +60,6 @@ private _fnc_condition = { ["CAManBase", 0, [_actionPath], _action, true] call EFUNC(interact_menu,addActionToClass); ["CAManBase", 0, ["ACE_MainActions", "ACE_Medical_Radial", _actionPath], _action, true] call EFUNC(interact_menu,addActionToClass); - ["CAManBase", 1, ["ACE_SelfActions", "ACE_Medical", _actionPath], _action, true] call EFUNC(interact_menu,addActionToClass); + GVAR(selfInteractionActions) pushBack ["", 1, ["ACE_SelfActions", "ACE_Medical", _actionPath], _action]; } forEach _allowedBodyParts; } forEach configProperties [_actionsConfig, "isClass _x"];