GMS_RC/@GMS/addons/GMS/Compiles/Units/fn_cleanupAliveAI.sqf
2023-09-23 10:05:31 -04:00

39 lines
1.0 KiB
Plaintext

/*
Delete alive AI.
by Ghostrider
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\GMS\Compiles\Init\GMS_defines.hpp"
for "_i" from 1 to (count GMS_liveMissionAI) do {
if ((_i) <= count GMS_liveMissionAI) then {
_units = GMS_liveMissionAI deleteAt 0;
_units params ["_missionCenter","_unitsarr","_timer"];
if (diag_tickTime > _timer) then
{
private _nearplayer = [_missionCenter,800] call GMS_fnc_nearestPlayers;
if (_nearPlayer isEqualTo []) then
{
{
private _unit = _x;
if ((alive _unit) && {!(isNull objectParent _unit)}) then {
[objectParent _unit] call GMS_fnc_deleteAIvehicle;
};
[_unit] call GMS_fnc_deleteAI;
} forEach _unitsarr;
} else {
GMS_liveMissionAI pushback _units;
};
} else {
GMS_liveMissionAI pushback _units;
};
};
};