1
0
mirror of https://github.com/acemod/ACE3.git synced 2024-08-30 18:23:18 +00:00

Use checkVisibility to test LOS for missile seekers ()

This commit is contained in:
BaerMitUmlaut 2019-06-05 03:20:07 +02:00 committed by PabstMirror
parent 26fe041342
commit 9c55c36d27

@ -1,7 +1,7 @@
#include "script_component.hpp"
/*
* Author: jaynus
* Returns whether the seeker object can see the target position with lineIntersect
* Returns whether the seeker object can see the target position with checkVisibility
*
* Arguments:
* 0: Seeker <OBJECT>
@ -18,22 +18,5 @@
params ["_seeker", "_target"];
if ((isNil "_seeker") || {isNil "_target"}) exitWith {
ERROR_2("nil",_seeker,_target);
false
};
private _targetPos = getPosASL _target;
private _targetAimPos = aimPos _target;
private _seekerPos = getPosASL _seeker;
private _return = true;
if (!((terrainIntersectASL [_seekerPos, _targetPos]) && {terrainIntersectASL [_seekerPos, _targetAimPos]})) then {
if (lineIntersects [_seekerPos, _targetPos, _seeker, _target]) then {
_return = false;
};
} else {
_return = false;
};
_return;
private _visibility = [_seeker, "VIEW", _target] checkVisibility [getPosASL _seeker, aimPos _target];
_visibility > 0.001