ACE3/addons/medical_treatment/functions/fnc_bodyCleanupLoop.sqf
jonpas 742626ff1a
General - Relative script_component.hpp includes (#9378)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-12 20:58:10 +02:00

33 lines
863 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: Glowbal, esteldunedain
* Handles cleaning up bodies that were replaced by body bags.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_medical_treatment_fnc_bodyCleanupLoop
*
* Public: No
*/
{
TRACE_2("Handling body cleanup",_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];
// Exit the loop if no more bodies remain
if (GVAR(bodiesToDelete) isEqualTo []) exitWith {
TRACE_1("Ending body cleanup loop",GVAR(bodiesToDelete));
};
// Schedule cleanup loop to executed again
[FUNC(bodyCleanupLoop), [], BODY_CLEANUP_CHECK_DELAY] call CBA_fnc_waitAndExecute;