From 65c16b6a0a88885e02db3a70653a2a5fe6069a30 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Fri, 17 Nov 2023 00:54:52 +0100 Subject: [PATCH] Arsenal - Fix closing arsenal when ignoring content (#9651) * Fix closing arsenal when ignoring content * Update fnc_removeBox.sqf --- addons/arsenal/functions/fnc_onArsenalClose.sqf | 2 ++ addons/arsenal/functions/fnc_openBox.sqf | 2 ++ addons/arsenal/functions/fnc_refresh.sqf | 3 ++- addons/arsenal/functions/fnc_removeBox.sqf | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/arsenal/functions/fnc_onArsenalClose.sqf b/addons/arsenal/functions/fnc_onArsenalClose.sqf index 2cac9fd0d9..c6a1da0215 100644 --- a/addons/arsenal/functions/fnc_onArsenalClose.sqf +++ b/addons/arsenal/functions/fnc_onArsenalClose.sqf @@ -136,4 +136,6 @@ GVAR(favorites) = nil; GVAR(center) = nil; GVAR(centerNotPlayer) = nil; +GVAR(ignoredVirtualItems) = nil; + [QUOTE(ADDON), []] call EFUNC(common,showHud); diff --git a/addons/arsenal/functions/fnc_openBox.sqf b/addons/arsenal/functions/fnc_openBox.sqf index 1536862212..bb1dd66ad1 100644 --- a/addons/arsenal/functions/fnc_openBox.sqf +++ b/addons/arsenal/functions/fnc_openBox.sqf @@ -52,6 +52,8 @@ if (_mode) then { // Add all the items from the game that the arsenal has detected GVAR(virtualItems) = +(uiNamespace getVariable QGVAR(configItems)); GVAR(virtualItemsFlat) = +(uiNamespace getVariable QGVAR(configItemsFlat)); + + GVAR(ignoredVirtualItems) = true; } else { // Add only specified items to the arsenal private _virtualItems = _object getVariable QGVAR(virtualItems); diff --git a/addons/arsenal/functions/fnc_refresh.sqf b/addons/arsenal/functions/fnc_refresh.sqf index eafc463955..d40d59c0ff 100644 --- a/addons/arsenal/functions/fnc_refresh.sqf +++ b/addons/arsenal/functions/fnc_refresh.sqf @@ -42,7 +42,8 @@ if (is3DEN) then { _animate = true; // CBA frame functions are disabled during preInit }; -if (isNil "_virtualItems") exitWith { +// Do not close an arsenal if it was opened with ignoring the existing content (see FUNC(openBox)) +if (isNil "_virtualItems" && {isNil QGVAR(ignoredVirtualItems)}) exitWith { [LLSTRING(noVirtualItems), false, 5, 1] call EFUNC(common,displayText); // Delay a frame in case this is running on display open [{(findDisplay IDD_ace_arsenal) closeDisplay 0}] call CBA_fnc_execNextFrame; diff --git a/addons/arsenal/functions/fnc_removeBox.sqf b/addons/arsenal/functions/fnc_removeBox.sqf index b4c410da62..50eb28d2e6 100644 --- a/addons/arsenal/functions/fnc_removeBox.sqf +++ b/addons/arsenal/functions/fnc_removeBox.sqf @@ -41,8 +41,8 @@ if (_global && {isMultiplayer} && {!isNil "_id"}) then { [QGVAR(boxRemoved), _object] call CBA_fnc_localEvent; }; -// If the arsenal is already open, close arsenal display -if (!isNil QGVAR(currentBox) && {GVAR(currentBox) isEqualTo _object}) then { +// If the arsenal is already open and not ignoring content (see FUNC(openBox)), close arsenal display +if (!isNil QGVAR(currentBox) && {GVAR(currentBox) isEqualTo _object} && {isNil QGVAR(ignoredVirtualItems)}) then { [LLSTRING(noVirtualItems), false, 5, 1] call EFUNC(common,displayText); // Delay a frame in case this is running on display open [{(findDisplay IDD_ace_arsenal) closeDisplay 0}] call CBA_fnc_execNextFrame;