2015-08-28 21:52:56 +00:00
|
|
|
/*
|
2015-09-05 03:40:00 +00:00
|
|
|
DMS_fnc_TargetsKilled
|
2015-08-28 21:52:56 +00:00
|
|
|
Created by eraser1
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
[
|
|
|
|
_unit,
|
|
|
|
_group,
|
|
|
|
_object
|
2015-09-05 03:40:00 +00:00
|
|
|
] call DMS_fnc_TargetsKilled;
|
2015-08-28 21:52:56 +00:00
|
|
|
|
|
|
|
Will accept non-array argument of group, unit, or object.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ((typeName _this) in ["GROUP","OBJECT"]) then
|
|
|
|
{
|
|
|
|
_this = [_this];
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_this isEqualTo []) exitWith
|
|
|
|
{
|
|
|
|
diag_log "DMS ERROR :: Calling DMS_TargetsKilled with empty array!";
|
|
|
|
};
|
|
|
|
|
|
|
|
private "_killed";
|
|
|
|
|
|
|
|
_killed = false;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
2015-08-30 00:33:32 +00:00
|
|
|
if (((typeName _x) == "OBJECT") && {!isNull _x && {alive _x}}) then
|
2015-08-28 21:52:56 +00:00
|
|
|
{
|
|
|
|
throw _x;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-30 00:33:32 +00:00
|
|
|
if !((typeName _x) == "GROUP") exitWith
|
2015-08-28 21:52:56 +00:00
|
|
|
{
|
|
|
|
diag_log format ["DMS ERROR :: %1 is neither OBJECT nor GROUP!",_x];
|
|
|
|
};
|
|
|
|
{
|
|
|
|
if (!isNull _x && {alive _x}) exitWith
|
|
|
|
{
|
|
|
|
throw _x;
|
|
|
|
};
|
2015-09-04 16:35:19 +00:00
|
|
|
} forEach (units _x);
|
2015-08-28 21:52:56 +00:00
|
|
|
};
|
2015-09-04 16:35:19 +00:00
|
|
|
} forEach _this;
|
2015-08-28 21:52:56 +00:00
|
|
|
|
|
|
|
_killed = true;
|
|
|
|
}
|
|
|
|
catch
|
|
|
|
{
|
|
|
|
if (DMS_DEBUG) then {
|
|
|
|
diag_log format ["DMS_DEBUG TargetsKilled :: %1 is still alive! All of %2 are not yet killed!",_exception,_this];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
_killed;
|