2016-02-29 02:33:51 +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:33:51 +00:00
|
|
|
* None
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* call ACE_medical_fnc_bodyCleanupLoop
|
|
|
|
*
|
2016-02-29 02:33:51 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
{
|
|
|
|
TRACE_2("body",_x,isPlayer _x);
|
|
|
|
if ((!isNull _x) && {!isPlayer _x}) then {deleteVehicle _x};
|
|
|
|
} forEach GVAR(bodiesToDelete);
|
|
|
|
|
|
|
|
// deleteVehicle doesn't have instant results so it won't usualy be filtered until next run
|
|
|
|
GVAR(bodiesToDelete) = GVAR(bodiesToDelete) - [objNull];
|
|
|
|
|
|
|
|
// If no more bodies remain, exit the loop
|
|
|
|
if (GVAR(bodiesToDelete) isEqualTo []) exitWith {
|
|
|
|
TRACE_1("array emptied - rem PFEH",GVAR(bodiesToDelete));
|
|
|
|
};
|
|
|
|
|
|
|
|
// Schedule the loop to be executed again 20 sec later
|
2016-05-22 13:27:24 +00:00
|
|
|
[DFUNC(bodyCleanupLoop), [], 20] call CBA_fnc_waitAndExecute;
|