ACE3/addons/ui/XEH_clientInit.sqf
jonpas ed15d99915 Fix basic UI being overwritten on RscDiary unload (#3920)
* Display disabled message when basic config set by mission showHud

* Set showHud on RscDiary unload - fix #3907, Remove redundant force parameter from basic setElements

* Log forced source to RPT

* Add source to scripted element setter
2016-06-18 11:32:56 +02:00

42 lines
1.5 KiB
Plaintext

#include "script_component.hpp"
// Exit on Headless
if (!hasInterface) exitWith {};
["ace_settingsInitialized", {
// Initial settings
[false] call FUNC(setElements);
// On load and entering/exiting a vehicle
["ace_infoDisplayChanged", {
// Selective UI Advanced
// Defaults must be set in this EH to make sure controls are activated and advanced settings can be modified
private _force = [true, false] select (GVAR(allowSelectiveUI));
{
private _name = configName _x;
[_name, missionNamespace getVariable (format [QGVAR(%1), _name]), false, _force] call FUNC(setAdvancedElement);
} forEach ("true" configClasses (configFile >> "ACE_UI"));
// Execute local event for when it's safe to modify UI through this API
// infoDisplayChanged can execute multiple times, make sure it only happens once
if (!GVAR(interfaceInitialized)) then {
[QGVAR(InterfaceInitialized), []] call CBA_fnc_localEvent;
GVAR(interfaceInitialized) = true;
};
}] call CBA_fnc_addEventHandler;
// On changing settings
["ace_settingChanged", {
params ["_name"];
if (_name in ELEMENTS_BASIC) then {
[true] call FUNC(setElements);
} else {
if (isClass (configFile >> "ACE_UI" >> _name select [7])) then {
[_name select [7], missionNamespace getVariable _name, true] call FUNC(setAdvancedElement);
};
};
}] call CBA_fnc_addEventHandler;
}] call CBA_fnc_addEventHandler;