mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #1214 from acemod/reliableSettings
Reliable settings framework
This commit is contained in:
commit
d3a50bce53
@ -3,12 +3,6 @@
|
|||||||
|
|
||||||
//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent");
|
//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent");
|
||||||
|
|
||||||
// Load settings from profile
|
|
||||||
if (hasInterface) then {
|
|
||||||
call FUNC(loadSettingsFromProfile);
|
|
||||||
call FUNC(loadSettingsLocalizedText);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Listens for global "SettingChanged" events, to update the force status locally
|
// Listens for global "SettingChanged" events, to update the force status locally
|
||||||
["SettingChanged", {
|
["SettingChanged", {
|
||||||
PARAMS_2(_name,_value);
|
PARAMS_2(_name,_value);
|
||||||
@ -253,3 +247,19 @@ if(isMultiplayer && { ACE_time > 0 || isNull player } ) then {
|
|||||||
};
|
};
|
||||||
}, 0, []] call cba_fnc_addPerFrameHandler;
|
}, 0, []] call cba_fnc_addPerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GVAR(commonPostInited) = true;
|
||||||
|
|
||||||
|
// Create a pfh to wait until all postinits are ready and settings are initialized
|
||||||
|
[{
|
||||||
|
// 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 {};
|
||||||
|
|
||||||
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||||
|
|
||||||
|
diag_log text format["[ACE] Settings initialized"];
|
||||||
|
["SettingsInitialized", []] call FUNC(localEvent);
|
||||||
|
|
||||||
|
}, 0, []] call cba_fnc_addPerFrameHandler;
|
||||||
|
@ -293,9 +293,23 @@ GVAR(waitAndExecArray) = [];
|
|||||||
//Debug
|
//Debug
|
||||||
ACE_COUNTERS = [];
|
ACE_COUNTERS = [];
|
||||||
|
|
||||||
// Load settings
|
// 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 {
|
if (isServer) then {
|
||||||
call FUNC(loadSettingsOnServer);
|
call FUNC(loadSettingsOnServer);
|
||||||
|
// Raise a local event for other modules to listen too
|
||||||
|
["ServerSettingsReceived", []] call FUNC(localEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
ACE_player = player;
|
ACE_player = player;
|
||||||
|
@ -58,5 +58,8 @@ GVAR(ShowNamesTime) = -10;
|
|||||||
};
|
};
|
||||||
}, 5, []] call CBA_fnc_addPerFrameHandler;
|
}, 5, []] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
// Draw handle
|
// Wait until the colors are defined before starting to draw the nametags
|
||||||
addMissionEventHandler ["Draw3D", {_this call FUNC(onDraw3d);}];
|
["SettingsInitialized", {
|
||||||
|
// Draw handle
|
||||||
|
addMissionEventHandler ["Draw3D", {_this call FUNC(onDraw3d);}];
|
||||||
|
}] call EFUNC(common,addEventHandler);
|
||||||
|
Loading…
Reference in New Issue
Block a user