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 90e7247 commit 86b2885
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 51 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
44 changes: 24 additions & 20 deletions cScripts/functions/systems/fn_getArsenalWhitelist.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {""};
Expand Down Expand Up @@ -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

0 comments on commit 86b2885

Please sign in to comment.