Fix default loadout public func not checking base items (#7280)

This commit is contained in:
Josuan Albin 2019-12-04 21:12:00 +01:00 committed by PabstMirror
parent 28bf9b6452
commit b8fcd92536

View File

@ -23,6 +23,81 @@ if (isNil QGVAR(defaultLoadoutsList)) then {
GVAR(defaultLoadoutsList) = [];
};
for "_dataIndex" from 0 to 10 do {
switch (_dataIndex) do {
case 0;
case 1;
case 2;
case 8: {
if (count (_loadout select _dataIndex) > 0) then {
private _weapon = (_loadout select _dataIndex) select 0;
if (_weapon != "") then {
private _baseWeapon = _weapon call BIS_fnc_baseWeapon;
if (_weapon != _baseWeapon) then {
(_loadout select _dataIndex) set [0, _baseWeapon];
};
};
};
};
case 3;
case 4;
case 5: {
if (count (_loadout select _dataIndex) > 0) then {
private _containerContents = (_loadout select _dataIndex) select 1;
if (count _containerContents > 0) then {
{
if (count _x == 2) then {
if ((_x select 0) isEqualType "") then {
private _item = (_x select 0);
if (_item != "") then {
private _uniqueBaseCfgText = getText (configFile >> "CfgWeapons" >> _item >> "ace_arsenal_uniqueBase");
if (_uniqueBaseCfgText != "") then {
_x set [0, _uniqueBaseCfgText];
};
};
} else {
private _weapon = (_x select 0) select 0;
if (_weapon != "") then {
private _baseWeapon = _weapon call BIS_fnc_baseWeapon;
if (_weapon != _baseWeapon) then {
(_x select 0)set [0, _baseWeapon];
};
};
};
};
} foreach _containerContents;
};
};
};
case 9: {
for "_subIndex" from 0 to 4 do {
private _item = (_loadout select _dataIndex) select _subIndex;
if (_item != "") then {
private _uniqueBaseCfgText = getText (configFile >> "CfgWeapons" >> _item >> "ace_arsenal_uniqueBase");
if (_uniqueBaseCfgText != "") then {
(_loadout select _dataIndex) set [_subIndex, _uniqueBaseCfgText];
};
};
};
};
};
};
private _loadoutIndex = (+(GVAR(defaultLoadoutsList))) findIf {(_x select 0) == _name};
if (_loadoutIndex == -1) then {
GVAR(defaultLoadoutsList) pushBack [_name, _loadout];