2018-07-30 09:22:14 +00:00
|
|
|
#include "script_component.hpp"
|
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:
|
2018-08-02 14:02:10 +00:00
|
|
|
* call ACE_medical_treatment_fnc_litterCleanupLoop
|
2017-06-08 13:31:51 +00:00
|
|
|
*
|
2016-02-29 02:20:26 +00:00
|
|
|
* 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 {};
|
|
|
|
|
2016-08-01 21:20:13 +00:00
|
|
|
TRACE_2("deleting",_time,_objects);
|
|
|
|
{
|
|
|
|
deleteVehicle _x;
|
|
|
|
} forEach _objects;
|
2016-09-19 07:55:30 +00:00
|
|
|
|
2016-08-01 21:20:13 +00:00
|
|
|
GVAR(allCreatedLitter) set [_forEachIndex, objNull];
|
2016-02-29 02:20:26 +00:00
|
|
|
} forEach GVAR(allCreatedLitter);
|
2016-09-19 07:55:30 +00:00
|
|
|
|
2016-02-29 02:20:26 +00:00
|
|
|
GVAR(allCreatedLitter) = GVAR(allCreatedLitter) - [objNull];
|
|
|
|
|
2016-09-19 07:55:30 +00:00
|
|
|
// If no more litter remain, 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-09-19 07:55:30 +00:00
|
|
|
[FUNC(litterCleanupLoop), [], 30] call CBA_fnc_waitAndExecute;
|