ACE3/addons/medical_treatment/functions/fnc_bodyCleanupLoop.sqf
2019-03-30 11:07:54 -05:00

33 lines
839 B
Plaintext

#include "script_component.hpp"
/*
* Author: Glowbal, esteldunedain
* Loop that cleans up player bodies that were replaced by bodybags
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_medical_treatment_fnc_bodyCleanupLoop
*
* Public: No
*/
{
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
[DFUNC(bodyCleanupLoop), [], 20] call CBA_fnc_waitAndExecute;