ACE3/addons/vector/functions/fnc_onKeyHold.sqf

160 lines
3.7 KiB
Plaintext
Raw Normal View History

2015-01-15 06:18:57 +00:00
/*
by commy2
PFH executed while holding a vector key down.
*/
#include "script_component.hpp"
switch (_this select 0) do {
case ("azimuth"): {
2015-01-15 15:21:47 +00:00
[false] call FUNC(showCenter);
call FUNC(showAzimuth);
2015-01-15 06:18:57 +00:00
if (!GVAR(isKeyDownAzimuth)) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;
2015-01-15 15:21:47 +00:00
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
2015-01-15 06:18:57 +00:00
};
};
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);
2015-01-15 15:21:47 +00:00
[false] call FUNC(showCenter);
2015-01-15 06:18:57 +00:00
};
[_this select 1] call CBA_fnc_removePerFrameHandler;
2015-01-15 15:21:47 +00:00
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 {
if (_isReady) then {
call FUNC(showDistance);
[false] call FUNC(showCenter);
};
2015-01-15 15:21:47 +00:00
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
2015-01-15 06:18:57 +00:00
};
};
2015-01-15 15:40:06 +00:00
case ("azimuth+inclination"): {
[false] call FUNC(showCenter);
call FUNC(showAzimuthInclination);
if (!GVAR(isKeyDownAzimuth)) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
};
};
2015-01-15 16:24:19 +00:00
case ("height+distance"): {
private "_isReady";
_isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5;
[_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownDistance)) then {
if (_isReady) then {
call FUNC(showHeightDistance);
[false] call FUNC(showCenter);
};
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
};
};
case ("relative_distance"): {
private "_isReady";
_isReady = diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5;
[_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
if (_isReady) then {
call FUNC(showRelativeDistance);
};
[false] call FUNC(showCenter);
[false] call FUNC(showP1);
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
};
};
case ("relative_azimuth+distance"): {
private "_isReady";
_isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5;
[_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
if (_isReady) then {
call FUNC(showRelativeAzimuthDistance);
};
[false] call FUNC(showCenter);
[false] call FUNC(showP1);
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
};
};
2015-01-15 06:18:57 +00:00
};
2015-01-15 15:21:47 +00:00
systemChat str (_this select 0);//