mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
vector distance + azmimuth mode
This commit is contained in:
parent
bc43ee5136
commit
79426252a1
@ -25,6 +25,7 @@ PREP(showAzimuth);
|
||||
PREP(showCenter);
|
||||
PREP(showDistance);
|
||||
|
||||
GVAR(holdKeyHandler) = -1;
|
||||
GVAR(isKeyDownAzimuth) = false;
|
||||
GVAR(isKeyDownDistance) = false;
|
||||
GVAR(keyDownTimeAzimuth) = -1;
|
||||
|
@ -7,28 +7,44 @@ Handles pressing the special vector keys.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_fnc_setPFH";
|
||||
_fnc_setPFH = {
|
||||
if (GVAR(holdKeyHandler) > -1) then {
|
||||
[GVAR(holdKeyHandler)] call CBA_fnc_removePerFrameHandler;
|
||||
GVAR(holdKeyHandler) = -1;
|
||||
};
|
||||
|
||||
GVAR(holdKeyHandler) = [FUNC(onKeyHold), 0, _this] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
||||
switch (_this select 0) do {
|
||||
case ("azimuth"): {
|
||||
if (diag_tickTime > GVAR(keyDownTimeDistance) + 0.5) then {
|
||||
GVAR(isKeyDownDistance) = false; // emulate key release
|
||||
["distance"] call FUNC(clearDisplay);
|
||||
};
|
||||
|
||||
GVAR(isKeyDownAzimuth) = true;
|
||||
GVAR(keyDownTimeAzimuth) = diag_tickTime;
|
||||
|
||||
[FUNC(onKeyHold), 0, "azimuth"] call CBA_fnc_addPerFrameHandler;
|
||||
["azimuth"] call FUNC(clearDisplay);
|
||||
if (diag_tickTime > GVAR(keyDownTimeDistance) + 0.5) then {
|
||||
["distance"] call FUNC(clearDisplay);
|
||||
"azimuth" call _fnc_setPFH;
|
||||
} else {
|
||||
"azimuth+distance" call _fnc_setPFH;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
case ("distance"): {
|
||||
if (diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5) then {
|
||||
GVAR(isKeyDownAzimuth) = false; // emulate key release
|
||||
["azimuth"] call FUNC(clearDisplay);
|
||||
};
|
||||
|
||||
GVAR(isKeyDownDistance) = true;
|
||||
GVAR(keyDownTimeDistance) = diag_tickTime;
|
||||
|
||||
[FUNC(onKeyHold), 0, "distance"] call CBA_fnc_addPerFrameHandler;
|
||||
["distance"] call FUNC(clearDisplay);
|
||||
if (diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5) then {
|
||||
["azimuth"] call FUNC(clearDisplay);
|
||||
"distance" call _fnc_setPFH;
|
||||
} else {
|
||||
"azimuth+distance" call _fnc_setPFH;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
@ -10,12 +10,16 @@ PFH executed while holding a vector key down.
|
||||
switch (_this select 0) do {
|
||||
case ("azimuth"): {
|
||||
|
||||
if (diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5) then {
|
||||
call FUNC(showAzimuth);
|
||||
};
|
||||
[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;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
@ -30,10 +34,39 @@ switch (_this select 0) do {
|
||||
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);//
|
||||
|
Loading…
Reference in New Issue
Block a user