From 46571eb6d13cc58244f25313ea16795fa74ffb57 Mon Sep 17 00:00:00 2001
From: AndreasBrostrom <andreas.brostrom.ce@gmail.com>
Date: Thu, 28 Jul 2022 10:48:59 +0200
Subject: [PATCH] Fixed faction system not implemented in cosmetics

---
 cScripts/functions/vehicle/fn_vehicle_addCosmetics.sqf | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/cScripts/functions/vehicle/fn_vehicle_addCosmetics.sqf b/cScripts/functions/vehicle/fn_vehicle_addCosmetics.sqf
index 29f90bbe4..e45429f32 100644
--- a/cScripts/functions/vehicle/fn_vehicle_addCosmetics.sqf
+++ b/cScripts/functions/vehicle/fn_vehicle_addCosmetics.sqf
@@ -15,7 +15,12 @@ params [["_vehicle", objNull, [objNull]]];
 if (!isServer) exitWith {};
 if (_vehicle iskindOf "man") exitWith {};
 if (!isNil {_vehicle getVariable QEGVAR(Vehicle,Cosmetics);}) exitWith {[formatText["Vehicle cosmetics already applied for %1.", _vehicle]] call FUNC(warning);};
-if (!(faction _vehicle in ["BLU_F", "BLU_CTRG_F", "BLU_T_F", "BLU_USA_7CAV_F", "rhs_faction_usaf", "rhs_faction_usarmy", "rhs_faction_usarmy_d", "rhs_faction_usarmy_wd", "rhs_faction_usmc", "rhs_faction_usmc_d", "rhs_faction_usmc_wd", "rhs_faction_usn"]));
+
+// Is valid vehicle
+private _factionArray = parseSimpleArray EGVAR(Settings,vehicleFactions);
+if !(_factionArray isEqualType []) exitWith {["Faction array have not been setup correctly.", "Vehicle"] call FUNC(error);};
+if (!(faction _vehicle in _factionArray)) exitWith {};
+
 
 private _vehicleType = _vehicle getVariable [QEGVAR(Vehicle,Type), typeOf _vehicle];