From 597f439654ee85d5dba8ad90cf7df785b6155730 Mon Sep 17 00:00:00 2001
From: Tim Beswick <contact.tim.here@gmail.com>
Date: Fri, 23 Jun 2017 17:32:48 +0100
Subject: [PATCH] Changed hellfire interaction check & added N variant (#5294)

* Changed weapon check for interaction to generic ace_hellfire_enabled value

* Added November hellfire variant

* Cleanup

* +1
---
 addons/hellfire/CfgAmmo.hpp                   | 15 ++++++-
 addons/hellfire/CfgMagazines.hpp              | 40 +++++++++++++++++++
 addons/hellfire/CfgWeapons.hpp                |  6 ++-
 .../hellfire/functions/fnc_setupVehicle.sqf   |  2 +-
 addons/hellfire/stringtable.xml               | 15 -------
 5 files changed, 60 insertions(+), 18 deletions(-)

diff --git a/addons/hellfire/CfgAmmo.hpp b/addons/hellfire/CfgAmmo.hpp
index b5df3994f2..c8900459ad 100644
--- a/addons/hellfire/CfgAmmo.hpp
+++ b/addons/hellfire/CfgAmmo.hpp
@@ -19,7 +19,7 @@ class CfgAmmo {
         laserLock = 0;
         manualControl = 0;
         maxSpeed = 450;
-        
+
         thrustTime = 2.5; // motor burn 2-3 sec
         thrust = 250;
         timeToLive = 40;
@@ -54,4 +54,17 @@ class CfgAmmo {
             attackProfiles[] = {"hellfire", "hellfire_hi", "hellfire_lo"};
         };
     };
+    class ACE_Hellfire_AGM114N: ACE_Hellfire_AGM114K {
+        displayName = "AGM-114N";
+        displayNameShort = "AGM-114N";
+        description = "AGM-114N";
+        descriptionShort = "AGM-114N";
+        hit = 1100;
+        indirectHit = 200;
+        indirectHitRange = 10;
+        explosionEffects = "BombExplosion";
+        class ace_missileguidance: ace_missileguidance {
+            enabled = 1; // Missile Guidance must be explicitly enabled
+        };
+    };
 };
