mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #849 from acemod/menuonclick
add option to only use action when clicking
This commit is contained in:
commit
bc0d95765a
@ -34,8 +34,7 @@ addMissionEventHandler ["Draw3D", DFUNC(render)];
|
||||
if !([ACE_player, objNull, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Statement
|
||||
[0] call FUNC(keyDown)
|
||||
},
|
||||
{[0] call FUNC(keyUp)},
|
||||
},{[0,false] call FUNC(keyUp)},
|
||||
[219, [false, false, false]], false] call cba_fnc_addKeybind; //Left Windows Key
|
||||
|
||||
["ACE3", QGVAR(SelfInteractKey), (localize "STR_ACE_Interact_Menu_SelfInteractKey"),
|
||||
@ -44,8 +43,7 @@ addMissionEventHandler ["Draw3D", DFUNC(render)];
|
||||
if !([ACE_player, objNull, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Statement
|
||||
[1] call FUNC(keyDown)
|
||||
},
|
||||
{[1] call FUNC(keyUp)},
|
||||
},{[1,false] call FUNC(keyUp)},
|
||||
[219, [false, true, false]], false] call cba_fnc_addKeybind; //Left Windows Key + Ctrl/Strg
|
||||
|
||||
|
||||
|
@ -49,25 +49,31 @@ class ACE_Settings {
|
||||
typeName = "COLOR";
|
||||
isClientSettable = 1;
|
||||
displayName = "$STR_ACE_Interact_Menu_ColorTextMax";
|
||||
};
|
||||
};
|
||||
class GVAR(colorTextMin) {
|
||||
value[] = {1, 1, 1, 0.25};
|
||||
typeName = "COLOR";
|
||||
isClientSettable = 1;
|
||||
displayName = "$STR_ACE_Interact_Menu_ColorTextMin";
|
||||
};
|
||||
};
|
||||
class GVAR(colorShadowMax) {
|
||||
value[] = {0, 0, 0, 1};
|
||||
typeName = "COLOR";
|
||||
isClientSettable = 1;
|
||||
displayName = "$STR_ACE_Interact_Menu_ColorShadowMax";
|
||||
};
|
||||
};
|
||||
class GVAR(colorShadowMin) {
|
||||
value[] = {0, 0, 0, 0.25};
|
||||
typeName = "COLOR";
|
||||
isClientSettable = 1;
|
||||
displayName = "$STR_ACE_Interact_Menu_ColorShadowMin";
|
||||
};
|
||||
class GVAR(actionOnKeyRelease) {
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
isClientSettable = 1;
|
||||
displayName = "$STR_ACE_Interact_Menu_ActionOnKeyRelease";
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_Extensions {
|
||||
|
@ -15,7 +15,11 @@ EXPLODE_2_PVT(_this,_newUnit,_oldUnit);
|
||||
|
||||
// add to new unit
|
||||
private "_ehid";
|
||||
_ehid = [_newUnit, "DefaultAction", {EGVAR(interact_menu,openedMenuType) >= 0}, {}] call EFUNC(common,addActionEventHandler);
|
||||
_ehid = [_newUnit, "DefaultAction", {GVAR(openedMenuType) >= 0}, {
|
||||
if !(GVAR(actionOnKeyRelease)) then {
|
||||
[GVAR(openedMenuType),true] call FUNC(keyUp);
|
||||
};
|
||||
}] call EFUNC(common,addActionEventHandler);
|
||||
|
||||
_newUnit setVariable [QGVAR(AAEHID), _ehid];
|
||||
|
||||
|
@ -52,6 +52,12 @@ if (GVAR(useCursorMenu)) then {
|
||||
GVAR(cursorPos) = [_this select 1, _this select 2, 0];
|
||||
};
|
||||
}];
|
||||
// handles LMB in cursor mode when action on keyrelease is disabled
|
||||
((finddisplay 91919) displayctrl 91921) ctrlAddEventHandler ["MouseButtonDown", {
|
||||
if !(GVAR(actionOnKeyRelease)) then {
|
||||
[GVAR(openedMenuType),true] call FUNC(keyUp);
|
||||
};
|
||||
}];
|
||||
setMousePosition [0.5, 0.5];
|
||||
};
|
||||
|
||||
|
@ -12,6 +12,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_calledByClicking";
|
||||
_calledByClicking = _this select 1;
|
||||
|
||||
// Exit if there's no menu opened
|
||||
if (GVAR(openedMenuType) < 0) exitWith {true};
|
||||
|
||||
@ -29,6 +32,9 @@ if(GVAR(actionSelected)) then {
|
||||
// Clear the conditions caches
|
||||
["clearConditionCaches", []] call EFUNC(common,localEvent);
|
||||
|
||||
// exit scope if selecting an action on key release is disabled
|
||||
if (!(GVAR(actionOnKeyRelease)) && !_calledByClicking) exitWith {};
|
||||
|
||||
// Check the action conditions
|
||||
_actionData = GVAR(selectedAction) select 0;
|
||||
if ([_target, _player, _actionData select 6] call (_actionData select 4)) then {
|
||||
|
@ -121,5 +121,9 @@
|
||||
<French>Garde le curseur au milieu et dispose le menu des options autour. Utile si la taille de l'écran est limitée.</French>
|
||||
<Russian>Центрирует курсор и двигает само меню опций. Полезно при ограниченном размере экрана.</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Interact_Menu_ActionOnKeyRelease">
|
||||
<English>Do action when releasing menu key</English>
|
||||
<German>Aktion nach Loslassen der Taste ausführen</German>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user