From c0e623af9bfce76ad55e046195d3f45b0485fe78 Mon Sep 17 00:00:00 2001 From: Brandon Danyluk Date: Sat, 1 May 2021 23:58:15 -0600 Subject: [PATCH] fix IR tracker losing lock immediately due to being blocked by launcher --- .../functions/fnc_seekerType_IR.sqf | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/addons/missileguidance/functions/fnc_seekerType_IR.sqf b/addons/missileguidance/functions/fnc_seekerType_IR.sqf index dee2d33dab..98f1f0ffb3 100644 --- a/addons/missileguidance/functions/fnc_seekerType_IR.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_IR.sqf @@ -18,13 +18,13 @@ #ifdef DEBUG_MODE_FULL #define TRACK_ON_PAUSE true #else -#define TRACK_ON_PAUSE true +#define TRACK_ON_PAUSE false #endif _args params ["_firedEH", "_launchParams", "_flightParams", "_seekerParams", "_stateParams", "_targetData"]; _firedEH params ["_shooter","","","","_ammo","","_projectile"]; _launchParams params ["_shooter","_targetLaunchParams","_seekerType","_attackProfile","_lockMode","_laserInfo","_navigationType"]; -_targetLaunchParams params ["_target", "_targetPos", "_launchPos", "_launchDir", "_launchTime"]; +_targetLaunchParams params ["_target", "", "_launchPos", "_launchDir", "_launchTime"]; _flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance"]; _stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState","_navigationParams", "_guidanceParameters"]; _seekerParams params ["_seekerAngle", "_seekerAccuracy", "_seekerMaxRange", "_seekerMinRange"]; @@ -32,13 +32,16 @@ _targetData params ["_targetDirection", "_attackProfileDirection", "_targetRange _seekerStateParams params ["_flareDistanceFilter", "_flareAngleFilter", "_trackingTarget"]; -private _withinView = [_projectile, getPosASLVisual _trackingTarget, _seekerAngle] call FUNC(checkSeekerAngle); -private _canSee = [_projectile, _trackingTarget, false] call FUNC(checkLos); - -if (!_withinView || !_canSee) then { - _trackingTarget = objNull; +private _distanceFromLaunch = _launchPos distanceSqr getPosASLVisual _projectile; +if (_distanceFromLaunch <= _seekerMinRange * _seekerMinRange) exitWith { + [0, 0, 0] }; +private _withinView = [_projectile, getPosASLVisual _trackingTarget, _seekerAngle] call FUNC(checkSeekerAngle); +private _canSee = [_projectile, _trackingTarget, false] call FUNC(checkLos); +if (_trackingTarget isNotEqualTo objNull && ({ !_withinView || !_canSee })) then { + _trackingTarget = objNull; +}; if (isNull _trackingTarget) then { // find any target within seeker range private _potentialTargets = _projectile nearEntities ["Air", _seekerMaxRange];