Merge pull request #1432 from acemod/fixSettings

Fix ace_settings
This commit is contained in:
Nicolás Badano 2015-05-30 00:59:23 -03:00
commit d46074ad27
2 changed files with 14 additions and 15 deletions

View File

@ -254,12 +254,25 @@ GVAR(commonPostInited) = true;
[{
// If post inits are not ready then wait
if !(SLX_XEH_MACHINE select 8) exitWith {};
// If settings are not initialized then wait
if !(GVAR(SettingsInitialized)) exitWith {};
if (isNil QGVAR(settings)) exitWith {
diag_log text format["[ACE] Waiting on settings from server"];
};
[(_this select 1)] call cba_fnc_removePerFrameHandler;
diag_log text format["[ACE] Settings received from server"];
// Load user settings from profile
if (hasInterface) then {
call FUNC(loadSettingsFromProfile);
call FUNC(loadSettingsLocalizedText);
};
diag_log text format["[ACE] Settings initialized"];
//Event that settings are safe to use:
["SettingsInitialized", []] call FUNC(localEvent);
}, 0, []] call cba_fnc_addPerFrameHandler;

View File

@ -294,23 +294,9 @@ GVAR(waitAndExecArray) = [];
//Debug
ACE_COUNTERS = [];
// Wait for server settings to arrive
GVAR(SettingsInitialized) = false;
["ServerSettingsReceived", {
diag_log text format["[ACE] Settings received from server"];
// Load user settings from profile
if (hasInterface) then {
call FUNC(loadSettingsFromProfile);
call FUNC(loadSettingsLocalizedText);
};
GVAR(SettingsInitialized) = true;
}] call FUNC(addEventhandler);
// Load settings on the server and broadcast them
if (isServer) then {
call FUNC(loadSettingsOnServer);
// Raise a global event to notify settings from the server have arrived
["ServerSettingsReceived", []] call FUNC(globalEvent);
};
ACE_player = player;