+using Content.Client.Gameplay;
using Content.Client.Storage.Systems;
using Content.Shared.Storage;
using Robust.Client.UserInterface.Controllers;
namespace Content.Client.Storage.UI;
-public sealed class StorageUIController : UIController, IOnSystemChanged<StorageSystem>
+public sealed class StorageUIController : UIController, IOnSystemChanged<StorageSystem>, IOnStateExited<GameplayState>
{
// This is mainly to keep legacy functionality for now.
private readonly Dictionary<EntityUid, StorageWindow> _storageWindows = new();
{
system.StorageUpdated -= OnStorageUpdate;
}
+
+ public void OnStateExited(GameplayState state)
+ {
+ foreach (var window in _storageWindows.Values)
+ {
+ window.Dispose();
+ }
+
+ _storageWindows.Clear();
+ }
}