Skip to content

Commit 1990a11

Browse files
Updated the whitelist system with tags
1 parent 865d07c commit 1990a11

7 files changed

Lines changed: 86 additions & 30 deletions

File tree

cScripts/CfgEquipmentTags.hpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
class CfgEquipmentTags {
2+
Common[] = {"G_Aviator"};
3+
4+
CommonBlufor[] = {"G_Aviator"};
5+
6+
CommonBluforCompanyAlpha[] = {"ace_banana"};
7+
CommonBluforCompanyBravo[] = {"ace_banana"};
8+
CommonBluforCompanyCharlie[] = {"ace_banana"};
9+
10+
11+
equ_specialized_radio[] = {""};
12+
equ_signal_equipment[] = {""};
13+
14+
medical_equipment_level_0[] = {""};
15+
medical_equipment_level_1[] = {""};
16+
medical_equipment_level_2[] = {""};
17+
medical_equipment_level_3[] = {""};
18+
19+
weapon_system_launchers[] = {""};
20+
21+
weapon_system_m4a1[] = {""};
22+
weapon_system_glock[] = {""};
23+
24+
// used for expanding the weapon systems
25+
weapon_system_rifle_expanded[] = {"weapon_system_m4a1"};
26+
weapon_system_pistol_expanded[] = {"weapon_system_glock"};
27+
};

