2015-08-28 22:52:58 +00:00
|
|
|
/*
|
|
|
|
DMS_CleanUpManager
|
|
|
|
Created by eraser1
|
|
|
|
|
|
|
|
Objects to be cleaned up together have an entry in "DMS_CleanUpList"
|
|
|
|
The list is formatted as:
|
|
|
|
[
|
|
|
|
[
|
|
|
|
_objectToClean1,
|
|
|
|
_objectToClean2,
|
|
|
|
...
|
|
|
|
_objectToCleanN
|
|
|
|
],
|
|
|
|
_timeAddedToList,
|
|
|
|
_timeUntilClean
|
|
|
|
]
|
|
|
|
|
2015-08-29 01:08:45 +00:00
|
|
|
A single object can also be used for (_this select 0)
|
2015-08-28 22:52:58 +00:00
|
|
|
*/
|
|
|
|
if (DMS_CleanUpList isEqualTo []) exitWith {}; // Empty array, no objects to clean :)
|
|
|
|
|
|
|
|
{
|
|
|
|
if (DMS_DEBUG) then
|
|
|
|
{
|
|
|
|
diag_log format ["DMS_DEBUG CleanUpManager :: Checking Cleaning Status for: %1",_x];
|
|
|
|
};
|
2015-08-30 00:33:32 +00:00
|
|
|
|
2015-08-28 22:52:58 +00:00
|
|
|
private ["_objs","_timeAddedToList","_timeUntilClean"];
|
2015-08-30 00:33:32 +00:00
|
|
|
|
2015-09-01 01:24:13 +00:00
|
|
|
_OK = _x params
|
2015-08-28 22:52:58 +00:00
|
|
|
[
|
2015-09-01 01:24:13 +00:00
|
|
|
["_objs",[objNull],[objNull,[],grpNull]],
|
2015-08-28 22:52:58 +00:00
|
|
|
["_timeAddedToList",diag_tickTime,[0]],
|
|
|
|
["_timeUntilClean",DMS_CompletedMissionCleanupTime,[0]]
|
|
|
|
];
|
2015-08-30 00:33:32 +00:00
|
|
|
|
2015-08-28 22:52:58 +00:00
|
|
|
if (!_OK) then
|
|
|
|
{
|
|
|
|
diag_log format ["DMS ERROR :: Invalid parameters for DMS_CleanUpManager: %1 replaced with %2",_x,[_objs,_timeAddedToList,_timeUntilClean]];
|
|
|
|
};
|
|
|
|
|
|
|
|
if ((diag_tickTime-_timeAddedToList)>=_timeUntilClean) then
|
|
|
|
{
|
|
|
|
_objs call DMS_CleanUp;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (DMS_DEBUG) then
|
|
|
|
{
|
|
|
|
diag_log format ["DMS_DEBUG CleanUpManager :: %1 is not yet ready to clean!",_x];
|
|
|
|
};
|
|
|
|
};
|
2015-09-04 16:35:19 +00:00
|
|
|
} forEach DMS_CleanUpList;
|