Skip to content

Commit

Permalink
Added pylon for our fixed wings as well as AH64D
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBrostrom committed Aug 11, 2023
1 parent d8be87b commit 5af15f1
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 37 deletions.
21 changes: 20 additions & 1 deletion cScripts/functions/vehicle/fn_vehicle_addDefaultLoadout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,29 @@ if (_vehicle iskindOf "rhsusf_m1a1tank_base") then {
_pylon = ["rhsusf_m1a1tank_base", "default"] call EFUNC(vehicle,getPylon);
[_vehicle, "default", _pylon] call EFUNC(vehicle,applyLoadout);
};

if (_vehicle iskindOf "I_APC_Wheeled_03_cannon_F" && !(_vehicle isKindOf "cav_dragoon_unarmed_base_F")) then {
_pylon = ["I_APC_Wheeled_03_cannon_F", "default"] call EFUNC(vehicle,getPylon);
[_vehicle, "default", _pylon] call EFUNC(vehicle,applyLoadout);
};

//FixedWings
if (_vehicle iskindOf "USAF_A10") then {
_pylon = ["USAF_A10", "default"] call EFUNC(vehicle,getPylon);
[_vehicle, "default", _pylon] call EFUNC(vehicle,applyLoadout);
};
if (_vehicle iskindOf "USAF_F22_EWP_AG") then {
_pylon = ["USAF_F22_EWP_AG", "default"] call EFUNC(vehicle,getPylon);
[_vehicle, "default", _pylon] call EFUNC(vehicle,applyLoadout);
};
if (_vehicle iskindOf "USAF_F35A") then {
_pylon = ["USAF_F35A", "default"] call EFUNC(vehicle,getPylon);
[_vehicle, "default", _pylon] call EFUNC(vehicle,applyLoadout);
};

//Helicopters
if (_vehicle iskindOf "RHS_AH64D") then {
_pylon = ["RHS_AH64D", "default"] call EFUNC(vehicle,getPylon);
[_vehicle, "default", _pylon] call EFUNC(vehicle,applyLoadout);
};

_vehicle setVariable [QEGVAR(Vehicle,PylonApplyed), true, true];
69 changes: 44 additions & 25 deletions cScripts/functions/vehicle/fn_vehicle_applyLoadout.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define DEBUG_MODE
#include "..\script_component.hpp";
/*
* Author: CPL.Brostrom.A
Expand All @@ -10,6 +11,12 @@
*
* Example:
* ["vic", "default", []] call cScripts_fnc_vehicle_applyLoadout;
* ["vic", "default", [["SmokeLauncherMag",[0,0],6]]] call cScripts_fnc_vehicle_applyLoadout;
* ["vic", "default", [["60Rnd_30mm_APFSDS_shells_Tracer_Red",[0],60],["2000Rnd_762x51_Belt_T_Red",[0],2000]] call cScripts_fnc_vehicle_applyLoadout;
* ["vic", "default", ["","rhs_mag_M151_19","rhs_mag_AGM114L_4","rhs_mag_AGM114K_4","rhs_mag_M151_19","","rhsusf_M130_CMFlare_Chaff_Magazine_x2"]] call cScripts_fnc_vehicle_applyLoadout;
*
* _var = ["rhsusf_m1a1tank_base", "default"] call cScripts_fnc_vehicle_getPylon;
* ["vic", "default", _var] call cScripts_fnc_vehicle_applyLoadout;
*/

