2016-05-30 16:37:03 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2019-02-01 01:25:16 +00:00
|
|
|
// Wait until player controls (man,vehicle or uav) a thing before compiling the menu
|
|
|
|
GVAR(controllableSelfActionsAdded) = [] call CBA_fnc_createNamespace;
|
|
|
|
DFUNC(newControllableObject) = {
|
|
|
|
params ["_object"];
|
|
|
|
private _type = typeOf _object;
|
|
|
|
TRACE_2("newControllableObject",_object,_type);
|
|
|
|
if (_type == "") exitWith {};
|
|
|
|
|
|
|
|
if (!(GVAR(controllableSelfActionsAdded) getVariable [_type, false])) then {
|
|
|
|
[_type] call FUNC(compileMenuSelfAction);
|
|
|
|
GVAR(controllableSelfActionsAdded) setVariable [_type, true];
|
|
|
|
[{
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
2016-08-05 17:05:15 +00:00
|
|
|
GVAR(blockDefaultActions) = [];
|
|
|
|
|
2016-05-30 16:37:03 +00:00
|
|
|
GVAR(cachedBuildingTypes) = [];
|
|
|
|
GVAR(cachedBuildingActionPairs) = [];
|
|
|
|
|
|
|
|
GVAR(ParsedTextCached) = [];
|
|
|
|
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_settingsInitialized", {
|
2018-04-28 22:23:44 +00:00
|
|
|
// Setup text/shadow/size/color settings matrix
|
2016-05-30 16:37:03 +00:00
|
|
|
[] call FUNC(setupTextColors);
|
2018-04-28 22:23:44 +00:00
|
|
|
// Setting changed added here so color setup happens once at init
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_SettingChanged", {
|
2018-04-28 22:23:44 +00:00
|
|
|
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
|
2017-02-14 16:54:37 +00:00
|
|
|
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:
|
2024-03-28 18:57:23 +00:00
|
|
|
["ace_interactMenuOpened", LINKFUNC(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
|
|
|
|
|
|
|
|
|
2017-05-05 18:20:54 +00:00
|
|
|
["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", {
|
2019-12-08 01:44:04 +00:00
|
|
|
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];};
|
2016-06-09 12:24:45 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2020-02-23 10:59:14 +00:00
|
|
|
|
2016-06-09 12:24:45 +00:00
|
|
|
["ace_interactMenuClosed", {
|
2019-12-08 01:44:04 +00:00
|
|
|
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;};
|
2016-06-09 12:24:45 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2021-07-23 20:44:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
// init menu reordering
|
|
|
|
[QGVAR(newControllableObject), {
|
|
|
|
params ["_class"];
|
|
|
|
if !(_class isKindOf "CAManBase") exitWith {};
|
|
|
|
_class call FUNC(initMenuReorder);
|
|
|
|
}] call CBA_fnc_addEventHandler;
|