From 8e05a252805fe095d7d9f37fc537a1260dc8b557 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sat, 5 Oct 2024 22:42:16 +0200 Subject: [PATCH 1/2] Preserve current loadout containers --- .../arsenal/functions/fnc_buttonLoadoutsLoad.sqf | 14 ++++++++++++++ addons/arsenal/functions/fnc_verifyLoadout.sqf | 7 +------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/addons/arsenal/functions/fnc_buttonLoadoutsLoad.sqf b/addons/arsenal/functions/fnc_buttonLoadoutsLoad.sqf index 120a50ae9c7..fb089737ba9 100644 --- a/addons/arsenal/functions/fnc_buttonLoadoutsLoad.sqf +++ b/addons/arsenal/functions/fnc_buttonLoadoutsLoad.sqf @@ -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; diff --git a/addons/arsenal/functions/fnc_verifyLoadout.sqf b/addons/arsenal/functions/fnc_verifyLoadout.sqf index 10cd9a25539..6290b1fcbb6 100644 --- a/addons/arsenal/functions/fnc_verifyLoadout.sqf +++ b/addons/arsenal/functions/fnc_verifyLoadout.sqf @@ -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 From 580cf2730e30332d4ab936cdffdb18cf37fe8af6 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sat, 5 Oct 2024 23:49:38 +0200 Subject: [PATCH 2/2] Update Documentation --- docs/wiki/feature/arsenal.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/wiki/feature/arsenal.md b/docs/wiki/feature/arsenal.md index c1394e0230e..48bdd573440 100644 --- a/docs/wiki/feature/arsenal.md +++ b/docs/wiki/feature/arsenal.md @@ -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.