From 3744b980f49128946e21aed055a5d2bbbec6f778 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 12 Apr 2016 02:14:06 -0500 Subject: [PATCH 1/2] Javelin - Verify player has LOS to cursorTarget Fix #3668 --- addons/javelin/functions/fnc_onOpticDraw.sqf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index f561806eaa..4bf80641e3 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -99,7 +99,10 @@ if (_range > 50 && {_range < 2500}) then { }; if (isNull _newTarget) then { - _newTarget = cursorTarget; + private _intersectionsToCursorTarget = lineIntersectsSurfaces [(AGLtoASL positionCameraToWorld [0,0,0]), aimPos cursorTarget, ace_player, cursorTarget, true, 1]; + if (_intersectionsToCursorTarget isEqualTo []) then { + _newTarget = cursorTarget; + }; }; // Create constants From d523ef1fcd8ee75b852fa35a0893658edb29c120 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 14 Apr 2016 10:57:36 -0500 Subject: [PATCH 2/2] Try to use cursorObject first --- addons/javelin/functions/fnc_onOpticDraw.sqf | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index 4bf80641e3..67e337291b 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -98,11 +98,17 @@ if (_range > 50 && {_range < 2500}) then { }; }; -if (isNull _newTarget) then { - private _intersectionsToCursorTarget = lineIntersectsSurfaces [(AGLtoASL positionCameraToWorld [0,0,0]), aimPos cursorTarget, ace_player, cursorTarget, true, 1]; - if (_intersectionsToCursorTarget isEqualTo []) then { - _newTarget = cursorTarget; - }; +if ((isNull _newTarget) && {cursorObject isKindOf "AllVehicles"}) then { + private _intersectionsToCursorTarget = lineIntersectsSurfaces [(AGLtoASL positionCameraToWorld [0,0,0]), aimPos cursorObject, ace_player, cursorObject, true, 1]; + if (_intersectionsToCursorTarget isEqualTo []) then { + _newTarget = cursorObject; + }; +}; +if ((isNull _newTarget) && {cursorTarget isKindOf "AllVehicles"}) then { + private _intersectionsToCursorTarget = lineIntersectsSurfaces [(AGLtoASL positionCameraToWorld [0,0,0]), aimPos cursorTarget, ace_player, cursorTarget, true, 1]; + if (_intersectionsToCursorTarget isEqualTo []) then { + _newTarget = cursorTarget; + }; }; // Create constants