From d6a293c573e61f8702f404491b243da00b18a8f9 Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 15 Apr 2015 05:19:03 +0200 Subject: [PATCH 1/4] disable firing if menu is opened --- addons/interaction/XEH_postInit.sqf | 3 ++ addons/interaction/XEH_preInit.sqf | 1 + .../functions/fnc_handlePlayerChanged.sqf | 31 +++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 addons/interaction/functions/fnc_handlePlayerChanged.sqf diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 98b1cc1523..dc019b101f 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -74,3 +74,6 @@ GVAR(isOpeningDoor) = false; [29, [false, false, false]], false] call cba_fnc_addKeybind; ["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithCondition); + +// disable firing while the interact menu is is is opened +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventHandler); diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index 6f10a4e834..f6d742f419 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -14,6 +14,7 @@ PREP(getDoor); PREP(getDoorAnimations); PREP(getDown); PREP(getSelectedButton); +PREP(handlePlayerChanged); PREP(hideMenu); PREP(hideMouseHint); PREP(isInRange); diff --git a/addons/interaction/functions/fnc_handlePlayerChanged.sqf b/addons/interaction/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..0e16d5db9e --- /dev/null +++ b/addons/interaction/functions/fnc_handlePlayerChanged.sqf @@ -0,0 +1,31 @@ +/* + * Author: commy2 + * + * Disables firing while the menu is opened. Called from playerChanged eh. + * + * Argument: + * 0: New unit to add the addAction eh (Object) + * 1: Old unit to remove the addAction eh (String) + * + * Return value: + * NOPE + */ +#include "script_component.hpp" + +private ["_newUnit", "_oldUnit"]; + +_newUnit = _this select 0; +_oldUnit = _this select 1; + +// add to new unit +private "_ehid"; +_ehid = [_newUnit, "DefaultAction", {EGVAR(interact_menu,openedMenuType) >= 0}, {systemChat "snap"}] call EFUNC(common,addActionEventHandler); + +_newUnit setVariable [QGVAR(AAEHID), _ehid]; + +// remove from old unit +_ehid = _oldUnit getVariable [QGVAR(AAEHID), -1]; + +[_oldUnit, "DefaultAction", _ehid] call EFUNC(common,removeActionEventHandler); + +_oldUnit setVariable [QGVAR(AAEHID), -1]; From a9f44530c9f58cd24d1193f6172ed901d8a225f9 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Wed, 15 Apr 2015 01:20:20 -0300 Subject: [PATCH 2/4] Move the function that prevents firing while the interact_menu is open to the interact_menu pbo --- addons/interact_menu/XEH_clientInit.sqf | 3 +++ addons/interact_menu/XEH_preInit.sqf | 1 + .../functions/fnc_handlePlayerChanged.sqf | 12 ++++-------- addons/interaction/XEH_postInit.sqf | 3 --- addons/interaction/XEH_preInit.sqf | 1 - 5 files changed, 8 insertions(+), 12 deletions(-) rename addons/{interaction => interact_menu}/functions/fnc_handlePlayerChanged.sqf (74%) diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index bcb2d5aa8e..ea4a971563 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -50,3 +50,6 @@ addMissionEventHandler ["Draw3D", DFUNC(render)]; GVAR(actionSelected) = false; [] call FUNC(keyUp); }] call EFUNC(common,addEventhandler); + +// disable firing while the interact menu is is is opened +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventHandler); diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index c15f8d388d..b4a3504cdd 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -9,6 +9,7 @@ PREP(compileMenuSelfAction); PREP(collectActiveActionTree); PREP(createAction); PREP(findActionNode); +PREP(handlePlayerChanged); PREP(isSubPath); PREP(keyDown); PREP(keyUp); diff --git a/addons/interaction/functions/fnc_handlePlayerChanged.sqf b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf similarity index 74% rename from addons/interaction/functions/fnc_handlePlayerChanged.sqf rename to addons/interact_menu/functions/fnc_handlePlayerChanged.sqf index 0e16d5db9e..bb5c3afb53 100644 --- a/addons/interaction/functions/fnc_handlePlayerChanged.sqf +++ b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf @@ -1,21 +1,17 @@ /* * Author: commy2 - * * Disables firing while the menu is opened. Called from playerChanged eh. * * Argument: - * 0: New unit to add the addAction eh (Object) - * 1: Old unit to remove the addAction eh (String) + * 0: New unit to add the addAction eh + * 1: Old unit to remove the addAction eh * * Return value: - * NOPE + * None */ #include "script_component.hpp" -private ["_newUnit", "_oldUnit"]; - -_newUnit = _this select 0; -_oldUnit = _this select 1; +EXPLODE_2_PVT(_this,_newUnit,_oldUnit); // add to new unit private "_ehid"; diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index dc019b101f..98b1cc1523 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -74,6 +74,3 @@ GVAR(isOpeningDoor) = false; [29, [false, false, false]], false] call cba_fnc_addKeybind; ["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithCondition); - -// disable firing while the interact menu is is is opened -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventHandler); diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index f6d742f419..6f10a4e834 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -14,7 +14,6 @@ PREP(getDoor); PREP(getDoorAnimations); PREP(getDown); PREP(getSelectedButton); -PREP(handlePlayerChanged); PREP(hideMenu); PREP(hideMouseHint); PREP(isInRange); From 5faf4b7dfa55526b2d16a2437503d949961b55c9 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Wed, 15 Apr 2015 01:27:29 -0300 Subject: [PATCH 3/4] Remove comment --- addons/interact_menu/functions/fnc_handlePlayerChanged.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf index bb5c3afb53..fe25853733 100644 --- a/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf +++ b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf @@ -15,7 +15,7 @@ EXPLODE_2_PVT(_this,_newUnit,_oldUnit); // add to new unit private "_ehid"; -_ehid = [_newUnit, "DefaultAction", {EGVAR(interact_menu,openedMenuType) >= 0}, {systemChat "snap"}] call EFUNC(common,addActionEventHandler); +_ehid = [_newUnit, "DefaultAction", {EGVAR(interact_menu,openedMenuType) >= 0}, {}] call EFUNC(common,addActionEventHandler); _newUnit setVariable [QGVAR(AAEHID), _ehid]; From 25e8e93fd065ef4de50a8996b7008ed3d8bf95a0 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Wed, 15 Apr 2015 01:32:42 -0300 Subject: [PATCH 4/4] Add back stringtables for the list menu --- addons/interact_menu/stringtable.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml index bd8ded64ce..dddf90a4de 100644 --- a/addons/interact_menu/stringtable.xml +++ b/addons/interact_menu/stringtable.xml @@ -10,6 +10,10 @@ Zawsze wyświetlaj kursor dla własnej interakcji Toujours afficher le curseur pour les interactions sur soi-même + + Display interaction menus as lists + Mostrar los menus de interacción como listas + Interact Key Fremdinteraktionsmenü-Taste