Add AIM-120 with ARH. Change AHR to not always seek all targets

This commit is contained in:
Brandon Danyluk 2021-04-12 22:37:41 -06:00
parent 34af87bb07
commit 789ae1cbe4
12 changed files with 204 additions and 5 deletions

View File

@ -0,0 +1 @@
z\ace\addons\aim120

74
addons/aim120/CfgAmmo.hpp Normal file
View File

@ -0,0 +1,74 @@
class CfgAmmo {
class ammo_Missile_AMRAAM_C;
class GVAR(c): ammo_Missile_AMRAAM_C {
author = "Brandon (TCVM)";
maneuvrability = 0;
class ace_missileguidance {
enabled = 1;
pitchRate = 60; // Minium flap deflection for guidance
yawRate = 60; // Maximum flap deflection for guidance
canVanillaLock = 1; // Can this default vanilla lock? Only applicable to non-cadet mode
// Guidance type for munitions
defaultSeekerType = "ARH";
seekerTypes[] = { "ARH" };
lockableTypes[] = {"Air"};
defaultSeekerLockMode = "LOAL";
seekerLockModes[] = { "LOAL", "LOBL" };
defaultNavigationType = "ProportionalNavigation";
navigationTypes[] = { "ProportionalNavigation" };
seekLastTargetPos = 0; // seek last target position [if seeker loses LOS of target, continue to last known pos]
seekerAngle = 50; // Angle from the shooter's view that can track the missile
seekerAccuracy = 1; // seeker accuracy multiplier
seekerMinRange = 75;
seekerMaxRange = 2500; // Range from the missile which the seeker can visually search
// Attack profile type selection
defaultAttackProfile = "LIN";
attackProfiles[] = {"LIN"};
};
};
class ammo_Missile_AMRAAM_D;
class GVAR(d): ammo_Missile_AMRAAM_D {
author = "Brandon (TCVM)";
maneuvrability = 0;
class ace_missileguidance {
enabled = 1;
pitchRate = 80; // Minium flap deflection for guidance
yawRate = 80; // Maximum flap deflection for guidance
canVanillaLock = 1; // Can this default vanilla lock? Only applicable to non-cadet mode
// Guidance type for munitions
defaultSeekerType = "ARH";
seekerTypes[] = { "ARH" };
lockableTypes[] = {"Air"};
defaultSeekerLockMode = "LOAL";
seekerLockModes[] = { "LOAL", "LOBL" };
defaultNavigationType = "ProportionalNavigation";
navigationTypes[] = { "ProportionalNavigation" };
seekLastTargetPos = 0; // seek last target position [if seeker loses LOS of target, continue to last known pos]
seekerAngle = 50; // Angle from the shooter's view that can track the missile
seekerAccuracy = 1; // seeker accuracy multiplier
seekerMinRange = 75;
seekerMaxRange = 2500; // Range from the missile which the seeker can visually search
// Attack profile type selection
defaultAttackProfile = "LIN";
attackProfiles[] = {"LIN"};
};
};
};

View File

@ -0,0 +1,60 @@
class CfgMagazines {
class magazine_Missile_AMRAAM_C_x1;
class PylonMissile_Missile_AMRAAM_C_x1;
class PylonRack_Missile_AMRAAM_C_x1;
class PylonRack_Missile_AMRAAM_C_x2;
class PylonMissile_Missile_AMRAAM_D_x1;
class PylonMissile_Missile_AMRAAM_D_INT_x1;
class PylonRack_Missile_AMRAAM_D_x1;
class PylonRack_Missile_AMRAAM_D_x2;
class GVAR(c): magazine_Missile_AMRAAM_C_x1 {
author = "Brandon (TCVM)";
displayName = "1x AIM-120C [ACE]";
ammo = QGVAR(c);
};
class GVAR(PylonMissile_Missile_c_x1): PylonMissile_Missile_AMRAAM_C_x1 {
author = "Brandon (TCVM)";
displayName = "1x AIM-120C [ACE]";
ammo = QGVAR(c);
pylonWeapon = GVAR(aim120Launcher);
};
class GVAR(PylonRack_Missile_c_x1): PylonRack_Missile_AMRAAM_C_x1 {
author = "Brandon (TCVM)";
displayName = "1x AIM-120C [ACE]";
ammo = QGVAR(c);
pylonWeapon = GVAR(aim120Launcher);
};
class GVAR(PylonRack_Missile_c_x2): PylonRack_Missile_AMRAAM_C_x2 {
author = "Brandon (TCVM)";
displayName = "2x AIM-120C [ACE]";
ammo = QGVAR(c);
pylonWeapon = GVAR(aim120Launcher);
};
class GVAR(PylonMissile_Missile_d_x1): PylonMissile_Missile_AMRAAM_D_x1 {
author = "Brandon (TCVM)";
displayName = "1x AIM-120D [ACE]";
ammo = QGVAR(d);
pylonWeapon = GVAR(aim120Launcher);
};
class GVAR(PylonMissile_Missile_d_INT_x1): PylonMissile_Missile_AMRAAM_D_INT_x1 {
author = "Brandon (TCVM)";
displayName = "1x AIM-120D [ACE]";
ammo = QGVAR(d);
pylonWeapon = GVAR(aim120Launcher);
};
class GVAR(PylonRack_Missile_d_x1): PylonRack_Missile_AMRAAM_D_x1 {
author = "Brandon (TCVM)";
displayName = "1x AIM-120D [ACE]";
ammo = QGVAR(d);
pylonWeapon = GVAR(aim120Launcher);
};
class GVAR(PylonRack_Missile_d_x2): PylonRack_Missile_AMRAAM_D_x2 {
author = "Brandon (TCVM)";
displayName = "2x AIM-120D [ACE]";
ammo = QGVAR(d);
pylonWeapon = GVAR(aim120Launcher);
};
};