params [
Expand All @@ -25,32 +32,44 @@ if (count _vehicleLoadout == 0) exitWith {};

INFO_3("VehiclePylonApply", "Applying pylon '%1' to %2 (%3)", _loadoutName, _vehicle, typeOf _vehicle);

// Rearm vehicle first
_vehicle setVehicleAmmo 1;

// Clear magazine
{
_x params ["_magazineClassname", "_turretPath"];
INFO_4("VehiclePylonApply", "Removing magazine '%1' in turrent %2 to %3 (%4)", _magazineClassname, _turretPath, _vehicle, typeOf _vehicle);
_vehicle removeMagazinesTurret [_magazineClassname, _turretPath];
} forEach magazinesAllTurrets _vehicle;

// Add magazine
{
_x params [
["_magazineClassname", "", [""]],
["_turretPath", [], [[]]],
["_amount", -1, [0]]
];
if (_amount != 0) then {
INFO_5("VehiclePylonApply", "Adding magazine '%1' (%2) in turrent %23 to %4 (%5)", _magazineClassname, _amount, _turretPath, _vehicle, typeOf _vehicle);
_vehicle addMagazineTurret [
_magazineClassname,
_turretPath,
if (_amount < 0) then {getNumber (configFile >> "CfgMagazines" >> _magazineClassname >> "count")} else {_amount}
if (_vehicleLoadout#0 isEqualType []) then {
// Rearm vehicle first
_vehicle setVehicleAmmo 1;

// Clear magazine
{
INFO_4("VehiclePylonApply", "Removing magazine '%1' in turrent %2 to %3 (%4)", _magazineClassname, _turretPath, _vehicle, typeOf _vehicle);
_x params ["_magazineClassname", "_turretPath"];
_vehicle removeMagazinesTurret [_magazineClassname, _turretPath];
} forEach magazinesAllTurrets _vehicle;

// Add magazine
{
_x params [
["_magazineClassname", "", [""]],
["_turretPath", [], [[]]],
["_amount", -1, [0]]
];
};
} forEach _vehicleLoadout;
if (_amount != 0) then {
INFO_5("VehiclePylonApply", "Adding magazine '%1' (%2) in turrent %23 to %4 (%5)", _magazineClassname, _amount, _turretPath, _vehicle, typeOf _vehicle);
_vehicle addMagazineTurret [
_magazineClassname,
_turretPath,
if (_amount < 0) then {getNumber (configFile >> "CfgMagazines" >> _magazineClassname >> "count")} else {_amount}
];
};
} forEach _vehicleLoadout;
} else {
// Rearm vehicle first
_vehicle setVehicleAmmo 1;

// Add magazine
{
private _pylonIndex = _forEachIndex + 1;
INFO_4("VehiclePylonApply", "Adding pylon index %1: '%2' to %3 (%4)", _pylonIndex, _x, _vehicle, typeOf _vehicle);
_vehicle setPylonLoadout [_pylonIndex, _x, true];
} forEach _vehicleLoadout;
};

INFO_3("VehiclePylonApply", "Vehicle %1 (%2) have been rearmed with '%3'", _vehicle, typeOf _vehicle, _loadoutName);
_vehicle setVariable [QEGVAR(vehicle,pylon), [_loadoutName, _vehicleLoadout], true];
113 changes: 112 additions & 1 deletion cScripts/functions/vehicle/fn_vehicle_getPylon.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,121 @@ private _I_APC_Wheeled_03_cannon_F = createHashMapFromArray [
]]
];

// FixedWings
// getPylonMagazines cursorObject

// USAF_A10
private _USAF_A10 = createHashMapFromArray [
["default", [
"USAF_PylonRack_2Rnd_AIM9X_LAU105",
"USAF_PylonRack_1Rnd_ANAAQ28",
"USAF_PylonRack_2Rnd_AGM65K",
"USAF_PylonRack_1Rnd_GBU54",
"USAF_PylonRack_1Rnd_GBU12",
"",
"USAF_PylonRack_1Rnd_GBU12",
"USAF_PylonRack_1Rnd_GBU54",
"USAF_PylonRack_2Rnd_AGM65D",
"USAF_PylonRack_7Rnd_APKWS",
"USAF_PylonRack_1Rnd_ANALQ131"
]],
["groundsuperiority", [
"USAF_PylonRack_21Rnd_HYDRA70",
"USAF_PylonRack_21Rnd_HYDRA70",
"USAF_PylonRack_21Rnd_HYDRA70",
"USAF_PylonRack_21Rnd_HYDRA70",
"USAF_PylonRack_1Rnd_GBU12",
"",
"USAF_PylonRack_1Rnd_GBU12",
"USAF_PylonRack_21Rnd_HYDRA70",
"USAF_PylonRack_21Rnd_HYDRA70",
"USAF_PylonRack_21Rnd_HYDRA70",
"USAF_PylonRack_21Rnd_HYDRA70"
]],
["test", [
"rhs_mag_b8m1_s8kom",
"rhs_mag_b8m1_s8kom",
"rhs_mag_b8m1_s8kom",
"rhs_mag_b8m1_s8kom",
"USAF_PylonRack_1Rnd_GBU12",
"",
"USAF_PylonRack_1Rnd_GBU12",
"rhs_mag_b8m1_s8kom",
"rhs_mag_b8m1_s8kom",
"rhs_mag_b8m1_s8kom",
"rhs_mag_b8m1_s8kom"
]]
];

// USAF_F22_EWP_AG
private _USAF_F22_EWP_AG = createHashMapFromArray [
["default", [
"",
"",
"USAF_MISSILE_1Rnd_AIM9X",
"USAF_Missile_1Rnd_AIM120_Int",
"USAF_PylonRack_4Rnd_GBU53",
"USAF_PylonRack_4Rnd_GBU53",
"USAF_Missile_1Rnd_AIM120_Int",
"USAF_MISSILE_1Rnd_AIM9X",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"USAF_PylonRack_4Rnd_GBU53",
"USAF_PylonRack_4Rnd_GBU53"
]]
];

