Skip to content

Commit

Permalink
Converted role selection to tag selection
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBrostrom committed Apr 1, 2024
1 parent 54010b9 commit 718dd5c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 45 deletions.
2 changes: 1 addition & 1 deletion cScripts/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class cScripts {
class gear_hasSavedLoadout {};

// other
class gear_getLoadoutRole {};
class gear_getLoadoutTags {};
class gear_getLoadoutName {};
};
class diag {
Expand Down
25 changes: 0 additions & 25 deletions cScripts/functions/gear/fn_gear_getLoadoutRole.sqf

This file was deleted.

8 changes: 3 additions & 5 deletions cScripts/functions/gear/fn_gear_getLoadoutTags.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 17 additions & 14 deletions cScripts/functions/systems/fn_getArsenalWhitelist.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,22 @@ private _companyItems = switch (_company) do {
private _medicRole = getNumber (missionConfigFile >> "CfgLoadouts" >> _classname >> "abilityMedic");
private _medicGear = if (_medicRole >= 1) then {GET_CONTAINER_KEYS("bravo_company_atlas");} else {[]};


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 "pilotfighter": {GET_CONTAINER_KEYS("arsenal_role_pilotfighter");};
case "pilottransport": {GET_CONTAINER_KEYS("arsenal_role_pilottransport");};
default {[]};
};
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_pilotfighter": {GET_CONTAINER_KEYS("arsenal_role_pilotfighter");};
case "role_pilottransport": {GET_CONTAINER_KEYS("arsenal_role_pilottransport");};
default {[]};
};
_tagGear append _x;
} forEach [player] call EFUNC(gear,getLoadoutRole) ;


private _primaryWeapon = if (!isNil{_loadout#0#0}) then {_loadout#0#0} else {""};
Expand All @@ -74,6 +77,6 @@ private _weaponSystemSpecific = switch (true) do {
default {[]};
};

private _whitelist = _commonGear + _unitItems + _companyItems + _roleSpecific + _medicGear + _weaponSystemSpecific;
private _whitelist = _commonGear + _unitItems + _companyItems + _tagGear + _medicGear + _weaponSystemSpecific;

_whitelist

0 comments on commit 718dd5c

Please sign in to comment.