Replace obsolete EntityWhitelist IsValid usages part 2 (#28506)

This commit is contained in:
Plykiya
2024-06-03 14:40:03 -07:00
committed by GitHub
parent 2bd4f85966
commit c5ff647ca6
42 changed files with 141 additions and 91 deletions

View File

@@ -1,6 +1,7 @@
using Content.Shared.Storage;
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;
@@ -9,6 +10,7 @@ namespace Content.Server.Storage.EntitySystems
[UsedImplicitly]
public sealed class ItemCounterSystem : SharedItemCounterSystem
{
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
protected override int? GetCount(ContainerModifiedMessage msg, ItemCounterComponent itemCounter)
{
if (!EntityManager.TryGetComponent(msg.Container.Owner, out StorageComponent? component))
@@ -19,7 +21,7 @@ namespace Content.Server.Storage.EntitySystems
var count = 0;
foreach (var entity in component.Container.ContainedEntities)
{
if (itemCounter.Count.IsValid(entity))
if (_whitelistSystem.IsWhitelistPass(itemCounter.Count, entity))
count++;
}