diff --git a/addons/missile_manpad/$PBOPREFIX$ b/addons/missile_manpad/$PBOPREFIX$ new file mode 100644 index 00000000000..693a43e0f63 --- /dev/null +++ b/addons/missile_manpad/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\missile_manpad \ No newline at end of file diff --git a/addons/missile_manpad/CfgAmmo.hpp b/addons/missile_manpad/CfgAmmo.hpp new file mode 100644 index 00000000000..adc5a71270c --- /dev/null +++ b/addons/missile_manpad/CfgAmmo.hpp @@ -0,0 +1,34 @@ +class EGVAR(missileguidance,type_RAM); +class EGVAR(missileguidance,type_Stinger); +class CfgAmmo { + class ammo_Missile_rim116; + class GVAR(rim116): ammo_Missile_rim116 { + maneuvrability = 0; + missileLockMaxSpeed = 2000; + + missileLockCone = 3; // caged lock + missileKeepLockedCone = 45; + missileLockMaxDistance = 5000; + missileLockMinDistance = 250; + + class ace_missileguidance: EGVAR(missileguidance,type_RAM) { + enabled = 1; + }; + }; + + class M_70mm_SAAMI; + class GVAR(stinger): M_70mm_SAAMI { + maneuvrability = 0; + missileLockMaxSpeed = 2000; + + missileLockCone = 3; // caged lock + missileKeepLockedCone = 45; + missileLockMaxDistance = 5000; + missileLockMinDistance = 250; + + class ace_missileguidance: EGVAR(missileguidance,type_Stinger) { + enabled = 1; + }; + }; +}; + diff --git a/addons/missile_manpad/CfgMagazines.hpp b/addons/missile_manpad/CfgMagazines.hpp new file mode 100644 index 00000000000..22f80549988 --- /dev/null +++ b/addons/missile_manpad/CfgMagazines.hpp @@ -0,0 +1,22 @@ +class CfgMagazines { + class magazine_Missile_rim116_x21; + class GVAR(rim116): magazine_Missile_rim116_x21 { + author = "Dani (TCVM)"; + displayName = CSTRING(rim116_21x); + ammo = QGVAR(rim116); + }; + + class 4Rnd_70mm_SAAMI_missiles; + class GVAR(stinger): 4Rnd_70mm_SAAMI_missiles { + author = "Dani (TCVM)"; + displayName = CSTRING(stinger_4x); + ammo = QGVAR(stinger); + }; + + class Titan_AA; + class GVAR(stinger_man): Titan_AA { + author = "Dani (TCVM)"; + displayName = CSTRING(stinger); + ammo = QGVAR(stinger); + }; +}; diff --git a/addons/missile_manpad/CfgVehicles.hpp b/addons/missile_manpad/CfgVehicles.hpp new file mode 100644 index 00000000000..7bbc7fb1821 --- /dev/null +++ b/addons/missile_manpad/CfgVehicles.hpp @@ -0,0 +1,108 @@ +class CfgVehicles { + class LandVehicle; + class StaticWeapon: LandVehicle { + class Turrets; + }; + class StaticMGWeapon: StaticWeapon { + class Turrets: Turrets { + class MainTurret; + }; + }; + + class SAM_System_01_base_F: StaticMGWeapon { + class AnimationSources { + class Missiles_revolving { + source = "revolving"; + weapon = QGVAR(rim116); + }; + }; + + class Turrets: Turrets { + class MainTurret: MainTurret { + weapons[] = {QGVAR(rim116)}; + magazines[] = {QGVAR(rim116)}; + }; + }; + }; + + class Tank; + class Tank_F: Tank { + class Turrets { + class MainTurret; + }; + }; + class LT_01_base_F: Tank_F { + class AnimationSources; + class Turrets: Turrets {}; + }; + + class LT_01_AA_base_F: LT_01_base_F { + class AnimationSources: AnimationSources { + class Missiles_revolving { + source = "revolving"; + weapon = QGVAR(FIM92); + }; + }; + + class Turrets: Turrets { + class MainTurret: MainTurret { + weapons[] = {"SmokeLauncher", QGVAR(FIM92), "HMG_127"}; + magazines[] = { + "SmokeLauncherMag", + QGVAR(stinger), + QGVAR(stinger), + "100Rnd_127x99_mag_Tracer_Red", + "100Rnd_127x99_mag_Tracer_Red", + "100Rnd_127x99_mag_Tracer_Red", + "100Rnd_127x99_mag_Tracer_Red" + }; + }; + }; + }; + + class APC_Tracked_01_base_F: Tank_F { + class Turrets: Turrets { + class MainTurret: MainTurret {}; + }; + }; + class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F { + class AnimationSources; + }; + class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F { + class AnimationSources: AnimationSources { + class Missiles_revolving { + source = "revolving"; + weapon = QGVAR(FIM92); + }; + }; + class Turrets: Turrets { + class MainTurret: MainTurret { + weapons[] = {"autocannon_35mm", QGVAR(FIM92)}; + magazines[] = {"680Rnd_35mm_AA_shells_Tracer_Red", QGVAR(stinger), QGVAR(stinger)}; + }; + }; + }; + + class APC_Tracked_02_base_F: Tank_F { + class Turrets: Turrets { + class MainTurret: MainTurret {}; + }; + }; + class O_APC_Tracked_02_base_F: APC_Tracked_02_base_F { + class AnimationSources; + }; + class O_APC_Tracked_02_AA_F: O_APC_Tracked_02_base_F { + class AnimationSources: AnimationSources { + class Missiles_revolving { + source = "revolving"; + weapon = QGVAR(FIM92); + }; + }; + class Turrets: Turrets { + class MainTurret: MainTurret { + weapons[] = {"autocannon_35mm", QGVAR(FIM92)}; + magazines[] = {"680Rnd_35mm_AA_shells_Tracer_Green", QGVAR(stinger), QGVAR(stinger)}; + }; + }; + }; +}; diff --git a/addons/missile_manpad/CfgWeapons.hpp b/addons/missile_manpad/CfgWeapons.hpp new file mode 100644 index 00000000000..adba9137d23 --- /dev/null +++ b/addons/missile_manpad/CfgWeapons.hpp @@ -0,0 +1,23 @@ +class CfgWeapons { + class weapon_rim116Launcher; + class GVAR(rim116): weapon_rim116Launcher { + author = "Dani (TCVM)"; + displayName = CSTRING(rim116); + magazines[] = { QGVAR(rim116) }; + weaponLockDelay = 0.5; + }; + + class missiles_SAAMI; + class GVAR(FIM92): missiles_SAAMI { + author = "Dani (TCVM)"; + displayName = CSTRING(stinger); + magazines[] = { QGVAR(stinger) }; + weaponLockDelay = 0.5; + }; + + class Launcher_Base_F; + class launch_Titan_base: Launcher_Base_F { + magazines[] = {QGVAR(stinger_man)}; + }; +}; + diff --git a/addons/missile_manpad/README.md b/addons/missile_manpad/README.md new file mode 100644 index 00000000000..377e7450d34 --- /dev/null +++ b/addons/missile_manpad/README.md @@ -0,0 +1,12 @@ +ace_missile_manpad +=================== + +Adds missile guidance to all vanilla MANPAD systems + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Dani-TCVM](https://github.com/TheCandianVendingMachine) + diff --git a/addons/missile_manpad/config.cpp b/addons/missile_manpad/config.cpp new file mode 100644 index 00000000000..d285b08cfc8 --- /dev/null +++ b/addons/missile_manpad/config.cpp @@ -0,0 +1,21 @@ +#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[] = {"Dani (TCVM)"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgAmmo.hpp" +#include "CfgMagazines.hpp" +#include "CfgWeapons.hpp" +#include "CfgVehicles.hpp" + diff --git a/addons/missile_manpad/script_component.hpp b/addons/missile_manpad/script_component.hpp new file mode 100644 index 00000000000..7c25a962e15 --- /dev/null +++ b/addons/missile_manpad/script_component.hpp @@ -0,0 +1,18 @@ +#define COMPONENT missile_manpad +#define COMPONENT_BEAUTIFIED MANPAD +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_MISSILE_MANPAD + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MISSILE_MANPAD + #define DEBUG_SETTINGS DEBUG_SETTINGS_MISSILE_MANPAD +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + diff --git a/addons/missile_manpad/stringtable.xml b/addons/missile_manpad/stringtable.xml new file mode 100644 index 00000000000..260bfd4f1f7 --- /dev/null +++ b/addons/missile_manpad/stringtable.xml @@ -0,0 +1,17 @@ + + + + + FIM-92 Stinger [ACE] + + + RIM-116 [ACE] + + + 21x RIM-116 [ACE] + + + 4x FIM-92 Stinger [ACE] + + + diff --git a/addons/missileguidance/CfgMissileTypesNato.hpp b/addons/missileguidance/CfgMissileTypesNato.hpp index 7dcbd8e22c0..f59cf75856a 100644 --- a/addons/missileguidance/CfgMissileTypesNato.hpp +++ b/addons/missileguidance/CfgMissileTypesNato.hpp @@ -579,8 +579,8 @@ class GVAR(type_RBS70) { class GVAR(type_Redeye) { enabled = 0; - pitchRate = 27; // Minium flap deflection for guidance - yawRate = 27; // Maximum flap deflection for guidance + pitchRate = 40; // Minium flap deflection for guidance + yawRate = 40; // Maximum flap deflection for guidance canVanillaLock = 1; // Can this default vanilla lock? Only applicable to non-cadet mode @@ -594,8 +594,9 @@ class GVAR(type_Redeye) { defaultSeekerLockMode = "LOBL"; seekerLockModes[] = { "LOBL" }; - defaultNavigationType = "ProportionalNavigation"; - navigationTypes[] = { "ProportionalNavigation" }; + defaultNavigationType = "LineOfSight"; + navigationTypes[] = { "LineOfSight" }; + navigationGain = 3; seekLastTargetPos = 0; // seek last target position [if seeker loses LOS of target, continue to last known pos] seekerAngle = 45; // Angle from the shooter's view that can track the missile @@ -713,4 +714,4 @@ class GVAR(type_TOW) { // Attack profile type selection defaultAttackProfile = "WIRE"; attackProfiles[] = {"WIRE"}; -}; \ No newline at end of file +}; diff --git a/addons/missileguidance/XEH_PREP.hpp b/addons/missileguidance/XEH_PREP.hpp index afdaba260a0..2fc1aa8394e 100644 --- a/addons/missileguidance/XEH_PREP.hpp +++ b/addons/missileguidance/XEH_PREP.hpp @@ -60,6 +60,7 @@ PREP(mwr_onFired); PREP(IR_onFired); // Navigation OnFired +PREP(navigationType_lineOfSight); PREP(proNav_onFired); PREP(line_onFired); diff --git a/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf b/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf index 958bc62ade9..62670e2f960 100644 --- a/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf +++ b/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf @@ -18,31 +18,29 @@ params ["_args", "_timestep", "_seekerTargetPos", "_profileAdjustedTargetPos"]; _args params ["_firedEH", "", "", "", "_stateParams", "_targetData"]; _firedEH params ["","","","","","","_projectile"]; _stateParams params ["", "", "", "","_navigationParams"]; -_navigationParams params ["_onLaunch"]; -_onLaunch params ["_lastLineOfSight"]; -_targetData params ["_targetDirection", "_attackProfileDirection", "", "_targetVelocity", ""]; +_navigationParams params ["_lastMissileFrame", "_navigationGain"]; +_lastMissileFrame params ["_lastLineOfSight"]; +_targetData params ["_targetDirection", "_attackProfileDirection"]; // Semi-proportional navigation implemented via "Fundamentals of proportional navigation" by Stephen Murtaugh and Harry Criel - -// the los rate is tiny, so we multiply by a constant of a power of ten to get more aggressive acceleration -// this is just due to how we measure our LOS delta, the vectors involved are _tiny_ -private _losDelta = _attackProfileDirection vectorDiff _lastLineOfSight; +private _losDelta = (vectorNormalized _attackProfileDirection) vectorDiff (vectorNormalized _lastLineOfSight); private _losRate = if (_timestep == 0) then { 0 } else { - 10 * (vectorMagnitude _losDelta) / _timestep; + 1 * (vectorMagnitude _losDelta) / _timestep; }; -private _closingVelocity = _targetVelocity vectorDiff (velocity _projectile); +private _lateralAcceleration = _navigationGain * _losRate; +private _commandedAcceleration = _attackProfileDirection vectorMultiply _lateralAcceleration; -private _commandedAcceleration = _closingVelocity vectorMultiply _losRate; +private _missileDirection = vectorNormalized velocity _projectile; // we need acceleration normal to our LOS -private _commandedAccelerationProjected = _attackProfileDirection vectorMultiply (_commandedAcceleration vectorDotProduct _attackProfileDirection); +private _commandedAccelerationProjected = _missileDirection vectorMultiply (_commandedAcceleration vectorDotProduct _missileDirection); _commandedAcceleration = _commandedAcceleration vectorDiff _commandedAccelerationProjected; if (accTime > 0) then { - _navigationParams set [0, [_attackProfileDirection]]; + _navigationParams set [0, [_seekerTargetPos]]; }; -_targetDirection +_commandedAcceleration