add option to only use action when clicking

This commit is contained in:
commy2 2015-04-25 08:23:54 +02:00
parent e207a11851
commit 664d08d4aa
5 changed files with 27 additions and 9 deletions

View File

@ -32,8 +32,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"),
@ -42,8 +41,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

View File

@ -61,6 +61,12 @@ class ACE_Settings {
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 {

View File

@ -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];

View File

@ -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 {

View File

@ -83,5 +83,9 @@
<Key ID="STR_ACE_Interact_Menu_ColorShadowMin">
<English>Interaction - Shadow Min</English>
</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>