CatStation/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

31 lines
978 B
C#

using Content.Shared.Storage;
using Content.Shared.Storage.Components;
using Content.Shared.Storage.EntitySystems;
using Content.Shared.Whitelist;
using JetBrains.Annotations;
using Robust.Shared.Containers;
namespace Content.Server.Storage.EntitySystems
{
[UsedImplicitly]
public sealed partial class ItemCounterSystem : SharedItemCounterSystem
{
[Dependency] private EntityWhitelistSystem _whitelistSystem = default!;
protected override int? GetCount(ContainerModifiedMessage msg, ItemCounterComponent itemCounter)
{
if (!TryComp(msg.Container.Owner, out StorageComponent? component))
{
return null;
}
var count = 0;
foreach (var entity in component.Container.ContainedEntities)
{
if (_whitelistSystem.IsWhitelistPass(itemCounter.Count, entity))
count++;
}
return count;
}
}
}