From b4e5a29119bf30685e96e9333ff4a1abd91f7366 Mon Sep 17 00:00:00 2001 From: Brandon Danyluk Date: Sat, 1 May 2021 21:42:49 -0600 Subject: [PATCH] Add hellfire mid course guidance --- addons/hellfire/CfgAmmo.hpp | 17 +++++++++-- addons/hellfire/XEH_PREP.hpp | 1 + .../functions/fnc_midCourseTransition.sqf | 29 +++++++++++++++++++ .../fnc_javelin_midCourseTransition.sqf | 4 +-- 4 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 addons/hellfire/functions/fnc_midCourseTransition.sqf diff --git a/addons/hellfire/CfgAmmo.hpp b/addons/hellfire/CfgAmmo.hpp index c3ee83e3a4..bd60c79e7f 100644 --- a/addons/hellfire/CfgAmmo.hpp +++ b/addons/hellfire/CfgAmmo.hpp @@ -38,8 +38,8 @@ class CfgAmmo { defaultSeekerLockMode = "LOAL"; seekerLockModes[] = { "LOAL", "LOBL" }; - defaultNavigationType = "ZeroEffortMiss"; - navigationTypes[] = { "ZeroEffortMiss" }; + defaultNavigationType = "Direct"; + navigationTypes[] = { "Direct", "ZeroEffortMiss" }; seekLastTargetPos = 1; // seek last target position [if seeker loses LOS of target, continue to last known pos] seekerAngle = 70; // Angle in front of the missile which can be searched @@ -51,6 +51,19 @@ class CfgAmmo { // Attack profile type selection defaultAttackProfile = "hellfire"; attackProfiles[] = {"hellfire", "hellfire_hi", "hellfire_lo"}; + + class navigationStates { + class initial { + transitionCondition = QFUNC(midCourseTransition); + navigationType = "Direct"; + }; + class terminal { + transitionCondition = ""; + navigationType = "ZeroEffortMiss"; + }; + // transitions from initial -> termimal + states[] = {"initial", "terminal"}; + }; }; }; class ACE_Hellfire_AGM114N: ACE_Hellfire_AGM114K { diff --git a/addons/hellfire/XEH_PREP.hpp b/addons/hellfire/XEH_PREP.hpp index f30cf0bffd..011810aa04 100644 --- a/addons/hellfire/XEH_PREP.hpp +++ b/addons/hellfire/XEH_PREP.hpp @@ -2,3 +2,4 @@ LOG("prep"); PREP(attackProfile); PREP(getAttackProfileSettings); PREP(setupVehicle); +PREP(midCourseTransition); diff --git a/addons/hellfire/functions/fnc_midCourseTransition.sqf b/addons/hellfire/functions/fnc_midCourseTransition.sqf new file mode 100644 index 0000000000..1369e162b0 --- /dev/null +++ b/addons/hellfire/functions/fnc_midCourseTransition.sqf @@ -0,0 +1,29 @@ +#include "script_component.hpp" +/* + * Author: Brandon (TCVM) + * Condition to switch to next navigation profile + * + * Arguments: + * Guidance Arg Array + * + * Return Value: + * None + * + * Example: + * [] call ace_hellfire_fnc_midCourseTransition + * + * Public: No + */ + +_args params ["_firedEH", "_launchParams", "_flightParams", "_seekerParams", "_stateParams", "_targetData", "_navigationStateData"]; +_firedEH params ["_shooter","","","","_ammo","","_projectile"]; +_launchParams params ["_shooter","_targetLaunchParams","_seekerType","_attackProfile","_lockMode","_laserInfo","_navigationType"]; +_targetLaunchParams params ["_target", "_targetPos", "_launchPos", "_launchDir", "_launchTime"]; +_flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance"]; +_stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState","_navigationParams", "_guidanceParameters"]; +_seekerParams params ["_seekerAngle", "_seekerAccuracy", "_seekerMaxRange", "_seekerMinRange"]; +_targetData params ["_targetDirection", "_attackProfileDirection", "_targetRange", "_targetVelocity", "_targetAcceleration"]; + +_attackProfileStateParams params ["_state"]; +_state in [STAGE_ATTACK_TERMINAL, STAGE_ATTACK_CRUISE]; + diff --git a/addons/missileguidance/functions/fnc_javelin_midCourseTransition.sqf b/addons/missileguidance/functions/fnc_javelin_midCourseTransition.sqf index 779ddecf21..531425b366 100644 --- a/addons/missileguidance/functions/fnc_javelin_midCourseTransition.sqf +++ b/addons/missileguidance/functions/fnc_javelin_midCourseTransition.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: Brandon (TCVM) - * Sets up IR state arrays (called from missileGuidance's onFired). + * Condition to switch to next navigation profile * * Arguments: * Guidance Arg Array @@ -10,7 +10,7 @@ * None * * Example: - * [] call ace_missileguidance_fnc_IR_onFired + * [] call ace_missileguidance_fnc_javelin_midCourseTransition * * Public: No */