2016-02-29 02:20:26 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal, esteldunedain
|
|
|
|
* Loop that cleans up litter
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Return Value:
|
2016-02-29 02:20:26 +00:00
|
|
|
* None
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* call ACE_medical_fnc_litterCleanupLoop
|
|
|
|
*
|
2016-02-29 02:20:26 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
{
|
|
|
|
_x params ["_time", "_objects"];
|
2016-08-01 21:20:13 +00:00
|
|
|
//Older elements are always at the begining of the array:
|
|
|
|
if ((CBA_missionTime - _time) < GVAR(litterCleanUpDelay)) exitWith {};
|
|
|
|
TRACE_2("deleting",_time,_objects);
|
|
|
|
{
|
|
|
|
deleteVehicle _x;
|
|
|
|
} forEach _objects;
|
|
|
|
GVAR(allCreatedLitter) set [_forEachIndex, objNull];
|
2016-02-29 02:20:26 +00:00
|
|
|
} forEach GVAR(allCreatedLitter);
|
|
|
|
GVAR(allCreatedLitter) = GVAR(allCreatedLitter) - [objNull];
|
|
|
|
|
|
|
|
// If no more litter remaining, exit the loop
|
2016-08-01 21:20:13 +00:00
|
|
|
if (GVAR(allCreatedLitter) isEqualTo []) exitWith {
|
2016-02-29 02:20:26 +00:00
|
|
|
GVAR(litterPFHRunning) = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Schedule the loop to be executed again 30 sec later
|
2016-05-22 13:27:24 +00:00
|
|
|
[DFUNC(litterCleanupLoop), [], 30] call CBA_fnc_waitAndExecute;
|