ACE3/addons/medical_treatment/functions/fnc_litterCleanupLoop.sqf

41 lines
921 B
Plaintext
Raw Normal View History

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