Update save and load functions to support scheduled/unscheduled execution
Some checks failed
Build / Build (push) Failing after 7s
Some checks failed
Build / Build (push) Failing after 7s
This commit is contained in:
parent
c9429919bd
commit
3457f24161
@ -17,7 +17,6 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: ID of Slot <SCALAR> (default: 0)
|
* 0: ID of Slot <SCALAR> (default: 0)
|
||||||
* 1: Unscheduled environment <BOOL> (default: false)
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* N/A
|
* N/A
|
||||||
@ -46,6 +45,7 @@ private _loadEntries = "true" configClasses (_config);
|
|||||||
private _entryName = configName _x;
|
private _entryName = configName _x;
|
||||||
private _functionName = getText (_x >> "function");
|
private _functionName = getText (_x >> "function");
|
||||||
private _args = getArray (_x >> "args");
|
private _args = getArray (_x >> "args");
|
||||||
|
private _scheduled = getNumber (_x >> "scheduled") == 1;
|
||||||
|
|
||||||
if (_functionName != "") then {
|
if (_functionName != "") then {
|
||||||
private _function = call compile _functionName;
|
private _function = call compile _functionName;
|
||||||
@ -53,9 +53,14 @@ private _loadEntries = "true" configClasses (_config);
|
|||||||
|
|
||||||
if (!isNil "_savedData") then {
|
if (!isNil "_savedData") then {
|
||||||
_args pushBack _savedData;
|
_args pushBack _savedData;
|
||||||
_args call _function;
|
|
||||||
|
|
||||||
[EGVAR(db,debug), "xpdb_load_fnc_custom", format ["Loading '%1.%2.%3'", EGVAR(db,prefix), _slot, _entryName], false] call EFUNC(utils,debug);
|
if (_scheduled) then {
|
||||||
|
_args spawn _function;
|
||||||
|
[EGVAR(db,debug), "xpdb_load_fnc_custom", format ["Loading '%1.%2.%3'", EGVAR(db,prefix), _slot, _entryName], false] call EFUNC(utils,debug);
|
||||||
|
} else {
|
||||||
|
_args call _function;
|
||||||
|
[EGVAR(db,debug), "xpdb_load_fnc_custom", format ["Loading '%1.%2.%3'", EGVAR(db,prefix), _slot, _entryName], false] call EFUNC(utils,debug);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} forEach _loadEntries;
|
} forEach _loadEntries;
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: ID of Slot <SCALAR> (default: 0)
|
* 0: ID of Slot <SCALAR> (default: 0)
|
||||||
* 1: Unscheduled environment <BOOL> (default: false)
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* N/A
|
* N/A
|
||||||
@ -45,14 +44,25 @@ private _saveEntries = "true" configClasses (_config);
|
|||||||
private _entryName = configName _x;
|
private _entryName = configName _x;
|
||||||
private _functionName = getText (_x >> "function");
|
private _functionName = getText (_x >> "function");
|
||||||
private _args = getArray (_x >> "args");
|
private _args = getArray (_x >> "args");
|
||||||
|
private _scheduled = getNumber (_x >> "scheduled") == 1;
|
||||||
|
|
||||||
if (_functionName != "") then {
|
if (_functionName != "") then {
|
||||||
private _function = call compile _functionName;
|
private _function = call compile _functionName;
|
||||||
private _result = _args call _function;
|
|
||||||
|
|
||||||
if (!isNil "_result") then {
|
if (_scheduled) then {
|
||||||
[EGVAR(db,debug), "xpdb_save_fnc_custom", format ["Saving '%1.%2.%3'", EGVAR(db,prefix), _slot, _entryName], false] call EFUNC(utils,debug);
|
private _result = _args spawn _function;
|
||||||
[_entryName, _result, _slot] call EFUNC(core,saveData);
|
|
||||||
|
if (!isNil "_result") then {
|
||||||
|
[EGVAR(db,debug), "xpdb_save_fnc_custom", format ["Saving '%1.%2.%3'", EGVAR(db,prefix), _slot, _entryName], false] call EFUNC(utils,debug);
|
||||||
|
[_entryName, _result, _slot] call EFUNC(core,saveData);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
private _result = _args call _function;
|
||||||
|
|
||||||
|
if (!isNil "_result") then {
|
||||||
|
[EGVAR(db,debug), "xpdb_save_fnc_custom", format ["Saving '%1.%2.%3'", EGVAR(db,prefix), _slot, _entryName], false] call EFUNC(utils,debug);
|
||||||
|
[_entryName, _result, _slot] call EFUNC(core,saveData);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} forEach _saveEntries;
|
} forEach _saveEntries;
|
||||||
|
@ -3,20 +3,24 @@ class CfgXPDB {
|
|||||||
class playerStats { // XPDB_ARMADBCORE.0.playerStats
|
class playerStats { // XPDB_ARMADBCORE.0.playerStats
|
||||||
function = "TAG_player_fnc_saveStats";
|
function = "TAG_player_fnc_saveStats";
|
||||||
args[] = {};
|
args[] = {};
|
||||||
|
scheduled = 0;
|
||||||
};
|
};
|
||||||
class world { // XPDB_ARMADBCORE.0.world
|
class world { // XPDB_ARMADBCORE.0.world
|
||||||
function = "TAG_world_fnc_saveNearbyVehicles";
|
function = "TAG_world_fnc_saveNearbyVehicles";
|
||||||
args[] = {};
|
args[] = {};
|
||||||
|
scheduled = 0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class load {
|
class load {
|
||||||
class playerStats { // XPDB_ARMADBCORE.0.playerStats
|
class playerStats { // XPDB_ARMADBCORE.0.playerStats
|
||||||
function = "TAG_player_fnc_loadStats";
|
function = "TAG_player_fnc_loadStats";
|
||||||
args[] = {};
|
args[] = {};
|
||||||
|
scheduled = 1;
|
||||||
};
|
};
|
||||||
class world { // XPDB_ARMADBCORE.0.world
|
class world { // XPDB_ARMADBCORE.0.world
|
||||||
function = "TAG_world_fnc_loadNearbyVehicles";
|
function = "TAG_world_fnc_loadNearbyVehicles";
|
||||||
args[] = {};
|
args[] = {};
|
||||||
|
scheduled = 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user