ACE3/addons/ui/XEH_clientInit.sqf
Grim e06c6f7835
General - Replace toLower with toLowerANSI where applicable (#9790)
* General - Replace toLower with toLowerANSI where applicable

* whoops

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update addons/repair/functions/fnc_setHitPointDamage.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/repair/dev/draw_showRepairInfo.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/tagging/XEH_preStart.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/vehicle_damage/functions/fnc_handleCookoff.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/tagging/XEH_preStart.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* comparment -> compartment

* Update fnc_showHud.sqf

* Update fnc_registerObjects.sqf

* Update addons/common/functions/fnc_cbaSettings_settingChanged.sqf

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2024-03-07 22:08:13 +01:00

53 lines
1.9 KiB
Plaintext

#include "script_component.hpp"
// Exit on Headless
if (!hasInterface) exitWith {};
// Compile and cache config UI
GVAR(configCache) = call CBA_fnc_createNamespace;
call FUNC(compileConfigUI);
// Scripted API namespace
GVAR(elementsSet) = call CBA_fnc_createNamespace;
// Attach all event handlers where UI has to be updated
["CBA_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));
{
[_x, missionNamespace getVariable (format [QGVAR(%1), _x]), false, _force] call FUNC(setAdvancedElement);
} forEach (allVariables GVAR(configCache));
// 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
["CBA_SettingChanged", {
params ["_name", "_value"];
if (_name select [0, 7] != "ace_ui_") exitWith {};
if (_name in ELEMENTS_BASIC) then {
[true] call FUNC(setElements);
} else {
private _nameNoPrefix = toLowerANSI (_name select [7]);
private _cachedElement = GVAR(configCache) getVariable _nameNoPrefix;
if (!isNil "_cachedElement") then {
[_nameNoPrefix, _value, true] call FUNC(setAdvancedElement);
};
};
}] call CBA_fnc_addEventHandler;
}] call CBA_fnc_addEventHandler;
["unit", FUNC(handlePlayerChanged), true] call CBA_fnc_addPlayerEventHandler;