From 9c55c36d27e15e06b2c2aff86fb1aede30bb5891 Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Wed, 5 Jun 2019 03:20:07 +0200 Subject: [PATCH] Use checkVisibility to test LOS for missile seekers (#7014) --- .../functions/fnc_checkLos.sqf | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/addons/missileguidance/functions/fnc_checkLos.sqf b/addons/missileguidance/functions/fnc_checkLos.sqf index 205ff3d4ef..edc8b5ab19 100644 --- a/addons/missileguidance/functions/fnc_checkLos.sqf +++ b/addons/missileguidance/functions/fnc_checkLos.sqf @@ -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 @@ -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