From 5d21cd6cc78cf089946b25199efd51332253f511 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 5 Mar 2015 02:46:24 -0600 Subject: [PATCH] Fix Vector/FCS debounce --- addons/fcs/initKeybinds.sqf | 6 ++++++ addons/vector/initKeybinds.sqf | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/addons/fcs/initKeybinds.sqf b/addons/fcs/initKeybinds.sqf index 31fae97601..4ff92bdd14 100644 --- a/addons/fcs/initKeybinds.sqf +++ b/addons/fcs/initKeybinds.sqf @@ -8,12 +8,18 @@ // Conditions: specific if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false}; + if (GETGVAR(isDownStateKey1,false)) exitWith {false}; + GVAR(isDownStateKey1) = true; + // Statement [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyDown); // Return false so it doesn't block the rest weapon action false }, { + // prevent holding down + GVAR(isDownStateKey1) = false; + // Conditions: canInteract _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; diff --git a/addons/vector/initKeybinds.sqf b/addons/vector/initKeybinds.sqf index d9e9790127..a41c13c757 100644 --- a/addons/vector/initKeybinds.sqf +++ b/addons/vector/initKeybinds.sqf @@ -2,19 +2,24 @@ ["ACE3", QGVAR(AzimuthKey), localize "STR_ACE_Vector_AzimuthKey", { - systemChat format ["Down %1", diag_tickTime]; // Conditions: canInteract _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false}; + // prevent holding down + if (GETGVAR(isDownStateKey1,false)) exitWith {false}; + GVAR(isDownStateKey1) = true; + // Statement ["azimuth"] call FUNC(onKeyDown); true }, { - systemChat format ["Up %1", diag_tickTime]; + // prevent holding down + GVAR(isDownStateKey1) = false; + // Conditions: canInteract _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; @@ -34,11 +39,18 @@ // Conditions: specific if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false}; + // prevent holding down + if (GETGVAR(isDownStateKey2,false)) exitWith {false}; + GVAR(isDownStateKey2) = true; + // Statement ["distance"] call FUNC(onKeyDown); true }, { + // prevent holding down + GVAR(isDownStateKey2) = false; + // Conditions: canInteract _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; @@ -47,4 +59,4 @@ ["distance"] call FUNC(onKeyUp); true }, -[19, [false, false, false]], false] call CBA_fnc_registerKeybind; //R Key +[19, [false, false, false]], false] call CBA_fnc_addKeybind; //R Key