// USAF_F35A
private _USAF_F35A = createHashMapFromArray [
["default", [
"USAF_MISSILE_1Rnd_AIM9X",
"USAF_PylonRack_1Rnd_AIM120",
"USAF_PylonRack_1Rnd_AIM120",
"USAF_Missile_1Rnd_AIM120",
"USAF_PylonRack_4Rnd_GBU53",
"USAF_PylonRack_4Rnd_GBU53",
"USAF_Missile_1Rnd_AIM120",
"USAF_PylonRack_1Rnd_AIM120",
"USAF_PylonRack_1Rnd_AIM120",
"USAF_MISSILE_1Rnd_AIM9X"
]]
];

// Helicopters
// RHS_AH64D
private _RHS_AH64D = createHashMapFromArray [
["default", [
"", // Wing tips
"rhs_mag_M151_19",
"rhs_mag_AGM114L_4",
"rhs_mag_AGM114K_4",
"rhs_mag_M151_19",
"", // Wing tips
"rhsusf_M130_CMFlare_Chaff_Magazine_x2"
]]
];


// Loadout vehicle list
private _pylons = createHashMapFromArray [
["rhsusf_m1a1tank_base", _rhsusf_m1a1tank_base],
["I_APC_Wheeled_03_cannon_F", _I_APC_Wheeled_03_cannon_F]
["I_APC_Wheeled_03_cannon_F", _I_APC_Wheeled_03_cannon_F],

// FixedWings
["USAF_A10", _USAF_A10],
["USAF_F22_EWP_AG", _USAF_F22_EWP_AG],
["USAF_F35A", _USAF_F35A],

// Helicopters
["RHS_AH64D", _RHS_AH64D]
];

private _getVehiclePylons = _pylons getOrDefault [_vehicleKind, []];
Expand Down
50 changes: 40 additions & 10 deletions cScripts/functions/vehicle/fn_vehicle_setupPylonCategories.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,53 @@ private _pylonList = [];

if (_vehicle iskindOf "rhsusf_m1a1tank_base") then {
_pylonList = [
// TypeOf, DisplayName, Name, Icon
["rhsusf_m1a1tank_base", "Hard", "hard", ""],
["rhsusf_m1a1tank_base", "Soft", "soft", ""],
["rhsusf_m1a1tank_base", "Default", "default", ""]
// TypeOf, DisplayName, Name, Icon
["rhsusf_m1a1tank_base", "Hard", "hard", ""],
["rhsusf_m1a1tank_base", "Soft", "soft", ""],
["rhsusf_m1a1tank_base", "Default", "default", ""]
];
};


if (_vehicle iskindOf "I_APC_Wheeled_03_cannon_F" && !(_vehicle isKindOf "cav_dragoon_unarmed_base_F")) then {
_pylonList = [
// TypeOf, DisplayName, Name, Icon
["I_APC_Wheeled_03_cannon_F", "Anti-Armor", "antiarmor", ""],
["I_APC_Wheeled_03_cannon_F", "Anti-Air", "antiair", ""],
["I_APC_Wheeled_03_cannon_F", "Assault", "assault", ""],
["I_APC_Wheeled_03_cannon_F", "Default", "default", ""]
["I_APC_Wheeled_03_cannon_F", "Anti-Armor", "antiarmor", ""],
["I_APC_Wheeled_03_cannon_F", "Anti-Air", "antiair", ""],
["I_APC_Wheeled_03_cannon_F", "Assault", "assault", ""],
["I_APC_Wheeled_03_cannon_F", "Default", "default", ""]
];
};

// FixedWings
if (_vehicle iskindOf "USAF_A10") then {
_pylonList = [
// TypeOf, DisplayName, Name, Icon
["USAF_A10", "Default", "default", ""],
["USAF_A10", "Ground Superiority", "groundsuperiority", ""]
];
};
if (_vehicle iskindOf "USAF_F22_EWP_AG") then {
_pylonList = [
// TypeOf, DisplayName, Name, Icon
["USAF_F22_EWP_AG", "Default", "default", ""]
];
};
if (_vehicle iskindOf "USAF_F35A") then {
_pylonList = [
// TypeOf, DisplayName, Name, Icon
["USAF_F35A", "Default", "default", ""]
];
};

//Helicopters
if (_vehicle iskindOf "RHS_AH64D") then {
_pylonList = [
// TypeOf, DisplayName, Name, Icon
["RHS_AH64D", "Default", "default", ""]
];
};





if (count _pylonList == 0) exitWith {false};
Expand Down

0 comments on commit 5af15f1

Please sign in to comment.