From 4bb02a320bd2e5db1c322c56d18a23fad939b42c Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 14 Nov 2016 20:19:24 -0600 Subject: [PATCH] Run attack profile even if no target --- .../functions/fnc_attackProfile_JAV_DIR.sqf | 2 ++ .../functions/fnc_attackProfile_JAV_TOP.sqf | 2 ++ addons/missileguidance/functions/fnc_attackProfile_LIN.sqf | 2 ++ addons/missileguidance/functions/fnc_guidancePFH.sqf | 7 ++++--- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf index 4740bf6f0f..e709aed112 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf @@ -27,6 +27,8 @@ params ["_seekerTargetPos", "_args", "_attackProfileStateParams"]; _args params ["_firedEH"]; _firedEH params ["_shooter","","","","","","_projectile"]; +if (_seekerTargetPos isEqualTo [0,0,0]) exitWith {_seekerTargetPos}; + if (_attackProfileStateParams isEqualTo []) then { _attackProfileStateParams set [0, STAGE_LAUNCH]; }; diff --git a/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf b/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf index 06ef934ea5..0e502c9c21 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf @@ -27,6 +27,8 @@ params ["_seekerTargetPos", "_args", "_attackProfileStateParams"]; _args params ["_firedEH"]; _firedEH params ["_shooter","","","","","","_projectile"]; +if (_seekerTargetPos isEqualTo [0,0,0]) exitWith {_seekerTargetPos}; + if (_attackProfileStateParams isEqualTo []) then { _attackProfileStateParams set [0, STAGE_LAUNCH]; }; diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index 58d2768607..de8061a27c 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -22,6 +22,8 @@ params ["_seekerTargetPos", "_args"]; _args params ["_firedEH"]; _firedEH params ["_shooter","","","","","","_projectile"]; +if (_seekerTargetPos isEqualTo [0,0,0]) exitWith {_seekerTargetPos}; + private _shooterPos = getPosASL _shooter; private _projectilePos = getPosASL _projectile; diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index e7fe71ca39..45db7c536b 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -52,10 +52,11 @@ private _projectilePos = getPosASL _projectile; // Run seeker function: private _seekerTargetPos = [[0,0,0], _args, _seekerStateParams, _lastKnownPosState] call FUNC(doSeekerSearch); +// Run attack profile function: +private _profileAdjustedTargetPos = [_seekerTargetPos, _args, _attackProfileStateParams] call FUNC(doAttackProfile); + // If we have no seeker target, then do not change anything -if (!(_seekerTargetPos isEqualTo [0,0,0])) then { - // Run attack profile function: - private _profileAdjustedTargetPos = [_seekerTargetPos, _args, _attackProfileStateParams] call FUNC(doAttackProfile); +if (!(_profileAdjustedTargetPos isEqualTo [0,0,0])) then { private _targetVector = _projectilePos vectorFromTo _profileAdjustedTargetPos; private _adjustVector = _targetVector vectorDiff (vectorDir _projectile);