diff --git a/addons/hellfire/CfgMagazines.hpp b/addons/hellfire/CfgMagazines.hpp
index 6f636c2c87..79c5b5016c 100644
--- a/addons/hellfire/CfgMagazines.hpp
+++ b/addons/hellfire/CfgMagazines.hpp
@@ -1,6 +1,7 @@
 class CfgMagazines {
     class 12Rnd_PG_missiles;
     
+    // Kilo - tandem shaped charge HEAT (anti-tank)
     class 6Rnd_ACE_Hellfire_AGM114K: 12Rnd_PG_missiles { // Old style vehicle magazine
         count = 6;
         ammo = "ACE_Hellfire_AGM114K";
@@ -44,4 +45,43 @@ class CfgMagazines {
         model = "\A3\Weapons_F\DynamicLoadout\PylonPod_4x_Missile_LG_scalpel_F.p3d";
         mirrorMissilesIndexes[] = {2, 1, 4, 3};
     };
+
+    // November - Metal augmented charge (Thermobaric) (Enclosures, ships, urban targets, air defense units)
+    class 6Rnd_ACE_Hellfire_AGM114N: 6Rnd_ACE_Hellfire_AGM114K { // Old style vehicle magazine
+        count = 6;
+        ammo = "ACE_Hellfire_AGM114N";
+        displayName = "AGM-114N [ACE]";
+        displayNameShort = "AGM-114N";
+        descriptionShort = "AGM-114N";
+    };
+
+    // 1.70 pylon magazines:
+    class PylonMissile_1Rnd_ACE_Hellfire_AGM114N: PylonMissile_1Rnd_ACE_Hellfire_AGM114K { // Bare missle
+        displayName = "1x AGM-114N [ACE]";
+        displayNameShort = "AGM-114N";
+        descriptionShort = "AGM-114N";
+        ammo = "ACE_Hellfire_AGM114N";
+        pylonWeapon = QGVAR(launcher_N);
+    };
+    class PylonRack_1Rnd_ACE_Hellfire_AGM114N: PylonRack_1Rnd_ACE_Hellfire_AGM114K { // 1x Launcher Support Rack
+        displayName = "1x AGM-114N [ACE]";
+        displayNameShort = "AGM-114N";
+        descriptionShort = "AGM-114N";
+        ammo = "ACE_Hellfire_AGM114N";
+        pylonWeapon = QGVAR(launcher_N);
+    };
+    class PylonRack_3Rnd_ACE_Hellfire_AGM114N: PylonRack_3Rnd_ACE_Hellfire_AGM114K { // 3x Launcher Support Rack
+        displayName = "3x AGM-114N [ACE]";
+        displayNameShort = "AGM-114N";
+        descriptionShort = "AGM-114N";
+        ammo = "ACE_Hellfire_AGM114N";
+        pylonWeapon = QGVAR(launcher_N);
+    };
+    class PylonRack_4Rnd_ACE_Hellfire_AGM114N: PylonRack_4Rnd_ACE_Hellfire_AGM114K { // 4x Launcher Support Rack
+        displayName = "4x AGM-114N [ACE]";
+        displayNameShort = "AGM-114N";
+        descriptionShort = "AGM-114N";
+        ammo = "ACE_Hellfire_AGM114N";
+        pylonWeapon = QGVAR(launcher_N);
+    };
 };
diff --git a/addons/hellfire/CfgWeapons.hpp b/addons/hellfire/CfgWeapons.hpp
index 1b9a76352e..483f1dd0a7 100644
--- a/addons/hellfire/CfgWeapons.hpp
+++ b/addons/hellfire/CfgWeapons.hpp
@@ -1,7 +1,7 @@
 class CfgWeapons {
     class missiles_SCALPEL;
     class GVAR(launcher): missiles_SCALPEL {
-        displayName = CSTRING(Hellfire);
+        displayName = "AGM-114K Hellfire II";
         GVAR(enabled) = 1; // show attack profile / lock on hud
         EGVAR(laser,canSelect) = 1; // can ace_laser lock (allows switching laser code)
         canLock = 0;
@@ -10,4 +10,8 @@ class CfgWeapons {
         lockingTargetSound[] = {"",0,1};
         lockedTargetSound[] = {"",0,1};
     };
+    class GVAR(launcher_N): GVAR(launcher) {
+        displayName = "AGM-114N Hellfire II";
+        magazines[] = {"6Rnd_ACE_Hellfire_AGM114N", "PylonMissile_1Rnd_ACE_Hellfire_AGM114N", "PylonRack_1Rnd_ACE_Hellfire_AGM114N", "PylonRack_3Rnd_ACE_Hellfire_AGM114N", "PylonRack_4Rnd_ACE_Hellfire_AGM114N"};
+    };
 };
diff --git a/addons/hellfire/functions/fnc_setupVehicle.sqf b/addons/hellfire/functions/fnc_setupVehicle.sqf
index bec56d52a7..811e6c6f3f 100644
--- a/addons/hellfire/functions/fnc_setupVehicle.sqf
+++ b/addons/hellfire/functions/fnc_setupVehicle.sqf
@@ -61,7 +61,7 @@ private _fnc_condition = {
     params ["_target", "_player", "_attackProfile"];
     
     private _turretPath = if (ACE_player == (driver _target)) then {[-1]} else {ACE_player call CBA_fnc_turretPath};
-    private _hasWeapon = ({QGVAR(launcher) == _x} count (_target weaponsTurret _turretPath)) > 0;
+    private _hasWeapon = ({(isNumber (configFile >> "CfgWeapons" >> _x >> QGVAR(enabled))) && {getNumber (configFile >> "CfgWeapons" >> _x >> QGVAR(enabled)) > 0}} count (_target weaponsTurret _turretPath)) > 0;
 
     (_hasWeapon) &&
     {(_target getVariable [QEGVAR(missileguidance,attackProfile), "hellfire"]) != _attackProfile};
diff --git a/addons/hellfire/stringtable.xml b/addons/hellfire/stringtable.xml
index d01acd49b4..8afbad9bd8 100644
--- a/addons/hellfire/stringtable.xml
+++ b/addons/hellfire/stringtable.xml
@@ -1,21 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project name="ACE">
     <Package name="Hellfire">
-        <Key ID="STR_ACE_Hellfire_Hellfire">
-            <English>Hellfire</English>
-            <Spanish>Hellfire</Spanish>
-            <French>Hellfire</French>
-            <Polish>Hellfire</Polish>
-            <German>Hellfire</German>
-            <Czech>Hellfire</Czech>
-            <Italian>Hellfire</Italian>
-            <Portuguese>Hellfire</Portuguese>
-            <Hungarian>Hellfire</Hungarian>
-            <Russian>Hellfire</Russian>
-            <Japanese>ヘルファイア</Japanese>
-            <SChinese>地狱火</SChinese>
-            <TChinese>地獄火</TChinese>
-        </Key>
         <Key ID="STR_ACE_Hellfire_hellfireModeAction">
             <English>Set Hellfire mode</English>
             <Italian>Imposta modalità Hellfire</Italian>