From 579d43417f648d3da527b38368cf6d5f9191eb47 Mon Sep 17 00:00:00 2001 From: Tiny-DM <148804148+Tiny-DM@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:51:54 -0500 Subject: [PATCH] Helicopter Config Loadouts (#3423) * added helicopter loadout support * Update fn_setPlaneLoadout.sqf --- A3A/addons/config_fixes/RF/CfgVehicles.hpp | 115 +----------------- .../Templates/AircraftLoadouts/RF/config.cpp | 43 +++++++ .../core/functions/AI/fn_attackHeli.sqf | 4 +- .../functions/Base/fn_setPlaneLoadout.sqf | 41 +++---- 4 files changed, 68 insertions(+), 135 deletions(-) create mode 100644 A3A/addons/core/Templates/AircraftLoadouts/RF/config.cpp diff --git a/A3A/addons/config_fixes/RF/CfgVehicles.hpp b/A3A/addons/config_fixes/RF/CfgVehicles.hpp index f113862ba6..9701ec0723 100644 --- a/A3A/addons/config_fixes/RF/CfgVehicles.hpp +++ b/A3A/addons/config_fixes/RF/CfgVehicles.hpp @@ -16,6 +16,8 @@ class CfgVehicles class B_Heli_EC_04_military_rf; class B_Heli_EC_03_rf; class I_Pickup_aat_rf; + class B_Heli_light_03_dynamicLoadout_rf; + class Heli_EC_02_base_rf; class a3a_armored_Pickup_rf : I_G_Pickup_rf { animationList[] = {"hide_bullbar",0.2,"hide_fuel_tank",1,"hide_snorkel",1,"hide_antenna",1,"hide_trunk_cover",1,"hide_trunk_door",0,"trunk_door_open",0,"hide_armor_window_armor_top",0,"window_armor_hatch_L_rot",1,"window_armor_hatch_R_rot",0,"door_F_L_open",0,"door_F_R_open",0,"door_R_L_open",0,"door_R_R_open",0,"hide_rack",1,"hide_rack_spotlights",1,"hide_frame",1,"hide_sidesteps",0.5}; @@ -113,64 +115,7 @@ class CfgVehicles textureList[] = {}; hiddenSelectionstextures[] = {"\lxRF\vehicles_rf\pickup_01\Data\pickup_01_ext_gendarmerie_co.paa","\lxRF\vehicles_rf\pickup_01\Data\pickup_01_adds_gendarmerie_co.paa","\lxrf\vehicles_rf\pickup_01\data\pickup_01_ext2_co.paa","\lxrf\vehicles_rf\pickup_01\data\pickup_01_AAT_olive_co.paa","\lxrf\vehicles_rf\pickup_01\data\pickup_01_Launcher_black_co.paa","\lxRF\vehicles_rf\pickup_01\Data\pickup_01_service_gendarmerie_co.paa"}; }; - - class Heli_light_03_dynamicLoadout_base_F: Heli_light_03_base_F { - class Components; - }; - class B_Heli_light_03_dynamicLoadout_rf: Heli_light_03_dynamicLoadout_base_F { - class Components : Components { - class TransportPylonsComponent; - }; - }; - class a3a_Heli_light_03_dynamicLoadout_rf : B_Heli_light_03_dynamicLoadout_rf { // !!!! This is the Olive paint by default. It's more of a bluish-gray though - class Components : Components { - class TransportPylonsComponent : TransportPylonsComponent { - class Presets { - class Default { - attachment[] = {"PylonRack_19Rnd_missiles_gray_RF","PylonWeapon_1000Rnd_20x102mm_shells_gray_RF","PylonRack_19Rnd_missiles_gray_RF","PylonWeapon_1000Rnd_20x102mm_shells_gray_RF"}; - displayName = "Default"; - }; - class Empty { - attachment[] = {}; - displayName = "Empty"; - }; - }; - class Pylons { - class PylonLeft1 { - attachment = "PylonRack_19Rnd_missiles_gray_RF"; - hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"}; - priority = 5; - turret[] = {0}; - UIposition[] = {"0.06 + 0.02",0.4}; - }; - class PylonLeft2 { - attachment = "PylonWeapon_1000Rnd_20x102mm_shells_gray_RF"; - hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"}; - priority = 4; - turret[] = {0}; - UIposition[] = {"0.08 + 0.02",0.35}; - }; - class PylonRight1 { - attachment = "PylonRack_19Rnd_missiles_gray_RF"; - hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"}; - priority = 5; - mirroredMissilePos = 1; - turret[] = {0}; - UIposition[] = {"0.59 + 0.04",0.4}; - }; - class PylonRight2 { - attachment = "PylonWeapon_1000Rnd_20x102mm_shells_gray_RF"; - hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"}; - priority = 4; - mirroredMissilePos = 2; - turret[] = {0}; - UIposition[] = {"0.57 + 0.04",0.35}; - }; - - }; - }; - }; - }; + class a3a_Heli_light_03_dynamicLoadout_rf : B_Heli_light_03_dynamicLoadout_rf {}; class a3a_AAF_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf { textureList[] = {}; hiddenSelectionsTextures[] = {"\A3\Air_F_EPB\Heli_Light_03\data\Heli_Light_03_base_INDP_CO.paa","\lxRF\air_rf\Heli_Light_03\data\wildcat_addons_INDP_co.paa"}; @@ -208,65 +153,11 @@ class CfgVehicles hiddenSelectionsTextures[] = {"\lxRF\air_rf\Heli_Light_03\data\Heli_Light_03_base_tan_CO.paa","\lxRF\air_rf\Heli_Light_03\data\wildcat_addons_tan_co.paa"}; }; - class Heli_EC_02_base_rf: Heli_EC_01_base_rf { - class Components; - }; class a3a_Heli_EC_02_rf : Heli_EC_02_base_rf { // Default camo is a lovely tan, perfect for patrolling your local desert scope = 2; faction = "IND_F"; side = 2; hiddenSelectionsTextures[] = {"\lxRF\air_rf\heli_medium_ec\data\as332_exterior_09_tan_co.paa","\lxRF\air_rf\heli_medium_ec\data\as332_int_cargo_co.paa","#(rgb,1024,1024,1)ui('lxRF_MFDMinimap','lxRF_MFDMinimap')","\lxRF\air_rf\heli_medium_ec\data\as332_adds_09_tan_co.paa","\lxRF\air_rf\heli_medium_ec\data\as332_exterior_09_tan_co.paa","\lxRF\air_rf\heli_medium_ec\data\as332_int_cargo_co.paa"}; - class Components : Components { - class TransportPylonsComponent { - uiPicture = "\lxRF\air_rf\heli_medium_ec\data\UI\heli_medium_ec_02_3DEN_CA.paa"; - class Presets { - class AT { - attachment[] = {"PylonRack_4Rnd_LG_scalpel","PylonRack_4Rnd_LG_scalpel","PylonRack_4Rnd_LG_scalpel","PylonRack_4Rnd_LG_scalpel"}; - displayName = "AT"; - }; - class Default { - attachment[] = {"PylonRack_19Rnd_missiles_olive_rf","PylonRack_4Rnd_LG_scalpel","PylonRack_4Rnd_LG_scalpel","PylonRack_19Rnd_missiles_olive_rf"}; - displayName = "Default"; - }; - class Empty { - attachment[] = {}; - displayName = "Empty"; - }; - }; - class Pylons { - class PylonLeft1 { - attachment = "PylonRack_19Rnd_missiles_olive_RF"; - hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"}; - priority = 5; - turret[] = {0}; - UIposition[] = {0.06,0.4}; - }; - class PylonLeft2 { - attachment = "PylonRack_4Rnd_LG_scalpel"; - hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"}; - priority = 4; - turret[] = {0}; - UIposition[] = {0.08,0.35}; - }; - class PylonRight1 { - attachment = "PylonRack_4Rnd_LG_scalpel"; - hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"}; - priority = 5; - mirroredMissilePos = 2; - turret[] = {0}; - UIposition[] = {0.57,0.35}; - }; - class PylonRight2 { - attachment = "PylonRack_19Rnd_missiles_olive_RF"; - hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"}; - priority = 4; - mirroredMissilePos = 1; - turret[] = {0}; - UIposition[] = {0.59,0.4}; - }; - }; - }; - }; }; class a3a_LDF_Heli_EC_02_rf : a3a_Heli_EC_02_rf { factions = "IND_E_F"; diff --git a/A3A/addons/core/Templates/AircraftLoadouts/RF/config.cpp b/A3A/addons/core/Templates/AircraftLoadouts/RF/config.cpp new file mode 100644 index 0000000000..c2c37d527e --- /dev/null +++ b/A3A/addons/core/Templates/AircraftLoadouts/RF/config.cpp @@ -0,0 +1,43 @@ +#include "..\..\..\script_component.hpp" + +class CfgPatches +{ + class PATCHNAME(AirLoadout_RF) + { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"RF_Vehicles"}; + skipWhenMissingDependencies = 1; + author = AUTHOR; + authors[] = { AUTHORS }; + authorUrl = ""; + VERSION_CONFIG; + }; +}; + +class A3A { + class Loadouts + { + class Helicopter + { + class baseHelicopter; + class a3a_Heli_light_03_dynamicLoadout_rf : baseHelicopter { + loadout[] = {"PylonRack_19Rnd_missiles_gray_RF","PylonWeapon_1000Rnd_20x102mm_shells_gray_RF","PylonRack_19Rnd_missiles_gray_RF","PylonWeapon_1000Rnd_20x102mm_shells_gray_RF"}; + }; + class a3a_Heli_EC_02_rf : baseHelicopter { + loadout[] = {"PylonRack_19Rnd_missiles_olive_RF","PylonRack_4Rnd_LG_scalpel","PylonRack_4Rnd_LG_scalpel","PylonRack_19Rnd_missiles_olive_RF"}; + }; + class a3a_AAF_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf {}; + class a3a_LDF_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf {}; + class a3a_black_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf {}; + class a3a_tan_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf {}; + class a3a_green_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf {}; + class a3a_LDF_Heli_EC_02_rf : a3a_Heli_EC_02_rf {}; + class a3a_AAF_Heli_EC_02_rf : a3a_Heli_EC_02_rf {}; + class a3a_black_Heli_EC_02_rf : a3a_Heli_EC_02_rf {}; + class a3a_sfia_Heli_EC_02_rf : a3a_Heli_EC_02_rf {}; + }; + }; +}; \ No newline at end of file diff --git a/A3A/addons/core/functions/AI/fn_attackHeli.sqf b/A3A/addons/core/functions/AI/fn_attackHeli.sqf index af367552bf..8a9fc619a5 100644 --- a/A3A/addons/core/functions/AI/fn_attackHeli.sqf +++ b/A3A/addons/core/functions/AI/fn_attackHeli.sqf @@ -1,6 +1,6 @@ /* Persistent AI script to make enemy attack helis behave better Prevents helis giving enemies an easy kill on the first pass, and hovering once they run out of targets - + Also gives the heli a custom loadout if it exists Scope: Server or HC Environment: Spawned @@ -19,9 +19,9 @@ Arguments: FIX_LINE_NUMBERS() params ["_vehicle", "_group", "_targPos"]; - // Set script handle so abort routines can remove it later _group setVariable ["A3A_AIScriptHandle", _thisScript]; +[_vehicle, "HELICOPTER"] call A3A_fnc_setPlaneLoadout; while {count waypoints _group > 0} do { deleteWaypoint [_group, 0] }; _group setBehaviourStrong "COMBAT"; diff --git a/A3A/addons/core/functions/Base/fn_setPlaneLoadout.sqf b/A3A/addons/core/functions/Base/fn_setPlaneLoadout.sqf index 8a4eaa5147..48d67721e8 100644 --- a/A3A/addons/core/functions/Base/fn_setPlaneLoadout.sqf +++ b/A3A/addons/core/functions/Base/fn_setPlaneLoadout.sqf @@ -3,7 +3,7 @@ params ["_plane", "_type"]; /* Equips a plane with the needed loadout Params: _plane: OBJECT : The actual plane object - _type: STRING : The type of attack plane, either "CAS" or "AA" + _type: STRING : The type of attack plane, either "CAS" or "AA" or "HELICOPTER" Returns: Nothing */ @@ -11,41 +11,40 @@ params ["_plane", "_type"]; FIX_LINE_NUMBERS() private _loadout = []; - -if (_type == "CAS") then +private _configType = switch (_type) do { - private _configPath = configFile >> "A3A" >> "Loadouts" >> "CASPlane" >> typeOf _plane; + case "CAS": {"CASPlane"}; + case "AA": {"CAPPlane"}; + case "HELICOPTER": {"Helicopter"}; + default {"None"} +}; + +if (_configType == "None") exitWith { + Error_1("Invalid type - Entry in ['CAS','AA','HELICOPTER'] expected - %1 recieved", typeOf _plane); +}; + +private _configPath = configFile >> "A3A" >> "Loadouts" >> _configType >> typeOf _plane; - if(isNull _configPath) then { - Error_1("%1 has no loadout set", typeOf _plane); - }; +if (isNull _configPath) exitWith { + Debug_1("%1 has no loadout set, exiting", typeOf _plane); +}; - _loadout = getArray(_configPath >> "loadout"); +_loadout = getArray(_configPath >> "loadout"); +if (_type == "CAS") then { _plane setVariable ["mainGun", getArray(_configPath >> "mainGun") select 0]; _plane setVariable ["rocketLauncher", getArray(_configPath >> "rocketLauncher")]; _plane setVariable ["missileLauncher", getArray(_configPath >> "missileLauncher")]; _plane setVariable ["bombRacks", getArray(_configPath >> "bombRacks")]; _plane setVariable ["diveParams", getArray(_configPath >> "diveParams")]; - - [_plane, _type] call (compile (getText(_configPath >> "code"))); }; -if (_type == "AA") then -{ - private _configPath = configFile >> "A3A" >> "Loadouts" >> "CAPPlane" >> typeOf _plane; - if(isNull _configPath) then { - Error_1("%1 has no loadout set", typeOf _plane); - }; - - _loadout = getArray(_configPath >> "loadout"); - [_plane, _type] call (compile (getText(_configPath >> "code"))); -}; +[_plane, _type] call (compile (getText(_configPath >> "code"))); if !(_loadout isEqualTo []) then { - Debug("Selected new loadout for plane, now equiping plane with it"); + Debug("Selected new loadout for %1, now equipping %2 with it",typeOf _plane, _plane); { _plane setPylonLoadout [_forEachIndex + 1, _x, true]; _plane setVariable ["loadout", _loadout];