mirror of
https://github.com/Defent/DMS_Exile.git
synced 2024-08-30 16:52:12 +00:00
d4733a5559
* NEW CONFIG VALUE: "DMS_MaxSurfaceNormal" * The above config value now determines the maximum incline that a mission can spawn on. Default value is 0.95, which should be sufficiently flat. * Added some grouping explanations in mission config settings. * Added check for A3XAI for the lovely ["Face"/"dayzai"](https://github.com/dayzai) * Added ability for people to use a static export from M3Editor. DMS will then calculate the relative position, and spawn it at the mission. Example provided in testmission.sqf. * Fixed an issue with DMS_fnc_TargetsKilled always returning false.
89 lines
2.0 KiB
Plaintext
89 lines
2.0 KiB
Plaintext
/*
|
|
DMS_fnc_TargetsKilled
|
|
Created by eraser1
|
|
|
|
Usage:
|
|
[
|
|
_unit,
|
|
_group,
|
|
_object
|
|
] call DMS_fnc_TargetsKilled;
|
|
|
|
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
|
|
{
|
|
{
|
|
if (((typeName _x) == "OBJECT") && {!isNull _x && {alive _x}}) then
|
|
{
|
|
private ["_lastDistanceCheckTime", "_spawnPos"];
|
|
|
|
_lastDistanceCheckTime = _x getVariable ["DMS_LastAIDistanceCheck",time];
|
|
_pos = getPosWorld _x;
|
|
_spawnPos = _x getVariable ["DMS_AISpawnPos",_pos];
|
|
|
|
if ((DMS_MaxAIDistance>0) && {((time - _lastDistanceCheckTime)>DMS_AIDistanceCheckFrequency) && {(_pos distance2D _spawnPos)>DMS_MaxAIDistance}}) then
|
|
{
|
|
_x setDamage 1;
|
|
diag_log format ["Killed a runaway unit! |%1| was more than %2m away from its spawn position %3!",_x,DMS_MaxAIDistance,_x getVariable "DMS_AISpawnPos"];
|
|
}
|
|
else
|
|
{
|
|
throw _x;
|
|
};
|
|
}
|
|
else
|
|
{
|
|
if ((typeName _x) != "GROUP") exitWith
|
|
{
|
|
diag_log format ["DMS ERROR :: %1 is neither OBJECT nor GROUP!",_x];
|
|
};
|
|
{
|
|
if (alive _x) then
|
|
{
|
|
private ["_lastDistanceCheckTime", "_spawnPos"];
|
|
|
|
_lastDistanceCheckTime = _x getVariable ["DMS_LastAIDistanceCheck",time];
|
|
_pos = getPosWorld _x;
|
|
_spawnPos = _x getVariable ["DMS_AISpawnPos",_pos];
|
|
|
|
if ((DMS_MaxAIDistance>0) && {((time - _lastDistanceCheckTime)>DMS_AIDistanceCheckFrequency) && {(_pos distance2D _spawnPos)>DMS_MaxAIDistance}}) then
|
|
{
|
|
_x setDamage 1;
|
|
diag_log format ["Killed a runaway unit! |%1| was more than %2m away from its spawn position %3!",_x,DMS_MaxAIDistance,_x getVariable "DMS_AISpawnPos"];
|
|
}
|
|
else
|
|
{
|
|
throw _x;
|
|
};
|
|
};
|
|
} forEach (units _x);
|
|
};
|
|
} forEach _this;
|
|
|
|
_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; |