-
Notifications
You must be signed in to change notification settings - Fork 738
/
Copy pathXEH_clientInit.sqf
121 lines (98 loc) · 4.68 KB
/
XEH_clientInit.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#include "script_component.hpp"
if (!hasInterface) exitWith {};
// Wait until player controls (man,vehicle or uav) a thing before compiling the menu
GVAR(controllableSelfActionsAdded) = createHashMap;
DFUNC(newControllableObject) = {
params ["_object"];
private _type = typeOf _object;
TRACE_2("newControllableObject",_object,_type);
if (_type == "") exitWith {};
if !(_type in GVAR(controllableSelfActionsAdded)) then {
[_type] call FUNC(compileMenuSelfAction);
GVAR(controllableSelfActionsAdded) set [_type, nil];
[{
TRACE_1("sending newControllableObject event",_this);
// event for other systems to add self actions, running addActionToClass before this will cause compiling
[QGVAR(newControllableObject), _this] call CBA_fnc_localEvent;
}, [_type]] call CBA_fnc_execNextFrame; // delay event a frame to ensure postInit has run for all addons
};
};
["unit", {[_this select 0] call FUNC(newControllableObject)}, true] call CBA_fnc_addPlayerEventHandler;
["vehicle", {[_this select 1] call FUNC(newControllableObject)}, true] call CBA_fnc_addPlayerEventHandler;
["ACE_controlledUAV", {[_this select 0] call FUNC(newControllableObject)}] call CBA_fnc_addEventHandler;
GVAR(blockDefaultActions) = [];
GVAR(cachedBuildingTypes) = createHashMap;
GVAR(ParsedTextCached) = [];
["CBA_settingsInitialized", {
// Setup text/shadow/size/color settings matrix
[] call FUNC(setupTextColors);
// Setting changed added here so color setup happens once at init
["CBA_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;
// Install the render EH on the main display
addMissionEventHandler ["Draw2D", {call FUNC(render)}];
}] call CBA_fnc_addEventHandler;
//Add Actions to Houses:
["ace_interactMenuOpened", LINKFUNC(userActions_addHouseActions)] call CBA_fnc_addEventHandler;
["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
// Listens for the falling unconscious event, just in case the menu needs to be closed
["ace_unconscious", {
// 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);
}] call CBA_fnc_addEventHandler;
// background options
["ace_interactMenuOpened", {
params ["_menuType"];
private _menuBackgroundSetting = [GVAR(menuBackground), GVAR(menuBackgroundSelf)] select _menuType;
if (_menuBackgroundSetting == 1) exitWith {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);};
if (_menuBackgroundSetting == 2) exitWith {0 cutRsc [QGVAR(menuBackground), "PLAIN", 1, false];};
}] call CBA_fnc_addEventHandler;
["ace_interactMenuClosed", {
params ["_menuType"];
private _menuBackgroundSetting = [GVAR(menuBackground), GVAR(menuBackgroundSelf)] select _menuType;
if (_menuBackgroundSetting == 1) exitWith {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);};
if (_menuBackgroundSetting == 2) exitWith {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;};
}] call CBA_fnc_addEventHandler;
// init menu reordering
[QGVAR(newControllableObject), {
params ["_class"];
if !(_class isKindOf "CAManBase") exitWith {};
_class call FUNC(initMenuReorder);
}] call CBA_fnc_addEventHandler;