ACE3/addons/medical/functions/fnc_litterCleanupLoop.sqf
Phyma ffaa195fe5 Conform function headers to coding guidelines (#5255)
* Fixed headers to work with silentspike python script

* Fixed rest of the files

* Fixed ace-team
2017-06-08 15:31:51 +02:00

38 lines
914 B
Plaintext

/*
* Author: Glowbal, esteldunedain
* Loop that cleans up litter
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ACE_medical_fnc_litterCleanupLoop
*
* Public: No
*/
#include "script_component.hpp"
{
_x params ["_time", "_objects"];
//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];
} forEach GVAR(allCreatedLitter);
GVAR(allCreatedLitter) = GVAR(allCreatedLitter) - [objNull];
// If no more litter remaining, exit the loop
if (GVAR(allCreatedLitter) isEqualTo []) exitWith {
GVAR(litterPFHRunning) = false;
};
// Schedule the loop to be executed again 30 sec later
[DFUNC(litterCleanupLoop), [], 30] call CBA_fnc_waitAndExecute;