diff --git a/Content.Client/Storage/Systems/StorageSystem.cs b/Content.Client/Storage/Systems/StorageSystem.cs index b80a855f98..a74a118cd0 100644 --- a/Content.Client/Storage/Systems/StorageSystem.cs +++ b/Content.Client/Storage/Systems/StorageSystem.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Numerics; using Content.Client.Animations; using Content.Shared.Hands; @@ -69,7 +69,7 @@ public sealed class StorageSystem : SharedStorageSystem public void CloseStorageWindow(Entity entity) { - if (!Resolve(entity, ref entity.Comp)) + if (!Resolve(entity, ref entity.Comp, false)) return; if (!_openStorages.Contains((entity, entity.Comp))) diff --git a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs index 2b434befe5..5c2e0080a6 100644 --- a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs @@ -96,6 +96,7 @@ public abstract class SharedStorageSystem : EntitySystem subs.Event(OnBoundUIClosed); }); + SubscribeLocalEvent(OnRemove); SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent>(AddUiVerb); SubscribeLocalEvent(OnStorageGetState); @@ -133,6 +134,11 @@ public abstract class SharedStorageSystem : EntitySystem UpdatePrototypeCache(); } + private void OnRemove(Entity entity, ref ComponentRemove args) + { + _ui.CloseUi(entity.Owner, StorageComponent.StorageUiKey.Key); + } + private void OnMapInit(Entity entity, ref MapInitEvent args) { UseDelay.SetLength(entity.Owner, entity.Comp.QuickInsertCooldown, QuickInsertUseDelayID);