Arma 3
Iron Front 44 + IFA3 Liberation Smarter Tanks
{RP}Alan  [developer] Oct 15, 2017 @ 10:16pm
Weapon lists
// Returns an array of weapons classes present on unit:
// [0: has_cannon, 1: has_autocannon, 2: has_mg, 3: has_at_rocket,
// 4: has_he_rocket, 5: has_gmg, 6: has_hmg, 7: has_autocannon_aa,
// 8: has_aa_rocket]
// Params:
// 0: unit
list_weapons = {
private["_unit", "_cannon", "_autocannon", "_mg", "_at_rocket", "_he_rocket",
"_gmg", "_hmg", "_autocannon_aa", "_titan_rocket", "_aa_rocket_mag",
"_at_rocket_mag", "_aa_rocket", "_has_weapons", "_all_weapons", "_i", "_wep",
"_y"];

_unit = _this select 0;
_has_weapons = [false, false, false, false, false, false, false, false, false];
_i = 0;
_wep = [];

// Slammer, Slammer UP, Varsuk, Kuma, IS2, Sherman, PIV, StuG, T34/76, T34/85, SU85, Tiger, KingTiger, Pak40, Zis3, Shermans, Stuarts, Hetzer, KV1, Puma, PIII, PII, sdkfz7AA, Sdkfz234
_cannon = ["cannon_120mm", "cannon_105mm", "cannon_125mm", "cannon_120mm_long", "LIB_D25T", "LIB_M3_L40", "LIB_KwK40_L48", "LIB_KwK42_L70", "LIB_KwK43_L71", "LIB_KwK36_L56", "LIB_StuK40_L48", "LIB_D_5S", "LIB_F34", "LIB_ZIS_S_53", "LIB_Pak40", "LIB_ZIS3", "LIB_M6_L53", "LIB_M1A2_L55", "LIB_QF17_L55", "IFA3_Pak39_L48", "ifa3_ZIS5","LIB_KWK_38", "IFa3_KwK_39", "IFa3_KwK_37", "LIB_leFH18_L28", "IFa3_K_20", "ifa3_TNSH20", "LIB_M6_L53", "LIB_KwK30_L55", "LIB_KwK39_L60", "LIB_K51_L54", "IFA3_M10T"];

// Marshall, Kamysh, Mora, Gorgon, Wipeout, BA10, M8
_autocannon = ["autocannon_40mm_CTWS", "autocannon_30mm_CTWS",
"autocannon_30mm", "LIB_M2"];

// present on tanks, APCs
_mg = ["LMG_M200", "LMG_coax", "LIB_DT29", "LIB_MG34", "LIB_M1919A4", "LIB_MG34_kurs", "LIB_DT29", "ifa3_DT29_kv_back", "ifa3_DT29_kv_kurs", "ifa3_DT29_kurs", "LIB_DT_bmw", "LIB_M1919A4_kurs", "LIB_M1919A4_coax", "LIB_MG34_coax", "ifa3_DT29_kv_back"];

// Blackfoot, Kajman, Orca, PCML, Alamut, Titan compact, Wipeout, Buzzard, Panzershreck, RPG6
_at_rocket = ["missiles_DAGR", "missiles_SCALPEL", "launch_NLAW_F",
"launch_RPG32_F", "launch_Titan_short_F", "launch_B_Titan_short_F",
"launch_O_Titan_short_F", "launch_I_Titan_short_F",
"Missile_AGM_02_Plane_CAS_01_F", "Rocket_04_AP_Plane_CAS_01_F",
"Missile_AGM_01_Plane_CAS_02_F", "Rocket_03_AP_Plane_CAS_02_F", "LIB_RPzB", "lib_rpg6"];

// Kajman, Hellcat, Pawnee, Katyushka
_he_rocket = ["rockets_Skyfire", "missiles_DAR", "Rocket_03_HE_Plane_CAS_02_F",
"Rocket_04_HE_Plane_CAS_01_F", "LIB_BM13"];

// Panther, Marid, Hunter GMG, Ifrit GMG, Strider GMG, Static GMG, Blackfoot,
// Wipeout, Kajman, Buzzard, Neophrone
// gatling cannons added because of similar damage, flak38, Flakvierling,
_gmg = ["GMG_40mm", "GMG_20mm", "gatling_20mm", "Gatling_30mm_Plane_CAS_01_F",
"gatling_30mm", "Twin_Cannon_20mm", "Cannon_30mm_Plane_CAS_02_F", "LIB_FlaK_38", "LIB_FlaK_38_X4", "LIB_61k"];

// Panther, Marid, Hunter HMG, Ifrit HMG, Strider HMG, Offroad armed
// Static HMG, Varsuk, mg42,
_hmg = ["HMG_127_APC", "HMG_127", "HMG_M2", "HMG_01", "HMG_NSVT", "lib_mg42"];

// Cheetah, Tigris
_autocannon_aa = ["autocannon_35mm"];

// Cheetah, Tigris, Kamysh, Gorgon, Static AT, Static AA
// can be loaded with either AT or AA missiles, need to check available mag
_titan_rocket = ["missiles_titan", "missiles_titan_static"];
_aa_rocket_mag = ["1Rnd_GAA_missiles", "4Rnd_Titan_long_missiles"];
_at_rocket_mag = ["2Rnd_GAT_missiles", "1Rnd_GAT_missiles"];

// Titan MPRL, Buzzard
_aa_rocket = ["launch_Titan_F", "launch_B_Titan_F", "launch_O_Titan_F",
"launch_I_Titan_F", "Missile_AA_04_Plane_CAS_01_F", "missiles_ASRAAM",
"missiles_Zephyr", "Missile_AA_03_Plane_CAS_02_F"];

_all_weapons = [_cannon, _autocannon, _mg, _at_rocket, _he_rocket, _gmg, _hmg,
_autocannon_aa, _aa_rocket];

_wep = _wep + (weapons _unit) + (_unit weaponsTurret [0,0]) +
(_unit weaponsTurret [-1]);

{
_y = _x;
{
if (_x in _y) then {
_has_weapons set [_i, true];
};
} foreach _wep;
_i = _i + 1;
} foreach _all_weapons;

{
_y = _x;
if (_y in _titan_rocket) then {
{
if (_x in _aa_rocket_mag) then {
_has_weapons set [8, true];
};
if (_x in _at_rocket_mag) then {
_has_weapons set [3, true];
};
} foreach (magazines _unit);
};
} foreach _wep;

_has_weapons
};
Last edited by {RP}Alan; Oct 15, 2017 @ 10:18pm