From: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Date: Wed, 26 Jun 2024 14:11:51 +0000 (-0700) Subject: Fix storages bugging out if an open storage has its component removed (#29485) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=58efe4fdd140525a0f2c3cd2d953a1d297614288;p=space-station-14.git Fix storages bugging out if an open storage has its component removed (#29485) * Fix storages bugging out if an open storage has its component removed * Fix error on close --- 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);