Merge pull request #1598 from acemod/serverModulesFirst

Fix Server not reading modules
This commit is contained in:
Nicolás Badano 2015-06-13 12:01:22 -03:00
commit c168afe8bb
2 changed files with 42 additions and 35 deletions

View File

@ -101,6 +101,43 @@ if(!isServer) then {
call FUNC(checkFiles);
// Create a pfh to wait until all postinits are ready and settings are initialized
[{
PARAMS_1(_args);
EXPLODE_1_PVT(_args,_waitingMsgSent);
// If post inits are not ready then wait
if !(SLX_XEH_MACHINE select 8) exitWith {};
// If settings are not initialized then wait
if (isNil QGVAR(settings) || {(!isServer) && (isNil QEGVAR(modules,serverModulesRead))}) exitWith {
if (!_waitingMsgSent) then {
_args set [0, true];
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"];
// Event so that ACE_Modules have their settings loaded:
["InitSettingsFromModules", []] call FUNC(localEvent);
// 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, [false]] call cba_fnc_addPerFrameHandler;
/***************************************************************/
/***************************************************************/
/***************************************************************/
@ -278,38 +315,3 @@ if(isMultiplayer && { ACE_time > 0 || isNull player } ) then {
}] call FUNC(addEventHandler);
GVAR(commonPostInited) = true;
// Create a pfh to wait until all postinits are ready and settings are initialized
[{
PARAMS_1(_args);
EXPLODE_1_PVT(_args,_waitingMsgSent);
// If post inits are not ready then wait
if !(SLX_XEH_MACHINE select 8) exitWith {};
// If settings are not initialized then wait
if (isNil QGVAR(settings)) exitWith {
if (!_waitingMsgSent) then {
_args set [0, true];
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"];
// Event so that ACE_Modules have their settings loaded:
["InitSettingsFromModules", []] call FUNC(localEvent);
// 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, [false]] call cba_fnc_addPerFrameHandler;

View File

@ -43,4 +43,9 @@
};
};
}foreach GVAR(moduleInitCollection);
if (isServer) then {
GVAR(serverModulesRead) = true;
publicVariable QGVAR(serverModulesRead);
};
}] call EFUNC(common,addEventhandler);