ACE3/addons/interact_menu/XEH_preInit.sqf
PabstMirror ff5eb34e10
Interaction Menu - Only compile self actions when needed (#6792)
* Interaction Menu - Only compile self actions when needed

* Update XEH_clientInit.sqf

* fix spellling

* format/comments

* Don't compile actions on headless servers

* Update addons/zeus/XEH_postInit.sqf

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>
2019-01-31 19:25:16 -06:00

74 lines
1.6 KiB
Plaintext

#include "script_component.hpp"
ADDON = false;
PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
#include "initSettings.sqf"
if (!hasInterface) exitWith { ADDON = true; };
["All", "init", {_this call FUNC(compileMenu)}] call CBA_fnc_addClassEventHandler;
GVAR(ActNamespace) = [] call CBA_fnc_createNamespace;
GVAR(ActSelfNamespace) = [] call CBA_fnc_createNamespace;
// Event handlers for all interact menu controls
DFUNC(handleMouseMovement) = {
if (GVAR(cursorKeepCentered)) then {
GVAR(cursorPos) = GVAR(cursorPos) vectorAdd [_this select 1, _this select 2, 0] vectorDiff [0.5, 0.5, 0];
setMousePosition [0.5, 0.5];
} else {
GVAR(cursorPos) = [_this select 1, _this select 2, 0];
};
};
DFUNC(handleMouseButtonDown) = {
if !(GVAR(actionOnKeyRelease)) then {
[GVAR(openedMenuType),true] call FUNC(keyUp);
};
};
GVAR(keyDown) = false;
GVAR(keyDownSelfAction) = false;
GVAR(keyDownTime) = 0;
GVAR(openedMenuType) = -1;
GVAR(lastTime) = diag_tickTime;
GVAR(rotationAngle) = 0;
GVAR(selectedAction) = [[],[]];
GVAR(actionSelected) = false;
GVAR(selectedTarget) = objNull;
GVAR(menuDepthPath) = [];
GVAR(lastPos) = [0,0,0];
GVAR(currentOptions) = [];
GVAR(lastPath) = [];
GVAR(expanded) = false;
GVAR(startHoverTime) = diag_tickTime;
GVAR(expandedTime) = diag_tickTime;
// reset on mission load
addMissionEventHandler ["Loaded", {
GVAR(startHoverTime) = 0;
GVAR(expandedTime) = 0;
}];
GVAR(iconCtrls) = [];
GVAR(iconCount) = 0;
GVAR(collectedActionPoints) = [];
GVAR(foundActions) = [];
GVAR(lastTimeSearchedActions) = -1000;
// Init zeus menu
[] call FUNC(compileMenuZeus);
ADDON = true;