ACE3/addons/vector/functions/fnc_onKeyHold.sqf
2015-01-15 16:21:47 +01:00

73 lines
1.6 KiB
Plaintext

/*
by commy2
PFH executed while holding a vector key down.
*/
#include "script_component.hpp"
switch (_this select 0) do {
case ("azimuth"): {
[false] call FUNC(showCenter);
call FUNC(showAzimuth);
if (!GVAR(isKeyDownAzimuth)) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
};
};
case ("distance"): {
private "_isReady";
_isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5;
[_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownDistance)) then {
if (_isReady) then {
call FUNC(showDistance);
[false] call FUNC(showCenter);
};
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
};
};
case ("azimuth+distance"): {
call FUNC(showAzimuth);
private "_isReady";
_isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5;
[_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
call FUNC(showDistance);
[false] call FUNC(showCenter);
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
};
};
};
systemChat str (_this select 0);//