Stack storage fixes (#17651)

This commit is contained in:
Nemanja
2023-06-27 20:30:03 -04:00
committed by GitHub
parent 76cd2be31a
commit 6fb7879041
3 changed files with 20 additions and 13 deletions

View File

@@ -1,7 +1,22 @@
using Content.Shared.Item;
using Content.Server.Storage.Components;
using Content.Server.Storage.EntitySystems;
using Content.Shared.Item;
using Content.Shared.Stacks;
namespace Content.Server.Item;
public sealed class ItemSystem : SharedItemSystem
{
[Dependency] private readonly StorageSystem _storage = default!;
protected override void OnStackCountChanged(EntityUid uid, ItemComponent component, StackCountChangedEvent args)
{
base.OnStackCountChanged(uid, component, args);
if (!Container.TryGetContainingContainer(uid, out var container) ||
!TryComp<ServerStorageComponent>(container.Owner, out var storage))
return;
_storage.RecalculateStorageUsed(storage);
_storage.UpdateStorageUI(container.Owner, storage);
}
}