From 3aab62fa7cca10836139b77f699316847f24323b Mon Sep 17 00:00:00 2001 From: nsgundy Date: Wed, 19 Aug 2015 15:32:46 -0300 Subject: [PATCH] Return true / false if event was handled so that CBA keybinding doesn't have a reason to complain. Converted tabs to spaces --- addons/medical_menu/XEH_postInit.sqf | 3 ++- .../medical_menu/functions/fnc_openMenu.sqf | 20 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/addons/medical_menu/XEH_postInit.sqf b/addons/medical_menu/XEH_postInit.sqf index a72c1a8887..eaf356f608 100644 --- a/addons/medical_menu/XEH_postInit.sqf +++ b/addons/medical_menu/XEH_postInit.sqf @@ -26,9 +26,10 @@ if (!hasInterface) exitwith {}; false }, { - if (ACE_time - GVAR(lastOpenedOn) > 0.5) then { + if (ACE_time - GVAR(lastOpenedOn) > 0.5) exitWith { [ObjNull] call FUNC(openMenu); }; + false }, [35, [false, false, false]], false, 0] call CBA_fnc_addKeybind; diff --git a/addons/medical_menu/functions/fnc_openMenu.sqf b/addons/medical_menu/functions/fnc_openMenu.sqf index 3bc67f0028..34a2da7fb9 100644 --- a/addons/medical_menu/functions/fnc_openMenu.sqf +++ b/addons/medical_menu/functions/fnc_openMenu.sqf @@ -6,7 +6,7 @@ * 0: Target * * Return Value: - * None + * If action was taken * * Example: * [some_player] call ace_medical_menu_openMenu @@ -18,16 +18,22 @@ params ["_interactionTarget"]; if (dialog || isNull _interactionTarget) exitwith { - disableSerialization; + disableSerialization; - private "_display"; - _display = uiNamespace getVariable QGVAR(medicalMenu); - if (!isNil "_display") then { - closeDialog 314412; - }; + private ["_display", "_handled"]; + _handled = false; + _display = uiNamespace getVariable QGVAR(medicalMenu); + if (!isNil "_display") then { + closeDialog 314412; + _handled = true; + }; + + _handled }; GVAR(INTERACTION_TARGET) = _interactionTarget; createDialog QGVAR(medicalMenu); GVAR(lastOpenedOn) = ACE_time; + +true \ No newline at end of file