ACE3/addons/interact_menu/XEH_clientInit.sqf

87 lines
3.1 KiB
Plaintext
Raw Normal View History

2016-05-30 16:37:03 +00:00
#include "script_component.hpp"
if (!hasInterface) exitWith {};
GVAR(blockDefaultActions) = [];
2016-05-30 16:37:03 +00:00
GVAR(cachedBuildingTypes) = [];
GVAR(cachedBuildingActionPairs) = [];
GVAR(ParsedTextCached) = [];
2016-06-09 12:24:45 +00:00
["ace_settingsInitialized", {
// Setup text/shadow/size/color settings matrix
2016-05-30 16:37:03 +00:00
[] call FUNC(setupTextColors);
// Setting changed added here so color setup happens once at init
["ace_settingChanged", {
params ["_name"];
if (_name in [QGVAR(colorTextMax), QGVAR(colorTextMin), QGVAR(colorShadowMax), QGVAR(colorShadowMin), QGVAR(textSize), QGVAR(shadowSetting)]) then {
[] call FUNC(setupTextColors);
};
}] call CBA_fnc_addEventHandler;
2016-05-30 16:37:03 +00:00
// Install the render EH on the main display
addMissionEventHandler ["Draw3D", {call FUNC(render)}];
2016-06-09 12:24:45 +00:00
}] call CBA_fnc_addEventHandler;
2016-05-30 16:37:03 +00:00
//Add Actions to Houses:
2016-06-09 12:24:45 +00:00
["ace_interactMenuOpened", {_this call FUNC(userActions_addHouseActions)}] call CBA_fnc_addEventHandler;
2016-05-30 16:37:03 +00:00
["ACE3 Common", QGVAR(InteractKey), (localize LSTRING(InteractKey)),
{
// Statement
[0] call FUNC(keyDown)
},{[0,false] call FUNC(keyUp)},
[219, [false, false, false]], false] call CBA_fnc_addKeybind; //Left Windows Key
["ACE3 Common", QGVAR(SelfInteractKey), (localize LSTRING(SelfInteractKey)),
{
// Statement
[1] call FUNC(keyDown)
},{[1,false] call FUNC(keyUp)},
[219, [false, true, false]], false] call CBA_fnc_addKeybind; //Left Windows Key + Ctrl/Strg
["ACE3 Common", QGVAR(InteractKey_Toggle),
format ["%1 (%2)", (localize LSTRING(InteractKey)), localize ELSTRING(common,KeybindToggle)],
{
if (GVAR(openedMenuType) != 0) then {
[0] call FUNC(keyDown)
} else {
[0,false] call FUNC(keyUp)
};
}, {}, [-1, [false, false, false]], false] call CBA_fnc_addKeybind; // UNBOUND
["ACE3 Common", QGVAR(SelfInteractKey_Toggle),
format ["%1 (%2)", (localize LSTRING(SelfInteractKey)), localize ELSTRING(common,KeybindToggle)],
{
if (GVAR(openedMenuType) != 1) then {
[1] call FUNC(keyDown)
} else {
[1, false] call FUNC(keyUp)
};
}, {}, [-1, [false, false, false]], false] call CBA_fnc_addKeybind; // UNBOUND
2016-05-30 16:37:03 +00:00
// Listens for the falling unconscious event, just in case the menu needs to be closed
2016-06-09 12:24:45 +00:00
["ace_unconscious", {
2016-05-30 16:37:03 +00:00
// If no menu is open just quit
if (GVAR(openedMenuType) < 0) exitWith {};
params ["_unit", "_isUnconscious"];
if (_unit != ACE_player || !_isUnconscious) exitWith {};
GVAR(actionSelected) = false;
[GVAR(openedMenuType), false] call FUNC(keyUp);
2016-06-09 12:24:45 +00:00
}] call CBA_fnc_addEventHandler;
2016-05-30 16:37:03 +00:00
// background options
2016-06-09 12:24:45 +00:00
["ace_interactMenuOpened", {
2016-05-30 16:37:03 +00:00
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);};
if (GVAR(menuBackground)==2) then {0 cutRsc[QGVAR(menuBackground), "PLAIN", 1, false];};
2016-06-09 12:24:45 +00:00
}] call CBA_fnc_addEventHandler;
["ace_interactMenuClosed", {
2016-05-30 16:37:03 +00:00
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);};
if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;};
2016-06-09 12:24:45 +00:00
}] call CBA_fnc_addEventHandler;