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

@@ -9,6 +9,7 @@ using Content.Shared.Emag.Systems;
using Content.Shared.Examine;
using Content.Shared.Mobs.Components;
using Content.Shared.Stacks;
using Content.Shared.Whitelist;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
@@ -29,6 +30,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
[Dependency] protected readonly SharedAmbientSoundSystem AmbientSound = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] protected readonly SharedContainerSystem Container = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public const string ActiveReclaimerContainerId = "active-material-reclaimer-container";
@@ -91,10 +93,8 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
if (HasComp<MobStateComponent>(item) && !CanGib(uid, item, component)) // whitelist? We be gibbing, boy!
return false;
if (component.Whitelist is {} whitelist && !whitelist.IsValid(item))
return false;
if (component.Blacklist is {} blacklist && blacklist.IsValid(item))
if (_whitelistSystem.IsWhitelistFail(component.Whitelist, item) ||
_whitelistSystem.IsBlacklistPass(component.Blacklist, item))
return false;
if (Container.TryGetContainingContainer(item, out _) && !Container.TryRemoveFromContainer(item))