]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make escape key work as expected with multiple open inventories (#35040)
authorpathetic meowmeow <uhhadd@gmail.com>
Tue, 25 Feb 2025 16:40:39 +0000 (11:40 -0500)
committerGitHub <noreply@github.com>
Tue, 25 Feb 2025 16:40:39 +0000 (17:40 +0100)
Content.Client/UserInterface/Systems/CloseWindow/CloseRecentWindowUIController.cs
Content.Client/UserInterface/Systems/Storage/StorageUIController.cs

index 3517a001c2723d69f4e0a105979345215b661e83..0e648c25a0983ca3eb87a2ad37f6a70bcbd6a8cc 100644 (file)
@@ -74,7 +74,7 @@ public sealed class CloseRecentWindowUIController : UIController
     /// internal recentlyInteractedWindows tracking.
     /// </summary>
     /// <param name="window"></param>
-    private void SetMostRecentlyInteractedWindow(BaseWindow window)
+    public void SetMostRecentlyInteractedWindow(BaseWindow window)
     {
         // Search through the list and see if already added.
         // (This search is backwards since it's fairly common that the user is clicking the same
@@ -134,7 +134,6 @@ public sealed class CloseRecentWindowUIController : UIController
             if (window.IsOpen)
                 return true;
 
-            recentlyInteractedWindows.RemoveAt(i);
             // continue going down the list, hoping to find a still-open window
         }
 
index 768a434d83757757ad46f27bc8740715bc20e517..f0c8cfeb2150ae35b56a728e9ab778d2abf24eac 100644 (file)
@@ -5,6 +5,7 @@ using Content.Client.Interaction;
 using Content.Client.Storage;
 using Content.Client.Storage.Systems;
 using Content.Client.UserInterface.Systems.Hotbar.Widgets;
+using Content.Client.UserInterface.Systems.Info;
 using Content.Client.UserInterface.Systems.Storage.Controls;
 using Content.Client.Verbs.UI;
 using Content.Shared.CCVar;
@@ -37,6 +38,7 @@ public sealed class StorageUIController : UIController, IOnSystemChanged<Storage
     [Dependency] private readonly IConfigurationManager _configuration = default!;
     [Dependency] private readonly IInputManager _input = default!;
     [Dependency] private readonly IPlayerManager _player = default!;
+    [Dependency] private readonly CloseRecentWindowUIController _closeRecentWindowUIController = default!;
     [UISystemDependency] private readonly StorageSystem _storage = default!;
     [UISystemDependency] private readonly UserInterfaceSystem _ui = default!;
 
@@ -98,6 +100,7 @@ public sealed class StorageUIController : UIController, IOnSystemChanged<Storage
         if (StaticStorageUIEnabled)
         {
             UIManager.GetActiveUIWidgetOrNull<HotbarGui>()?.StorageContainer.AddChild(window);
+            _closeRecentWindowUIController.SetMostRecentlyInteractedWindow(window);
         }
         else
         {