Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arsenal - Reuse current inventory containers when importing invalid loadouts #10364

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions addons/arsenal/functions/fnc_buttonLoadoutsLoad.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ private _extendedLoadout = switch (GVAR(currentLoadoutsTab)) do {
};
};

// Keep current loadout containers if those being loaded are not present or unavailable
private _uniform = _extendedLoadout select 0 select 3;
if (_uniform select 0 == "") then {
_uniform set [0, uniform GVAR(center)];
};
private _vest = _extendedLoadout select 0 select 4;
if (_vest select 0 == "") then {
_vest set [0, vest GVAR(center)];
};
private _backpack = _extendedLoadout select 0 select 5;
if (_backpack select 0 == "") then {
_backpack set [0, backpack GVAR(center)];
};

// Apply loadout to unit
[GVAR(center), _extendedLoadout, true] call CBA_fnc_setLoadout;

Expand Down
7 changes: 1 addition & 6 deletions addons/arsenal/functions/fnc_verifyLoadout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,7 @@ private _fnc_filterLoadout = {
} else {
// Handle arrays
if (_x isEqualType []) then {
_itemArray = _x call _fnc_filterLoadout;
// If "" is given as a container, an error is thrown, therefore, filter out all unavailable/null containers
if (count _itemArray == 2 && {(_itemArray select 0) isEqualTo ""} && {(_itemArray select 1) isEqualType []}) then {
_itemArray = [];
};
_itemArray
_x call _fnc_filterLoadout
} else {
// All other types and empty strings
_x
Expand Down
2 changes: 2 additions & 0 deletions docs/wiki/feature/arsenal.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Saving loadouts from the default and public tabs will save them in your profile,

All loadouts can be loaded, however items not available or missing, will NOT be added. This limitation applies to all tabs as well as imported loadouts.

In the case of a stored loadout's uniform, vest or backpack not being available or missing, loading it will retain the currently equipped uniform/vest/backpack and attempt to fill it with the stored one's content that is available in the arsenal.

The color coding for loadouts is as follows:
- White: All items are available and will be loaded.
- Grey: Some items in that loadout are not available in that box.
Expand Down