mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 02:41:18 +03:00
* 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
31 lines
978 B
C#
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;
|
|
}
|
|
}
|
|
}
|