cScripts/CfgFunctions.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ class cScripts {
226226
class gear_applyFunctions {};
227227
class gear_selectLoadout {};
228228
class gear_getSideConfig {};
229+
230+
class gear_getLoadoutCompany {};
229231

230232
class gear_setupRadios {};
231233

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include "..\script_component.hpp";
2+
/*
3+
* Author: SGT.Brostrom.A
4+
* This function return your company
5+
*
6+
* Arguments:
7+
* None
8+
*
9+
* Return Value:
10+
* CompanyName <STRING>
11+
*
12+
* Example:
13+
* call cScripts_fnc_player_getLoadoutCompany;
14+
*
15+
* Public: No
16+
*/
17+
18+
//FIXME: Mabe not have afterall?
19+
params [["_loadout","",[]]];
20+
21+
private _config = missionConfigFile >> "CfgLoadouts" >> _loadout;
22+
private _company = getArray (_config >> "company");
23+
24+
_company;

cScripts/functions/gear/fn_gear_getTagItems.sqf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
* Tags <ARRAY>
1111
*
1212
* Example:
13-
* call cScripts_fnc_gear_getTagItems
13+
* ["CommonDefault"] call cScripts_fnc_gear_getTagItems
14+
* ["CommonBluforCompanyAlpha"] call cScripts_fnc_gear_getTagItems
1415
*
1516
*/
1617

cScripts/functions/gear/fn_gear_getTags.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Tags <ARRAY>
1111
*
1212
* Example:
13-
* call cScripts_fnc_gear_getTags
13+
* [typeOf player] call cScripts_fnc_gear_getTags
1414
*
1515
*/
1616

cScripts/functions/systems/fn_getArsenalWhitelist.sqf

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,46 +19,47 @@ if !(isClass (missionConfigFile >> "CfgLoadouts" >> _classname)) exitWith {
1919
[];
2020
};
2121

22+
// Loadout Items
2223
private _loadout = parseSimpleArray getText (missionConfigFile >> "CfgLoadouts" >> _classname >> "loadout");
2324
private _unitItems = str _loadout splitString "[]," joinString ",";
2425
_unitItems = parseSimpleArray ("[" + _unitItems + "]");
2526
_unitItems = _unitItems arrayIntersect _unitItems select {_x isEqualType "" && {_x != ""}};
2627

28+
// Global Items
29+
private _anySideCommon = ["Common"] FUNC(getGetItems);
30+
31+
// Side Items
32+
private _side = [side group player] call EFUNC(gear,getSideConfig);
33+
private _commonGear = switch (_side) do {
34+
case "CommonBlufor": { ["CommonBlufor"] FUNC(getGetItems); };
35+
case "CommonOpfor": { ["CommonOpfor"] FUNC(getGetItems); };
36+
case "CommonIndependant": { ["CommonIndependant"] FUNC(getGetItems); };
37+
case "CommonCivilian": { ["CommonCivilian"] FUNC(getGetItems); };
38+
default { ["CommonDefault"] FUNC(getGetItems); };
39+
};
2740

28-
private _commonGear = GET_CONTAINER_KEYS("arsenal_common");
29-
30-
41+
// Side Company Items
3142
private _company = call EFUNC(player,getCompany);
32-
private _companyItems = switch (_company) do {
33-
case "alpha": {GET_CONTAINER_KEYS("alpha_company");};
34-
case "bravo": {GET_CONTAINER_KEYS("bravo_company");};
35-
case "charlie": {GET_CONTAINER_KEYS("charlie_company");};
36-
default {GET_CONTAINER_KEYS("arsenal_company_fallback");};
43+
private _titleCompany = [_company] call CBA_fnc_capitalize;
44+
private _companyItems = switch (_side) do {
45+
case "CommonBlufor": { ["CommonBluforCompany"+_titleCompany] FUNC(getGetItems); };
46+
case "CommonOpfor": { ["CommonOpforCompany"+_titleCompany] FUNC(getGetItems); };
47+
case "CommonIndependant": { ["CommonIndependantCompany"+_titleCompany] FUNC(getGetItems); };
48+
case "CommonCivilian": { ["CommonCivilianCompany"+_titleCompany] FUNC(getGetItems); };
49+
default { ["CommonDefaultCompany"+_titleCompany] FUNC(getGetItems); };
3750
};
3851

39-
52+
// Equipmnet Tag Items
4053
private _tagItems = [];
54+
private _equipmentTags = call EGVAR(gear,getLoadoutTags);
4155
{
42-
private _tag = switch (_x) do {
43-
case "role_officer": {GET_CONTAINER_KEYS("arsenal_role_officer");};
44-
case "role_squadleader": {GET_CONTAINER_KEYS("arsenal_role_squadleader");};
45-
case "role_fireteamleader": {GET_CONTAINER_KEYS("arsenal_role_fireteamleader");};
46-
case "role_weapons": {GET_CONTAINER_KEYS("arsenal_role_weapons");};
47-
case "role_pilot";
48-
case "role_rotarypilot": {GET_CONTAINER_KEYS("arsenal_role_rotarypilot");};
49-
case "role_rotarycrew": {GET_CONTAINER_KEYS("arsenal_role_pilotcrew");};
50-
case "role_pilotfighter": {GET_CONTAINER_KEYS("arsenal_role_pilotfighter");};
51-
case "role_pilottransport": {GET_CONTAINER_KEYS("arsenal_role_pilottransport");};
52-
53-
case "tag_cls": {GET_CONTAINER_KEYS("arsenal_tag_cls");};
54-
case "tag_medic": {GET_CONTAINER_KEYS("arsenal_tag_medic");};
55-
case "tag_doctor": {GET_CONTAINER_KEYS("arsenal_tag_doctor");};
56-
default {[]};
57-
};
58-
_tagItems append _x;
59-
} forEach [player] call EFUNC(gear,getLoadoutRole) ;
56+
private _items = [_x] call EGVAR(gear,getTagItems);
57+
_tagItemsList append _items;
58+
} forEach _equipmentTags;
6059

6160

61+
// Weapon System Items
62+
// FIXME: Make the system generalized and auto configured
6263
private _primaryWeapon = if (!isNil{_loadout#0#0}) then {_loadout#0#0} else {""};
6364
private _primarySpecific = switch (true) do {
6465
case (_primaryWeapon isKindof ['rhs_weap_mk18_m320', configFile >> 'CfgWeapons']
@@ -97,6 +98,6 @@ private _launcherSpecific = switch (true) do {
9798
default {[]};
9899
};
99100

100-
private _whitelist = _commonGear + _unitItems + _companyItems + _tagItems + _primarySpecific + _handgunSpecific + _launcherSpecific;
101+
private _whitelist = _unitItems + _anySideCommon + _commonGear + _companyItems + _primarySpecific + _handgunSpecific + _launcherSpecific;
101102

102103
_whitelist

description.ext

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,6 @@ class CfgFunctions {
7171
#include "cScripts\CfgFunctions.hpp"
7272
};
7373
#include "cScripts\CfgLoadouts.hpp"
74+
#include "cScripts\CfgEquipmentTags.hpp"
7475

7576
/* OTHER */

0 commit comments

Comments
 (0)