ACE3/addons/ui/XEH_clientInit.sqf
jonpas 4c995d4c5c Improve selective UI API (#3805)
* Improve selective UI API, Disable ammo count when reload component is loaded, Fix stance UI

* Upgrade Selective UI framework for controls that share IDCs for gunner and soldier

* Separate more soldier and gunner settings sharing same IDCs, Remove vehicle gunner weapon which has no effect anymore

* Separate more soldier and gunner IDC sharing elements, Fix typo, Fix API setting not being respected in case where selective type is not the same on load

* Rework Selective UI using ACE_UI config, Cleanup, Add ACE_UI to FCS component to mark it (is already disabled due to other necessary settings for FCS to function)

* Do location check in function, Rename condition to location, change to number

* Use macros in ACE_UI location
2016-06-02 14:32:39 +02:00

40 lines
1.5 KiB
Plaintext

#include "script_component.hpp"
// Exit on Headless
if (!hasInterface) exitWith {};
["SettingsInitialized", {
// Initial settings
[true] call FUNC(setElements);
// On load and entering/exiting a vehicle
["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 {
["InterfaceInitialized", []] call EFUNC(common,localEvent);
GVAR(interfaceInitialized) = true;
};
}] call EFUNC(common,addEventHandler);
// On changing settings
["SettingChanged", {
params ["_name"];
if (_name in ELEMENTS_BASIC) then {
[false] call FUNC(setElements);
} else {
[_name select [7], missionNamespace getVariable _name, true] call FUNC(setAdvancedElement);
};
}] call EFUNC(common,addEventHandler);
}] call EFUNC(common,addEventHandler);