Skip to content

Commit

Permalink
Arsenal - Fix closing arsenal when ignoring content (#9651)
Browse files Browse the repository at this point in the history
* Fix closing arsenal when ignoring content

* Update fnc_removeBox.sqf
  • Loading branch information
johnb432 authored Nov 16, 2023
1 parent 141410b commit 65c16b6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions addons/arsenal/functions/fnc_onArsenalClose.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,6 @@ GVAR(favorites) = nil;
GVAR(center) = nil;
GVAR(centerNotPlayer) = nil;

GVAR(ignoredVirtualItems) = nil;

[QUOTE(ADDON), []] call EFUNC(common,showHud);
2 changes: 2 additions & 0 deletions addons/arsenal/functions/fnc_openBox.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion addons/arsenal/functions/fnc_refresh.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions addons/arsenal/functions/fnc_removeBox.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 65c16b6

Please sign in to comment.