Files
tbd-station-14/Content.Server/Item/ItemSystem.cs
2023-09-11 21:20:46 +10:00

26 lines
770 B
C#

using Content.Server.Storage.EntitySystems;
using Content.Shared.Item;
using Content.Shared.Stacks;
using Content.Shared.Storage;
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<StorageComponent>(container.Owner, out var storage))
{
return;
}
_storage.RecalculateStorageUsed(storage);
_storage.UpdateUI(container.Owner, storage);
}
}