View File

@ -0,0 +1,10 @@
class CfgWeapons {
class weapon_AMRAAMLauncher;
class GVAR(aim120Launcher): weapon_AMRAAMLauncher {
author = "Brandon (TCVM)";
displayName = "AIM-120 [ACE]";
magazines[] = { QGVAR(c), QGVAR(PylonMissile_Missile_c_x1), QGVAR(PylonRack_Missile_c_x1), QGVAR(PylonRack_Missile_c_x2), QGVAR(PylonMissile_Missile_d_x1), QGVAR(PylonMissile_Missile_d_INT_x1), QGVAR(PylonRack_Missile_d_x1), QGVAR(PylonRack_Missile_d_x2)};
};
};

12
addons/aim120/README.md Normal file
View File

@ -0,0 +1,12 @@
ace_aim120
===================
Adds AIM-120, AIM-132, and R-77 AHR missiles
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- [Brandon-TCVM](https://github.com/TheCandianVendingMachine)

20
addons/aim120/config.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common","ace_missileguidance"};
author = ECSTRING(common,ACETeam);
authors[] = {"Brandon (TCVM)"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};
#include "CfgAmmo.hpp"
#include "CfgMagazines.hpp"
#include "CfgWeapons.hpp"

View File

@ -0,0 +1,18 @@
#define COMPONENT aim120
#define COMPONENT_BEAUTIFIED AIM-120
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_AIM120
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_AIM120
#define DEBUG_SETTINGS DEBUG_SETTINGS_GBU
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -10,7 +10,7 @@
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_HOT
#ifdef DEBUG_SETTINGS_GBU
#define DEBUG_SETTINGS DEBUG_SETTINGS_GBU
#endif

View File

@ -38,6 +38,8 @@ private _activeRadarDistance = [_config >> "activeRadarEngageDistance", "NUMBER"
private _projectileThrust = [_projectileConfig >> "thrust", "NUMBER", 0] call CBA_fnc_getConfigEntry;
private _projectileThrustTime = [_projectileConfig >> "thrustTime", "NUMBER", 0] call CBA_fnc_getConfigEntry;
private _lockTypes = [_config >> "lockableTypes", "ARRAY", ["Air", "LandVehicle", "Ship"]] call CBA_fnc_getConfigEntry;
private _velocityAtImpact = _projectileThrust * _projectileThrustTime;
private _timeToActive = 0;
if (!isNil "_target" && _velocityAtImpact > 0) then {
@ -70,4 +72,5 @@ _seekerStateParams set [6, false];
_seekerStateParams set [7, [0, 0, 0]];
_seekerStateParams set [8, CBA_missionTime];
_seekerStateParams set [9, isNull _target];
_seekerStateParams set [10, _lockTypes];

View File

@ -20,7 +20,7 @@ _args params ["_firedEH", "_launchParams", "", "_seekerParams", "_stateParams"];
_firedEH params ["_shooter","","","","","","_projectile"];
_launchParams params ["_target","","","",""];
_seekerParams params ["_seekerAngle", "", "_seekerMaxRange"];
_seekerStateParams params ["_isActive", "_activeRadarEngageDistance", "_timeWhenActive", "_expectedTargetPos", "_lastTargetPollTime", "_shooterHasRadar", "_wasActive", "_lastKnownVelocity", "_lastTimeSeen", "_doesntHaveTarget"];
_seekerStateParams params ["_isActive", "_activeRadarEngageDistance", "_timeWhenActive", "_expectedTargetPos", "_lastTargetPollTime", "_shooterHasRadar", "_wasActive", "_lastKnownVelocity", "_lastTimeSeen", "_doesntHaveTarget", "_lockTypes"];
if (_isActive || { CBA_missionTime >= _timeWhenActive }) then {
if !(_isActive) then {
@ -60,7 +60,7 @@ if (_isActive || { CBA_missionTime >= _timeWhenActive }) then {
_seekerBaseRadiusAdjusted = _seekerBaseRadiusAtGround;
};
// Look in front of seeker for any targets
private _nearestObjects = nearestObjects [ASLtoAGL _searchPos, ["Air", "LandVehicle", "Ship"], _seekerBaseRadiusAdjusted, false];
private _nearestObjects = nearestObjects [ASLtoAGL _searchPos, _lockTypes, _seekerBaseRadiusAdjusted, false];
_nearestObjects = _nearestObjects apply {
// I check both Line of Sight versions to make sure that a single bush doesnt make the target lock dissapear but at the same time ensure that this can see through smoke. Should work 80% of the time
if ([_projectile, getPosASL _x, _seekerAngle] call FUNC(checkSeekerAngle) && { ([_projectile, _x, true] call FUNC(checkLOS)) || { ([_projectile, _x, false] call FUNC(checkLOS)) } }) then {

View File

@ -3,7 +3,7 @@
#include "\z\ace\addons\main\script_mod.hpp"
#define DRAW_GUIDANCE_INFO
#define ENABLE_PROJECTILE_CAMERA
// #define ENABLE_PROJECTILE_CAMERA
#define DEBUG_MODE_FULL
#define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS

View File

@ -29,9 +29,10 @@ Weapon Configs:
KH-58 - Passive Radar Homing
Seeker Types:
X Laser - causes lots of weapon noise, causing bad guidance
X Laser
Optical
Infrared
GPS/INS
Navigation Types:
X GBU-12 - LOS Guidance