diff --git a/Content.Server/Item/ItemSystem.cs b/Content.Server/Item/ItemSystem.cs index efb99ae653..0e86b245aa 100644 --- a/Content.Server/Item/ItemSystem.cs +++ b/Content.Server/Item/ItemSystem.cs @@ -19,6 +19,5 @@ protected override void OnStackCountChanged(EntityUid uid, ItemComponent compone return; _storage.RecalculateStorageUsed(container.Owner, storage); - _storage.UpdateUI(container.Owner, storage); } } diff --git a/Content.Shared/Item/SharedItemSystem.cs b/Content.Shared/Item/SharedItemSystem.cs index a379c4f724..196b77f66d 100644 --- a/Content.Shared/Item/SharedItemSystem.cs +++ b/Content.Shared/Item/SharedItemSystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Examine; using Content.Shared.Item.ItemToggle.Components; using Content.Shared.Storage; +using Content.Shared.Storage.EntitySystems; using JetBrains.Annotations; using Robust.Shared.Containers; using Robust.Shared.GameStates; @@ -21,6 +22,9 @@ public abstract class SharedItemSystem : EntitySystem [Dependency] private readonly SharedCombatModeSystem _combatMode = default!; [Dependency] protected readonly SharedContainerSystem Container = default!; + // CD: Fix stackable insert desync + [Dependency] private readonly SharedStorageSystem _storage = default!; + public override void Initialize() { base.Initialize(); @@ -99,8 +103,15 @@ protected virtual void OnStackCountChanged(EntityUid uid, ItemComponent componen return; SetSize(uid, args.NewCount * size, component); + + // CD: Fix stackable insert desync + if (!Container.TryGetContainingContainer(uid, out var container) || + !TryComp(container.Owner, out var storage)) + return; + _storage.UpdateUI(container.Owner, storage); + // end CD } - + private void AddPickupVerb(EntityUid uid, ItemComponent component, GetVerbsEvent args) { if (args.Hands == null ||