diff --git a/cScripts/CfgFunctions.hpp b/cScripts/CfgFunctions.hpp index 75b0e02aa..f123cd239 100644 --- a/cScripts/CfgFunctions.hpp +++ b/cScripts/CfgFunctions.hpp @@ -236,7 +236,7 @@ class cScripts { class gear_hasSavedLoadout {}; // other - class gear_getLoadoutRole {}; + class gear_getLoadoutTags {}; class gear_getLoadoutName {}; }; class diag { diff --git a/cScripts/functions/gear/fn_gear_getLoadoutRole.sqf b/cScripts/functions/gear/fn_gear_getLoadoutRole.sqf deleted file mode 100644 index 71488a4c4..000000000 --- a/cScripts/functions/gear/fn_gear_getLoadoutRole.sqf +++ /dev/null @@ -1,25 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: CPL.Brostrom.A - * This function return your role - * - * Arguments: - * None - * - * Return Value: - * Role - * - * Example: - * call cScripts_fnc_gear_getLoadoutRole - * - */ - -private _return = "trooper"; - -private _loadout = GETVAR(player,EGVAR(Gear,loadoutClass),typeOf player); - -private _config = missionConfigFile >> "CfgLoadouts" >> _loadout; -private _role = getText (_config >> "role"); -if (_role != "") then {_return = _role}; - -_return \ No newline at end of file diff --git a/cScripts/functions/gear/fn_gear_getLoadoutTags.sqf b/cScripts/functions/gear/fn_gear_getLoadoutTags.sqf index 77ba640f3..6bc8ab95b 100644 --- a/cScripts/functions/gear/fn_gear_getLoadoutTags.sqf +++ b/cScripts/functions/gear/fn_gear_getLoadoutTags.sqf @@ -14,12 +14,10 @@ * */ -private _return = []; - -private _loadout = GETVAR(player,EGVAR(Gear,loadoutClass),typeOf player); +private _loadout = GETVAR(player,EGVAR(Gear,loadoutClass), typeOf player); private _config = missionConfigFile >> "CfgLoadouts" >> _loadout; private _tags = getArray (_config >> "equipmentTags"); -if (_tags != "") then {_return = _tags}; +if (_tags isEqualTo []) then {[]}; -_return +_tags diff --git a/cScripts/functions/systems/fn_getArsenalWhitelist.sqf b/cScripts/functions/systems/fn_getArsenalWhitelist.sqf index 469da7945..6362df9b4 100644 --- a/cScripts/functions/systems/fn_getArsenalWhitelist.sqf +++ b/cScripts/functions/systems/fn_getArsenalWhitelist.sqf @@ -37,26 +37,30 @@ private _companyItems = switch (_company) do { }; -private _roleSpecific = switch ([player] call EFUNC(gear,getLoadoutRole)) do { - case "officer": {GET_CONTAINER_KEYS("arsenal_role_officer");}; - case "squadleader": {GET_CONTAINER_KEYS("arsenal_role_squadleader");}; - case "fireteamleader": {GET_CONTAINER_KEYS("arsenal_role_fireteamleader");}; - case "weapons": {GET_CONTAINER_KEYS("arsenal_role_weapons");}; - case "pilot"; - case "rotarypilot": {GET_CONTAINER_KEYS("arsenal_role_rotarypilot");}; - case "rotarycrew": {GET_CONTAINER_KEYS("arsenal_role_pilotcrew");}; - case "rotarycls": { - private _rotaryRole = GET_CONTAINER_KEYS("arsenal_role_pilotcrew"); - private _clsRole = GET_CONTAINER_KEYS("arsenal_role_cls"); - _rotaryRole + _clsRole; +private _tagGear = []; +{ + private _tag = switch (_x) do { + case "role_officer": {GET_CONTAINER_KEYS("arsenal_role_officer");}; + case "role_squadleader": {GET_CONTAINER_KEYS("arsenal_role_squadleader");}; + case "role_fireteamleader": {GET_CONTAINER_KEYS("arsenal_role_fireteamleader");}; + case "role_weapons": {GET_CONTAINER_KEYS("arsenal_role_weapons");}; + case "role_pilot"; + case "role_rotarypilot": {GET_CONTAINER_KEYS("arsenal_role_rotarypilot");}; + case "role_rotarycrew": {GET_CONTAINER_KEYS("arsenal_role_pilotcrew");}; + case "role_rotarycls": { + private _rotaryRole = GET_CONTAINER_KEYS("arsenal_role_pilotcrew"); + private _clsRole = GET_CONTAINER_KEYS("arsenal_role_cls"); + _rotaryRole + _clsRole; + }; + case "role_pilotfighter": {GET_CONTAINER_KEYS("arsenal_role_pilotfighter");}; + case "role_pilottransport": {GET_CONTAINER_KEYS("arsenal_role_pilottransport");}; + case "role_cls": {GET_CONTAINER_KEYS("arsenal_role_cls");}; + case "role_medic": {GET_CONTAINER_KEYS("arsenal_role_medic");}; + case "role_doctor": {GET_CONTAINER_KEYS("arsenal_role_doctor");}; + default {[]}; }; - case "pilotfighter": {GET_CONTAINER_KEYS("arsenal_role_pilotfighter");}; - case "pilottransport": {GET_CONTAINER_KEYS("arsenal_role_pilottransport");}; - case "cls": {GET_CONTAINER_KEYS("arsenal_role_cls");}; - case "medic": {GET_CONTAINER_KEYS("arsenal_role_medic");}; - case "doctor": {GET_CONTAINER_KEYS("arsenal_role_doctor");}; - default {[]}; -}; + _tagGear append _x; +} forEach [player] call EFUNC(gear,getLoadoutRole) ; private _primaryWeapon = if (!isNil{_loadout#0#0}) then {_loadout#0#0} else {""}; @@ -97,6 +101,6 @@ private _launcherSpecific = switch (true) do { default {[]}; }; -private _whitelist = _commonGear + _unitItems + _companyItems + _roleSpecific + _medicGear + _primarySpecific + _handgunSpecific + _launcherSpecific; +private _whitelist = _commonGear + _unitItems + _companyItems + _tagGear + _primarySpecific + _handgunSpecific + _launcherSpecific; _whitelist