2023-09-22 02:45:21 -07:00
|
|
|
|
using Content.Server.Storage.Components;
|
|
|
|
|
|
using Content.Server.Storage.EntitySystems;
|
2023-06-27 20:30:03 -04:00
|
|
|
|
using Content.Shared.Item;
|
|
|
|
|
|
using Content.Shared.Stacks;
|
2023-09-11 21:20:46 +10:00
|
|
|
|
using Content.Shared.Storage;
|
2022-03-02 12:29:42 +13:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Item;
|
|
|
|
|
|
|
|
|
|
|
|
public sealed class ItemSystem : SharedItemSystem
|
|
|
|
|
|
{
|
2023-06-27 20:30:03 -04:00
|
|
|
|
[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) ||
|
2023-09-11 21:20:46 +10:00
|
|
|
|
!TryComp<StorageComponent>(container.Owner, out var storage))
|
2023-06-27 20:30:03 -04:00
|
|
|
|
return;
|
2023-09-11 21:20:46 +10:00
|
|
|
|
|
2023-09-22 02:45:21 -07:00
|
|
|
|
_storage.RecalculateStorageUsed(container.Owner, storage);
|
2023-09-11 21:20:46 +10:00
|
|
|
|
_storage.UpdateUI(container.Owner, storage);
|
2023-06-27 20:30:03 -04:00
|
|
|
|
}
|
2022-03-02 12:29:42 +13:00
|
|
|
|
}
|