Run functions after setting init

This commit is contained in:
PabstMirror 2015-09-02 23:58:24 -05:00
parent c213c0e05a
commit cbccd898ea
2 changed files with 12 additions and 1 deletions

View File

@ -150,6 +150,14 @@ call FUNC(checkFiles);
//Event that settings are safe to use:
["SettingsInitialized", []] call FUNC(localEvent);
//Set init finished and run all delayed functions:
GVAR(settingsInitFinished) = true;
diag_log text format ["%1 delayed functions", (count GVAR(runAtSettingsInitialized))];
{
_x params ["_args", "_code"];
_args call _code;
} forEach GVAR(runAtSettingsInitialized);
}, 0, [false]] call CBA_fnc_addPerFrameHandler;
@ -326,7 +334,7 @@ GVAR(OldIsCamera) = false;
if (didJip) then {
// We are jipping! Get ready and wait, and throw the event
[{
if(!(isNull player)) then {
if((!(isNull player)) && GVAR(settingsInitFinished)) then {
["PlayerJip", [player] ] call FUNC(localEvent);
[(_this select 1)] call cba_fnc_removePerFrameHandler;
};

View File

@ -303,6 +303,9 @@ GVAR(nextFrameNo) = diag_frameno;
GVAR(nextFrameBufferA) = [];
GVAR(nextFrameBufferB) = [];
GVAR(settingsInitFinished) = false;
GVAR(runAtSettingsInitialized) = [];
// @TODO: Generic local-managed global-synced objects (createVehicleLocal)
//Debug