2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-02-29 02:33:51 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal, esteldunedain
|
2023-10-02 15:05:56 +00:00
|
|
|
* Handles cleaning up bodies or body bags that were replaced by body bags or put in grave.
|
2016-02-29 02:33:51 +00:00
|
|
|
*
|
|
|
|
* 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:
|
2019-06-03 15:31:46 +00:00
|
|
|
* [] call ace_medical_treatment_fnc_bodyCleanupLoop
|
2017-06-08 13:31:51 +00:00
|
|
|
*
|
2016-02-29 02:33:51 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
{
|
2019-06-03 15:31:46 +00:00
|
|
|
TRACE_2("Handling body cleanup",_x,isPlayer _x);
|
|
|
|
if (!isNull _x && {!isPlayer _x}) then {deleteVehicle _x};
|
2016-02-29 02:33:51 +00:00
|
|
|
} forEach GVAR(bodiesToDelete);
|
|
|
|
|
|
|
|
// deleteVehicle doesn't have instant results so it won't usualy be filtered until next run
|
|
|
|
GVAR(bodiesToDelete) = GVAR(bodiesToDelete) - [objNull];
|
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
// Exit the loop if no more bodies remain
|
2016-02-29 02:33:51 +00:00
|
|
|
if (GVAR(bodiesToDelete) isEqualTo []) exitWith {
|
2019-06-03 15:31:46 +00:00
|
|
|
TRACE_1("Ending body cleanup loop",GVAR(bodiesToDelete));
|
2016-02-29 02:33:51 +00:00
|
|
|
};
|
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
// Schedule cleanup loop to executed again
|
2019-12-17 15:50:59 +00:00
|
|
|
[FUNC(bodyCleanupLoop), [], BODY_CLEANUP_CHECK_DELAY] call CBA_fnc_waitAndExecute;
|