]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Replace obsolete EntityWhitelist IsValid usages part 2 (#28506)
authorPlykiya <58439124+Plykiya@users.noreply.github.com>
Mon, 3 Jun 2024 21:40:03 +0000 (14:40 -0700)
committerGitHub <noreply@github.com>
Mon, 3 Jun 2024 21:40:03 +0000 (17:40 -0400)
42 files changed:
Content.Client/Outline/TargetOutlineSystem.cs
Content.Server/Chat/Systems/ChatSystem.Emote.cs
Content.Server/Chemistry/TileReactions/CreateEntityTileReaction.cs
Content.Server/Construction/ConstructionSystem.Initial.cs
Content.Server/GameTicking/Rules/LoadMapRuleSystem.cs
Content.Server/GameTicking/Rules/VariationPass/CutWireVariationPassSystem.cs
Content.Server/Holiday/Christmas/RandomGiftSystem.cs
Content.Server/Mech/Systems/MechEquipmentSystem.cs
Content.Server/Mech/Systems/MechSystem.cs
Content.Server/Ninja/Systems/StunProviderSystem.cs
Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs
Content.Server/Nutrition/EntitySystems/FoodSystem.cs
Content.Server/Objectives/Systems/ObjectiveBlacklistRequirementSystem.cs
Content.Server/Objectives/Systems/RoleRequirementSystem.cs
Content.Server/Polymorph/Systems/PolymorphSystem.Collide.cs
Content.Server/Sticky/Systems/StickySystem.cs
Content.Server/Storage/EntitySystems/ItemCounterSystem.cs
Content.Server/Store/Conditions/BuyerWhitelistCondition.cs
Content.Server/Store/Conditions/StoreWhitelistCondition.cs
Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMicrophoneSystem.cs
Content.Server/Traits/TraitSystem.cs
Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactCrusherSystem.cs
Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/DamageNearbyArtifactSystem.cs
Content.Shared/Actions/SharedActionsSystem.cs
Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs
Content.Shared/Construction/Conditions/EntityWhitelistCondition.cs
Content.Shared/Inventory/InventorySystem.Equip.cs
Content.Shared/Labels/EntitySystems/SharedHandLabelerSystem.cs
Content.Shared/Materials/SharedMaterialReclaimerSystem.cs
Content.Shared/Mech/EntitySystems/SharedMechSystem.cs
Content.Shared/Movement/Systems/SpeedModifierContactsSystem.cs
Content.Shared/Ninja/Systems/EmagProviderSystem.cs
Content.Shared/Placeable/ItemPlacerSystem.cs
Content.Shared/Random/RulesSystem.cs
Content.Shared/Sound/SharedEmitSoundSystem.cs
Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs
Content.Shared/Storage/EntitySystems/BinSystem.cs
Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs
Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs
Content.Shared/UserInterface/ActivatableUISystem.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Clothing.cs

index 2a6867f51f55c92d5c5d38fd5c1725c39daaf00d..df57578b1f5149a6c775502a3e68df01462484b8 100644 (file)
@@ -22,6 +22,7 @@ public sealed class TargetOutlineSystem : EntitySystem
     [Dependency] private readonly IPlayerManager _playerManager = default!;
     [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
     [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     private bool _enabled = false;
 
@@ -137,7 +138,7 @@ public sealed class TargetOutlineSystem : EntitySystem
 
             // check the entity whitelist
             if (valid && Whitelist != null)
-                valid = Whitelist.IsValid(entity);
+                valid = _whitelistSystem.IsWhitelistPass(Whitelist, entity);
 
             // and check the cancellable event
             if (valid && ValidationEvent != null)
index 5897aac61a166048a792e5b9f80a923d1c192481..20a4f18746500fae5975d5076155c0301d66d9ac 100644 (file)
@@ -81,6 +81,7 @@ public partial class ChatSystem
         bool ignoreActionBlocker = false
         )
     {
+
         if (_whitelistSystem.IsWhitelistFail(emote.Whitelist, source) || _whitelistSystem.IsBlacklistPass(emote.Blacklist, source))
             return;
 
index 29f9275bdf47f2be3491054af6eaa99b1d5166f6..6b106b1fc0a345be2ca0083bea9bf4c5acf62b34 100644 (file)
@@ -1,4 +1,4 @@
-using Content.Shared.Chemistry.Reaction;
+using Content.Shared.Chemistry.Reaction;
 using Content.Shared.Chemistry.Reagent;
 using Content.Shared.FixedPoint;
 using Content.Shared.Maps;
@@ -47,7 +47,8 @@ public sealed partial class CreateEntityTileReaction : ITileReaction
                 int acc = 0;
                 foreach (var ent in tile.GetEntitiesInTile())
                 {
-                    if (Whitelist.IsValid(ent))
+                    var whitelistSystem = entityManager.System<EntityWhitelistSystem>();
+                    if (whitelistSystem.IsWhitelistPass(Whitelist, ent))
                         acc += 1;
 
                     if (acc >= MaxOnTile)
index 04d3722c66cb76f6c4311b5d07282074fc7e896c..5161ac358ac94a69adf10709fe121fa434ddc312 100644 (file)
@@ -14,6 +14,7 @@ using Content.Shared.Hands.EntitySystems;
 using Content.Shared.Interaction;
 using Content.Shared.Inventory;
 using Content.Shared.Storage;
+using Content.Shared.Whitelist;
 using Robust.Shared.Containers;
 using Robust.Shared.Map;
 using Robust.Shared.Player;
@@ -30,6 +31,7 @@ namespace Content.Server.Construction
         [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
         [Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
         [Dependency] private readonly SharedTransformSystem _transformSystem = default!;
+        [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
         // --- WARNING! LEGACY CODE AHEAD! ---
         // This entire file contains the legacy code for initial construction.
@@ -337,7 +339,7 @@ namespace Content.Server.Construction
                 return false;
             }
 
-            if (constructionPrototype.EntityWhitelist != null && !constructionPrototype.EntityWhitelist.IsValid(user))
+            if (_whitelistSystem.IsWhitelistFail(constructionPrototype.EntityWhitelist, user))
             {
                 _popup.PopupEntity(Loc.GetString("construction-system-cannot-start"), user, user);
                 return false;
@@ -422,7 +424,7 @@ namespace Content.Server.Construction
                 return;
             }
 
-            if (constructionPrototype.EntityWhitelist != null && !constructionPrototype.EntityWhitelist.IsValid(user))
+            if (_whitelistSystem.IsWhitelistFail(constructionPrototype.EntityWhitelist, user))
             {
                 _popup.PopupEntity(Loc.GetString("construction-system-cannot-start"), user, user);
                 return;
index 3a80d82fd92bcaaee6232ad8da80968ce40e4b77..c60cf2513e0e266b2d28cb1cf7cdde4eaaffcb12 100644 (file)
@@ -3,6 +3,7 @@ using Content.Server.GameTicking.Components;
 using Content.Server.GameTicking.Rules.Components;
 using Content.Server.GridPreloader;
 using Content.Server.Spawners.Components;
+using Content.Shared.Whitelist;
 using Robust.Server.GameObjects;
 using Robust.Server.Maps;
 using Robust.Shared.Map;
@@ -19,6 +20,7 @@ public sealed class LoadMapRuleSystem : GameRuleSystem<LoadMapRuleComponent>
     [Dependency] private readonly MetaDataSystem _metaData = default!;
     [Dependency] private readonly TransformSystem _transform = default!;
     [Dependency] private readonly GridPreloaderSystem _gridPreloader = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public override void Initialize()
     {
@@ -99,7 +101,7 @@ public sealed class LoadMapRuleSystem : GameRuleSystem<LoadMapRuleComponent>
             if (xform.GridUid == null || !ent.Comp.MapGrids.Contains(xform.GridUid.Value))
                 continue;
 
-            if (ent.Comp.SpawnerWhitelist != null && !ent.Comp.SpawnerWhitelist.IsValid(uid, EntityManager))
+            if (_whitelistSystem.IsWhitelistFail(ent.Comp.SpawnerWhitelist, uid))
                 continue;
 
             args.Coordinates.Add(_transform.GetMapCoordinates(xform));
index fd94c74ac8c1239d82cd8a07ce10716b93001b65..372de4bbb45d60891324639fc062972129bad418 100644 (file)
@@ -1,5 +1,6 @@
 using Content.Server.GameTicking.Rules.VariationPass.Components;
 using Content.Server.Wires;
+using Content.Shared.Whitelist;
 using Robust.Shared.Random;
 
 namespace Content.Server.GameTicking.Rules.VariationPass;
@@ -11,6 +12,8 @@ namespace Content.Server.GameTicking.Rules.VariationPass;
 /// </summary>
 public sealed class CutWireVariationPassSystem : VariationPassSystem<CutWireVariationPassComponent>
 {
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
+
     protected override void ApplyVariation(Entity<CutWireVariationPassComponent> ent, ref StationVariationPassEvent args)
     {
         var wiresCut = 0;
@@ -22,7 +25,7 @@ public sealed class CutWireVariationPassSystem : VariationPassSystem<CutWireVari
                 continue;
 
             // Check against blacklist
-            if (ent.Comp.Blacklist.IsValid(uid))
+            if (_whitelistSystem.IsBlacklistPass(ent.Comp.Blacklist, uid))
                 continue;
 
             if (Random.Prob(ent.Comp.WireCutChance))
index 9e56d0a4937777598526255db8072d1a22d6c0b5..ee542572d7e0d29574bdfc34983bdc06d201abee 100644 (file)
@@ -1,9 +1,10 @@
-using Content.Server.Administration.Logs;
+using Content.Server.Administration.Logs;
 using Content.Server.Hands.Systems;
 using Content.Shared.Database;
 using Content.Shared.Examine;
 using Content.Shared.Interaction.Events;
 using Content.Shared.Item;
+using Content.Shared.Whitelist;
 using Robust.Server.Audio;
 using Robust.Server.GameObjects;
 using Robust.Shared.Map.Components;
@@ -24,6 +25,7 @@ public sealed class RandomGiftSystem : EntitySystem
     [Dependency] private readonly IPrototypeManager _prototype = default!;
     [Dependency] private readonly IRobustRandom _random = default!;
     [Dependency] private readonly IAdminLogManager _adminLogger = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     private readonly List<string> _possibleGiftsSafe = new();
     private readonly List<string> _possibleGiftsUnsafe = new();
@@ -40,7 +42,7 @@ public sealed class RandomGiftSystem : EntitySystem
 
     private void OnExamined(EntityUid uid, RandomGiftComponent component, ExaminedEvent args)
     {
-        if (!component.ContentsViewers.IsValid(args.Examiner, EntityManager) || component.SelectedEntity is null)
+        if (_whitelistSystem.IsWhitelistFail(component.ContentsViewers, args.Examiner) || component.SelectedEntity is null)
             return;
 
         var name = _prototype.Index<EntityPrototype>(component.SelectedEntity).Name;
index f51c0444e69d6221614dbbaf70b98fc344796804..f9fe5e464135bc06e2f06b9fa452b6d177e0c7c3 100644 (file)
@@ -3,6 +3,7 @@ using Content.Shared.DoAfter;
 using Content.Shared.Interaction;
 using Content.Shared.Mech.Components;
 using Content.Shared.Mech.Equipment.Components;
+using Content.Shared.Whitelist;
 
 namespace Content.Server.Mech.Systems;
 
@@ -14,6 +15,7 @@ public sealed class MechEquipmentSystem : EntitySystem
     [Dependency] private readonly MechSystem _mech = default!;
     [Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
     [Dependency] private readonly PopupSystem _popup = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     /// <inheritdoc/>
     public override void Initialize()
@@ -40,7 +42,7 @@ public sealed class MechEquipmentSystem : EntitySystem
         if (mechComp.EquipmentContainer.ContainedEntities.Count >= mechComp.MaxEquipmentAmount)
             return;
 
-        if (mechComp.EquipmentWhitelist != null && !mechComp.EquipmentWhitelist.IsValid(args.Used))
+        if (_whitelistSystem.IsWhitelistFail(mechComp.EquipmentWhitelist, args.Used))
             return;
 
         _popup.PopupEntity(Loc.GetString("mech-equipment-begin-install", ("item", uid)), mech);
index 68b973f5887791c0eafd5acebe58409856814250..b738d28b4674020730c06c1c3e98a3fad5fc96cb 100644 (file)
@@ -22,6 +22,7 @@ using Robust.Server.Containers;
 using Robust.Server.GameObjects;
 using Robust.Shared.Containers;
 using Robust.Shared.Player;
+using Content.Shared.Whitelist;
 
 namespace Content.Server.Mech.Systems;
 
@@ -36,6 +37,7 @@ public sealed partial class MechSystem : SharedMechSystem
     [Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
     [Dependency] private readonly SharedPopupSystem _popup = default!;
     [Dependency] private readonly UserInterfaceSystem _ui = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
     [Dependency] private readonly SharedToolSystem _toolSystem = default!;
 
     /// <inheritdoc/>
@@ -224,7 +226,7 @@ public sealed partial class MechSystem : SharedMechSystem
         if (args.Cancelled || args.Handled)
             return;
 
-        if (component.PilotWhitelist != null && !component.PilotWhitelist.IsValid(args.User))
+        if (_whitelistSystem.IsWhitelistFail(component.PilotWhitelist, args.User))
         {
             _popup.PopupEntity(Loc.GetString("mech-no-enter", ("item", uid)), args.User);
             return;
index 970ca78e2cc01eed08a1513044ffc1fe6bcb079a..1768606ad20f2312c3979a02c86426c825afac32 100644 (file)
@@ -9,6 +9,7 @@ using Content.Shared.Stunnable;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Timing;
+using Content.Shared.Whitelist;
 
 namespace Content.Server.Ninja.Systems;
 
@@ -24,6 +25,7 @@ public sealed class StunProviderSystem : SharedStunProviderSystem
     [Dependency] private readonly SharedNinjaGlovesSystem _gloves = default!;
     [Dependency] private readonly SharedPopupSystem _popup = default!;
     [Dependency] private readonly SharedStunSystem _stun = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public override void Initialize()
     {
@@ -42,7 +44,7 @@ public sealed class StunProviderSystem : SharedStunProviderSystem
         if (args.Handled || comp.BatteryUid == null || !_gloves.AbilityCheck(uid, args, out var target))
             return;
 
-        if (target == uid || !comp.Whitelist.IsValid(target, EntityManager))
+        if (target == uid || _whitelistSystem.IsWhitelistFail(comp.Whitelist, target))
             return;
 
         if (_timing.CurTime < comp.NextStun)
index cd0541340564825ec65233a3d84d4f600ef9ab43..e224c7c4792796e25e6863659300312ba7eccf97 100644 (file)
@@ -1,4 +1,4 @@
-using Content.Server.Administration.Logs;
+using Content.Server.Administration.Logs;
 using Content.Server.Popups;
 using Content.Shared.Database;
 using Content.Shared.IdentityManagement;
@@ -9,6 +9,7 @@ using Content.Shared.Nutrition.AnimalHusbandry;
 using Content.Shared.Nutrition.Components;
 using Content.Shared.Nutrition.EntitySystems;
 using Content.Shared.Storage;
+using Content.Shared.Whitelist;
 using Robust.Server.GameObjects;
 using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
@@ -33,6 +34,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem
     [Dependency] private readonly PopupSystem _popup = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
     [Dependency] private readonly SharedTransformSystem _transform = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     private readonly HashSet<EntityUid> _failedAttempts = new();
     private readonly HashSet<EntityUid> _birthQueue = new();
@@ -174,7 +176,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem
         if (!CanReproduce(partner))
             return false;
 
-        return component.PartnerWhitelist.IsValid(partner);
+        return _whitelistSystem.IsWhitelistPass(component.PartnerWhitelist, partner);
     }
 
     /// <summary>
index 2c7632aadca5bd7068db4fd89caa46d022518b7c..1862b4e19f14699d13060127ef1717604df866d8 100644 (file)
@@ -32,6 +32,7 @@ using Robust.Shared.Audio.Systems;
 using Robust.Shared.Utility;
 using System.Linq;
 using Robust.Server.GameObjects;
+using Content.Shared.Whitelist;
 
 namespace Content.Server.Nutrition.EntitySystems;
 
@@ -57,6 +58,7 @@ public sealed class FoodSystem : EntitySystem
     [Dependency] private readonly StackSystem _stack = default!;
     [Dependency] private readonly StomachSystem _stomach = default!;
     [Dependency] private readonly UtensilSystem _utensil = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public const float MaxFeedDistance = 1.0f;
 
@@ -408,7 +410,7 @@ public sealed class FoodSystem : EntitySystem
             if (comp.SpecialDigestible == null)
                 continue;
             // Check if the food is in the whitelist
-            if (comp.SpecialDigestible.IsValid(food, EntityManager))
+            if (_whitelistSystem.IsWhitelistPass(comp.SpecialDigestible, food))
                 return true;
             // They can only eat whitelist food and the food isn't in the whitelist. It's not edible.
             return false;
index 56b245ce8479dbd6050114e49dce24615abfaf18..8fe7e7e203150ef3c048821707e3bcda44e624c1 100644 (file)
@@ -1,5 +1,6 @@
 using Content.Server.Objectives.Components;
 using Content.Shared.Objectives.Components;
+using Content.Shared.Whitelist;
 
 namespace Content.Server.Objectives.Systems;
 
@@ -8,6 +9,8 @@ namespace Content.Server.Objectives.Systems;
 /// </summary>
 public sealed class ObjectiveBlacklistRequirementSystem : EntitySystem
 {
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
+
     public override void Initialize()
     {
         base.Initialize();
@@ -22,7 +25,7 @@ public sealed class ObjectiveBlacklistRequirementSystem : EntitySystem
 
         foreach (var objective in args.Mind.AllObjectives)
         {
-            if (comp.Blacklist.IsValid(objective, EntityManager))
+            if (_whitelistSystem.IsBlacklistPass(comp.Blacklist, objective))
             {
                 args.Cancelled = true;
                 return;
index 97aee218f0637a8785fe601c83f3d6c12cfa6fd1..8421987bae9f5c19416aa42c7d41e3de01beac1c 100644 (file)
@@ -1,5 +1,6 @@
 using Content.Server.Objectives.Components;
 using Content.Shared.Objectives.Components;
+using Content.Shared.Whitelist;
 
 namespace Content.Server.Objectives.Systems;
 
@@ -8,6 +9,7 @@ namespace Content.Server.Objectives.Systems;
 /// </summary>
 public sealed class RoleRequirementSystem : EntitySystem
 {
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
     public override void Initialize()
     {
         base.Initialize();
@@ -22,7 +24,7 @@ public sealed class RoleRequirementSystem : EntitySystem
 
         // this whitelist trick only works because roles are components on the mind and not entities
         // if that gets reworked then this will need changing
-        if (!comp.Roles.IsValid(args.MindId, EntityManager))
+        if (_whitelistSystem.IsWhitelistFail(comp.Roles, args.MindId))
             args.Cancelled = true;
     }
 }
index b4240d409ad8a5b1bdce019149eb139155ed09f5..b29f46e09e9dbabc5544f30db15c5f8335c0a20d 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Server.Polymorph.Components;
 using Content.Shared.Polymorph;
 using Content.Shared.Projectiles;
+using Content.Shared.Whitelist;
 using Robust.Shared.Audio;
 using Robust.Shared.Physics.Events;
 using Robust.Shared.Prototypes;
@@ -9,6 +10,8 @@ namespace Content.Server.Polymorph.Systems;
 
 public partial class PolymorphSystem
 {
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
+
     /// <summary>
     /// Need to do this so we don't get a collection enumeration error in physics by polymorphing
     /// an entity we're colliding with
@@ -39,8 +42,8 @@ public partial class PolymorphSystem
             return;
 
         var other = args.OtherEntity;
-        if (!component.Whitelist.IsValid(other, EntityManager)
-            || component.Blacklist != null && component.Blacklist.IsValid(other, EntityManager))
+        if (_whitelistSystem.IsWhitelistFail(component.Whitelist, other) ||
+            _whitelistSystem.IsBlacklistPass(component.Blacklist, other))
             return;
 
         _queuedPolymorphUpdates.Enqueue(new (other, component.Sound, component.Polymorph));
index effe1b72f7187267ec92bac423444a880b19b7c4..21a7f4d039599f0f3c386f284dd04378b88f6b96 100644 (file)
@@ -7,6 +7,7 @@ using Content.Shared.Interaction;
 using Content.Shared.Sticky;
 using Content.Shared.Sticky.Components;
 using Content.Shared.Verbs;
+using Content.Shared.Whitelist;
 using Robust.Shared.Containers;
 using Robust.Shared.Utility;
 
@@ -20,6 +21,7 @@ public sealed class StickySystem : EntitySystem
     [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
     [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
     [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     private const string StickerSlotId = "stickers_container";
 
@@ -67,9 +69,8 @@ public sealed class StickySystem : EntitySystem
             return false;
 
         // check whitelist and blacklist
-        if (component.Whitelist != null && !component.Whitelist.IsValid(target))
-            return false;
-        if (component.Blacklist != null && component.Blacklist.IsValid(target))
+        if (_whitelistSystem.IsWhitelistFail(component.Whitelist, target) ||
+            _whitelistSystem.IsBlacklistPass(component.Blacklist, target))
             return false;
 
         var attemptEv = new AttemptEntityStickEvent(target, user);
index 415e8d9246711c1400c75074a99d240194a0c867..43fcb32d1f070dcc148d355048c19d348df7c0bb 100644 (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++;
             }
 
index 859703a72a709b718106b5a4466e42fc7cb95045..ff4a9a19cdd2a63b5d71a8125911e3a205300994 100644 (file)
@@ -23,18 +23,11 @@ public sealed partial class BuyerWhitelistCondition : ListingCondition
     public override bool Condition(ListingConditionArgs args)
     {
         var ent = args.EntityManager;
+        var whitelistSystem = ent.System<EntityWhitelistSystem>();
 
-        if (Whitelist != null)
-        {
-            if (!Whitelist.IsValid(args.Buyer, ent))
-                return false;
-        }
-
-        if (Blacklist != null)
-        {
-            if (Blacklist.IsValid(args.Buyer, ent))
-                return false;
-        }
+        if (whitelistSystem.IsWhitelistFail(Whitelist, args.Buyer) ||
+            whitelistSystem.IsBlacklistPass(Blacklist, args.Buyer))
+            return false;
 
         return true;
     }
index 20ec5cecce8ade33cb3476530ccae3747ffa260c..ced4dfa9c0b460384a50d52ce5bdebcb1541ca1b 100644 (file)
@@ -26,18 +26,11 @@ public sealed partial class StoreWhitelistCondition : ListingCondition
             return false;
 
         var ent = args.EntityManager;
+        var whitelistSystem = ent.System<EntityWhitelistSystem>();
 
-        if (Whitelist != null)
-        {
-            if (!Whitelist.IsValid(args.StoreEntity.Value, ent))
-                return false;
-        }
-
-        if (Blacklist != null)
-        {
-            if (Blacklist.IsValid(args.StoreEntity.Value, ent))
-                return false;
-        }
+        if (whitelistSystem.IsWhitelistFail(Whitelist, args.StoreEntity.Value) ||
+            whitelistSystem.IsBlacklistPass(Blacklist, args.StoreEntity.Value))
+            return false;
 
         return true;
     }
index 1adab9930d91a247c3999b7ce0735d69f4e61f6a..4deb5238a53c54517f1ac32f0ee7860b7eccb8b1 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Server.Chat.Systems;
 using Content.Server.Speech;
 using Content.Server.Speech.Components;
+using Content.Shared.Whitelist;
 using Robust.Shared.Player;
 using static Content.Server.Chat.Systems.ChatSystem;
 
@@ -9,7 +10,7 @@ namespace Content.Server.SurveillanceCamera;
 public sealed class SurveillanceCameraMicrophoneSystem : EntitySystem
 {
     [Dependency] private readonly SharedTransformSystem _xforms = default!;
-
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
     public override void Initialize()
     {
         base.Initialize();
@@ -60,7 +61,7 @@ public sealed class SurveillanceCameraMicrophoneSystem : EntitySystem
     public void CanListen(EntityUid uid, SurveillanceCameraMicrophoneComponent microphone, ListenAttemptEvent args)
     {
         // TODO maybe just make this a part of ActiveListenerComponent?
-        if (microphone.Blacklist.IsValid(args.Source))
+        if (_whitelistSystem.IsBlacklistPass(microphone.Blacklist, args.Source))
             args.Cancel();
     }
 
index f7531f7e2ce70dda8fb672965eba14c9d747d721..f41512b6ac2df5a97e4e0dca4e45fbbc71b0dde6 100644 (file)
@@ -2,6 +2,7 @@ using Content.Server.GameTicking;
 using Content.Shared.Hands.Components;
 using Content.Shared.Hands.EntitySystems;
 using Content.Shared.Traits;
+using Content.Shared.Whitelist;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Serialization.Manager;
 
@@ -12,6 +13,7 @@ public sealed class TraitSystem : EntitySystem
     [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
     [Dependency] private readonly ISerializationManager _serializationManager = default!;
     [Dependency] private readonly SharedHandsSystem _sharedHandsSystem = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public override void Initialize()
     {
@@ -31,10 +33,8 @@ public sealed class TraitSystem : EntitySystem
                 return;
             }
 
-            if (traitPrototype.Whitelist != null && !traitPrototype.Whitelist.IsValid(args.Mob))
-                continue;
-
-            if (traitPrototype.Blacklist != null && traitPrototype.Blacklist.IsValid(args.Mob))
+            if (_whitelistSystem.IsWhitelistFail(traitPrototype.Whitelist, args.Mob) ||
+                _whitelistSystem.IsBlacklistPass(traitPrototype.Blacklist, args.Mob))
                 continue;
 
             // Add all components required by the prototype
index 6606f284327eb9dec5ea15f3f172c9314e28ffcf..f65ba46f7a5df34f42852502917c4b44dfe3ada0 100644 (file)
@@ -8,6 +8,7 @@ using Content.Server.Xenoarchaeology.XenoArtifacts;
 using Content.Shared.Body.Components;
 using Content.Shared.Damage;
 using Content.Shared.Verbs;
+using Content.Shared.Whitelist;
 using Content.Shared.Xenoarchaeology.Equipment;
 using Robust.Shared.Collections;
 using Robust.Shared.Random;
@@ -25,6 +26,7 @@ public sealed class ArtifactCrusherSystem : SharedArtifactCrusherSystem
     [Dependency] private readonly DamageableSystem _damageable = default!;
     [Dependency] private readonly StackSystem _stack = default!;
     [Dependency] private readonly PopupSystem _popup = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     /// <inheritdoc/>
     public override void Initialize()
@@ -92,7 +94,7 @@ public sealed class ArtifactCrusherSystem : SharedArtifactCrusherSystem
         var coords = Transform(ent).Coordinates;
         foreach (var contained in contents)
         {
-            if (crusher.CrushingWhitelist.IsValid(contained, EntityManager))
+            if (_whitelistSystem.IsWhitelistPass(crusher.CrushingWhitelist, contained))
             {
                 var amount = _random.Next(crusher.MinFragments, crusher.MaxFragments);
                 var stacks = _stack.SpawnMultiple(crusher.FragmentStackProtoId, amount, coords);
index a2023a18d4826485d0e58e07d998aeb1af8aa3da..f231120ad5b5bd59f342b2deeb1112d85af6719a 100644 (file)
@@ -1,6 +1,7 @@
-using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
+using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
 using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
 using Content.Shared.Damage;
+using Content.Shared.Whitelist;
 using Robust.Shared.Random;
 
 namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
@@ -10,6 +11,7 @@ public sealed class BreakWindowArtifactSystem : EntitySystem
     [Dependency] private readonly IRobustRandom _random = default!;
     [Dependency] private readonly EntityLookupSystem _lookup = default!;
     [Dependency] private readonly DamageableSystem _damageable = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     /// <inheritdoc/>
     public override void Initialize()
@@ -24,7 +26,7 @@ public sealed class BreakWindowArtifactSystem : EntitySystem
             ents.Add(args.Activator.Value);
         foreach (var ent in ents)
         {
-            if (component.Whitelist != null && !component.Whitelist.IsValid(ent))
+            if (_whitelistSystem.IsWhitelistFail(component.Whitelist, ent))
                 continue;
 
             if (!_random.Prob(component.DamageChance))
index bf86d2c1e49200140f95d2c00a9837e29052f215..0e302f1e0288e37d05cd6a568f0e34043cf90804 100644 (file)
@@ -9,6 +9,7 @@ using Content.Shared.Interaction;
 using Content.Shared.Inventory.Events;
 using Content.Shared.Mind;
 using Content.Shared.Rejuvenate;
+using Content.Shared.Whitelist;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Containers;
 using Robust.Shared.GameStates;
@@ -29,6 +30,7 @@ public abstract class SharedActionsSystem : EntitySystem
     [Dependency] private readonly SharedAudioSystem _audio = default!;
     [Dependency] private readonly SharedTransformSystem _transformSystem = default!;
     [Dependency] private readonly ActionContainerSystem _actionContainer = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public override void Initialize()
     {
@@ -477,7 +479,7 @@ public abstract class SharedActionsSystem : EntitySystem
         if (!target.IsValid() || Deleted(target))
             return false;
 
-        if (action.Whitelist != null && !action.Whitelist.IsValid(target, EntityManager))
+        if (_whitelistSystem.IsWhitelistFail(action.Whitelist, target))
             return false;
 
         if (action.CheckCanInteract && !_actionBlockerSystem.CanInteract(user, target))
index 00040211e36c820afa01eab809b9737de26b076a..e7bfb53f08c767772259e61562199ac6504b135d 100644 (file)
@@ -15,6 +15,7 @@ using Content.Shared.Storage.Components;
 using Content.Shared.Stunnable;
 using Content.Shared.Throwing;
 using Content.Shared.Verbs;
+using Content.Shared.Whitelist;
 using Robust.Shared.Physics.Components;
 using Robust.Shared.Physics.Events;
 using Robust.Shared.Utility;
@@ -24,6 +25,8 @@ namespace Content.Shared.Buckle;
 
 public abstract partial class SharedBuckleSystem
 {
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
+
     private void InitializeBuckle()
     {
         SubscribeLocalEvent<BuckleComponent, ComponentStartup>(OnBuckleComponentStartup);
@@ -224,8 +227,8 @@ public abstract partial class SharedBuckleSystem
         }
 
         // Does it pass the Whitelist
-        if (strapComp.Whitelist != null &&
-            !strapComp.Whitelist.IsValid(buckleUid, EntityManager) || strapComp.Blacklist?.IsValid(buckleUid, EntityManager) == true)
+        if (_whitelistSystem.IsWhitelistFail(strapComp.Whitelist, buckleUid) ||
+            _whitelistSystem.IsBlacklistPass(strapComp.Blacklist, buckleUid))
         {
             if (_netManager.IsServer)
                 _popup.PopupEntity(Loc.GetString("buckle-component-cannot-fit-message"), userUid, buckleUid, PopupType.Medium);
index 22d86b54fb73b7c236650667ea9e0c924396f64c..b7b3c56ba4c082bd0bcaaa1195289cf54100d2df 100644 (file)
@@ -31,7 +31,8 @@ public sealed partial class EntityWhitelistCondition : IConstructionCondition
 
     public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
     {
-        return Whitelist.IsValid(user);
+        var whitelistSystem = IoCManager.Resolve<IEntityManager>().System<EntityWhitelistSystem>();
+        return whitelistSystem.IsWhitelistPass(Whitelist, user);
     }
 
     public ConstructionGuideEntry GenerateGuideEntry()
index 7fd156213b45022236a7a26d0440b0c007aab345..7acfafee4a639a5a5d1760f68c08957db3e2fda6 100644 (file)
@@ -11,6 +11,7 @@ using Content.Shared.Item;
 using Content.Shared.Movement.Systems;
 using Content.Shared.Popups;
 using Content.Shared.Strip.Components;
+using Content.Shared.Whitelist;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Containers;
 using Robust.Shared.Timing;
@@ -30,6 +31,7 @@ public abstract partial class InventorySystem
     [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
     [Dependency] private readonly IGameTiming _gameTiming = default!;
     [Dependency] private readonly SharedTransformSystem _transform = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     [ValidatePrototypeId<ItemSizePrototype>]
     private const string PocketableItemSize = "Small";
@@ -267,13 +269,8 @@ public abstract partial class InventorySystem
             return false;
         }
 
-        if (slotDefinition.Whitelist != null && !slotDefinition.Whitelist.IsValid(itemUid))
-        {
-            reason = "inventory-component-can-equip-does-not-fit";
-            return false;
-        }
-
-        if (slotDefinition.Blacklist != null && slotDefinition.Blacklist.IsValid(itemUid))
+        if (_whitelistSystem.IsWhitelistFail(slotDefinition.Whitelist, itemUid) ||
+            _whitelistSystem.IsBlacklistPass(slotDefinition.Blacklist, itemUid))
         {
             reason = "inventory-component-can-equip-does-not-fit";
             return false;
index 7dbeee3e770aed197e4aac5351349c209e13aaa4..0763bb101caeb4d7cf05f0800a8f470a3dd22182 100644 (file)
@@ -4,6 +4,7 @@ using Content.Shared.Interaction;
 using Content.Shared.Labels.Components;
 using Content.Shared.Popups;
 using Content.Shared.Verbs;
+using Content.Shared.Whitelist;
 using Robust.Shared.GameStates;
 using Robust.Shared.Network;
 
@@ -16,6 +17,7 @@ public abstract class SharedHandLabelerSystem : EntitySystem
     [Dependency] private readonly SharedLabelSystem _labelSystem = default!;
     [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
     [Dependency] private readonly INetManager _netManager = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public override void Initialize()
     {
@@ -77,7 +79,7 @@ public abstract class SharedHandLabelerSystem : EntitySystem
 
     private void OnUtilityVerb(EntityUid uid, HandLabelerComponent handLabeler, GetVerbsEvent<UtilityVerb> args)
     {
-        if (args.Target is not { Valid: true } target || !handLabeler.Whitelist.IsValid(target) || !args.CanAccess)
+        if (args.Target is not { Valid: true } target || _whitelistSystem.IsWhitelistFail(handLabeler.Whitelist, target) || !args.CanAccess)
             return;
 
         var labelerText = handLabeler.AssignedLabel == string.Empty ? Loc.GetString("hand-labeler-remove-label-text") : Loc.GetString("hand-labeler-add-label-text");
@@ -96,7 +98,7 @@ public abstract class SharedHandLabelerSystem : EntitySystem
 
     private void AfterInteractOn(EntityUid uid, HandLabelerComponent handLabeler, AfterInteractEvent args)
     {
-        if (args.Target is not { Valid: true } target || !handLabeler.Whitelist.IsValid(target) || !args.CanReach)
+        if (args.Target is not { Valid: true } target || _whitelistSystem.IsWhitelistFail(handLabeler.Whitelist, target) || !args.CanReach)
             return;
 
         Labeling(uid, target, args.User, handLabeler);
index fb1702bb94e07df67ed661690d9e39abda58846c..9a7da17d486353e9518569027923cfdae03ff8b6 100644 (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))
index 73b7c0847fc133b3a5229b636e6fe75d723bbb1e..2ec48085c47dd7eb3e279e4468bdd36d055a1d78 100644 (file)
@@ -15,6 +15,7 @@ using Content.Shared.Movement.Components;
 using Content.Shared.Movement.Systems;
 using Content.Shared.Popups;
 using Content.Shared.Weapons.Melee;
+using Content.Shared.Whitelist;
 using Robust.Shared.Containers;
 using Robust.Shared.Network;
 using Robust.Shared.Serialization;
@@ -37,6 +38,7 @@ public abstract class SharedMechSystem : EntitySystem
     [Dependency] private readonly SharedMoverController _mover = default!;
     [Dependency] private readonly SharedPopupSystem _popup = default!;
     [Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     /// <inheritdoc/>
     public override void Initialize()
@@ -216,7 +218,7 @@ public abstract class SharedMechSystem : EntitySystem
         if (component.EquipmentContainer.ContainedEntities.Count >= component.MaxEquipmentAmount)
             return;
 
-        if (component.EquipmentWhitelist != null && !component.EquipmentWhitelist.IsValid(toInsert))
+        if (_whitelistSystem.IsWhitelistFail(component.EquipmentWhitelist, toInsert))
             return;
 
         equipmentComponent.EquipmentOwner = uid;
index 400a675cd253c909d73e64739785f2033a2e0046..6e1b3a29aec511335c8cccaf578f44b5b71dcb47 100644 (file)
@@ -1,4 +1,5 @@
 using Content.Shared.Movement.Components;
+using Content.Shared.Whitelist;
 using Robust.Shared.Physics.Components;
 using Robust.Shared.Physics.Events;
 using Robust.Shared.Physics.Systems;
@@ -9,6 +10,7 @@ public sealed class SpeedModifierContactsSystem : EntitySystem
 {
     [Dependency] private readonly SharedPhysicsSystem _physics = default!;
     [Dependency] private readonly MovementSpeedModifierSystem _speedModifierSystem = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     // TODO full-game-save
     // Either these need to be processed before a map is saved, or slowed/slowing entities need to update on init.
@@ -86,7 +88,7 @@ public sealed class SpeedModifierContactsSystem : EntitySystem
             if (!TryComp<SpeedModifierContactsComponent>(ent, out var slowContactsComponent))
                 continue;
 
-            if (slowContactsComponent.IgnoreWhitelist != null && slowContactsComponent.IgnoreWhitelist.IsValid(uid))
+            if (_whitelistSystem.IsWhitelistPass(slowContactsComponent.IgnoreWhitelist, uid))
                 continue;
 
             walkSpeed += slowContactsComponent.WalkSpeedModifier;
index df9cf8ac8252f88149a3d4641e6a7bb9c373d20d..6838e7982cb0cb36ae3090286959e7d4c172ddb3 100644 (file)
@@ -17,6 +17,7 @@ public sealed class EmagProviderSystem : EntitySystem
     [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
     [Dependency] private readonly SharedNinjaGlovesSystem _gloves = default!;
     [Dependency] private readonly TagSystem _tags = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public override void Initialize()
     {
@@ -35,7 +36,7 @@ public sealed class EmagProviderSystem : EntitySystem
             return;
 
         // only allowed to emag entities on the whitelist
-        if (comp.Whitelist != null && !comp.Whitelist.IsValid(target, EntityManager))
+        if (_whitelistSystem.IsWhitelistFail(comp.Whitelist, target))
             return;
 
         // only allowed to emag non-immune entities
index 9be6a4acd5a68126441b27ef97f8019d71cff9f9..d1ea88b82a0cff555cdadbb278dad6d1d7f9d68b 100644 (file)
@@ -1,4 +1,5 @@
-using Robust.Shared.Physics.Events;
+using Content.Shared.Whitelist;
+using Robust.Shared.Physics.Events;
 using Robust.Shared.Physics.Systems;
 
 namespace Content.Shared.Placeable;
@@ -11,6 +12,7 @@ public sealed class ItemPlacerSystem : EntitySystem
 {
     [Dependency] private readonly CollisionWakeSystem _wake = default!;
     [Dependency] private readonly PlaceableSurfaceSystem _placeableSurface = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public override void Initialize()
     {
@@ -22,7 +24,7 @@ public sealed class ItemPlacerSystem : EntitySystem
 
     private void OnStartCollide(EntityUid uid, ItemPlacerComponent comp, ref StartCollideEvent args)
     {
-        if (comp.Whitelist != null && !comp.Whitelist.IsValid(args.OtherEntity))
+        if (_whitelistSystem.IsWhitelistFail(comp.Whitelist, args.OtherEntity))
             return;
 
         if (TryComp<CollisionWakeComponent>(args.OtherEntity, out var wakeComp))
index 6b8a58abb71213123b461b735949c9fd592838b4..58d67c268e3a4b4edf075abd7226d4a3a6ebc4ae 100644 (file)
@@ -1,6 +1,7 @@
 using System.Numerics;
 using Content.Shared.Access.Components;
 using Content.Shared.Access.Systems;
+using Content.Shared.Whitelist;
 using Robust.Shared.Map;
 using Robust.Shared.Map.Components;
 using Robust.Shared.Physics.Components;
@@ -14,7 +15,7 @@ public sealed class RulesSystem : EntitySystem
     [Dependency] private readonly AccessReaderSystem _reader = default!;
     [Dependency] private readonly EntityLookupSystem _lookup = default!;
     [Dependency] private readonly SharedTransformSystem _transform = default!;
-
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
     public bool IsTrue(EntityUid uid, RulesPrototype rules)
     {
         var inRange = new HashSet<Entity<IComponent>>();
@@ -158,7 +159,7 @@ public sealed class RulesSystem : EntitySystem
 
                     foreach (var ent in _lookup.GetEntitiesInRange(xform.MapID, worldPos, entity.Range))
                     {
-                        if (!entity.Whitelist.IsValid(ent, EntityManager))
+                        if (_whitelistSystem.IsWhitelistFail(entity.Whitelist, ent))
                             continue;
 
                         count++;
index 0dcdc44c9f212c824e8f3aa5e47899df3ca8e384..efc18abaa065dd0306cc87035a84eb17de176b5d 100644 (file)
@@ -8,6 +8,7 @@ using Content.Shared.Mobs;
 using Content.Shared.Popups;
 using Content.Shared.Sound.Components;
 using Content.Shared.Throwing;
+using Content.Shared.Whitelist;
 using JetBrains.Annotations;
 using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
@@ -34,6 +35,7 @@ public abstract class SharedEmitSoundSystem : EntitySystem
     [Dependency] private   readonly SharedAmbientSoundSystem _ambient = default!;
     [Dependency] private   readonly SharedAudioSystem _audioSystem = default!;
     [Dependency] protected readonly SharedPopupSystem Popup = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public override void Initialize()
     {
@@ -123,7 +125,7 @@ public abstract class SharedEmitSoundSystem : EntitySystem
 
     private void OnEmitSoundOnInteractUsing(Entity<EmitSoundOnInteractUsingComponent> ent, ref InteractUsingEvent args)
     {
-        if (ent.Comp.Whitelist.IsValid(args.Used, EntityManager))
+        if (_whitelistSystem.IsWhitelistPass(ent.Comp.Whitelist, args.Used))
         {
             TryEmitSound(ent, ent.Comp, args.User);
         }
index d81ad754d1ef8ae8575ecb6d86e355d11271e085..14703f3177ea859f60e14067c0a0283fe6a808d7 100644 (file)
@@ -1,5 +1,6 @@
 using Content.Shared.Gravity;
 using Content.Shared.StepTrigger.Components;
+using Content.Shared.Whitelist;
 using Robust.Shared.Map.Components;
 using Robust.Shared.Physics;
 using Robust.Shared.Physics.Components;
@@ -12,6 +13,7 @@ public sealed class StepTriggerSystem : EntitySystem
     [Dependency] private readonly EntityLookupSystem _entityLookup = default!;
     [Dependency] private readonly SharedGravitySystem _gravity = default!;
     [Dependency] private readonly SharedMapSystem _map = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public override void Initialize()
     {
@@ -67,7 +69,7 @@ public sealed class StepTriggerSystem : EntitySystem
                 if (ent == uid)
                     continue;
 
-                if (component.Blacklist.IsValid(ent.Value, EntityManager) == true)
+                if (_whitelistSystem.IsBlacklistPass(component.Blacklist, ent.Value))
                 {
                     return false;
                 }
index 1cc95337ea4a9249dcfe60dec948ce1dd48485af..8c2cb4c4fcbf7575f6fe3dba11a34af07762cd80 100644 (file)
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
 using Content.Shared.Administration.Logs;
 using Content.Shared.Database;
 using Content.Shared.Examine;
@@ -7,6 +7,7 @@ using Content.Shared.Interaction;
 using Content.Shared.Item;
 using Content.Shared.Storage.Components;
 using Content.Shared.Verbs;
+using Content.Shared.Whitelist;
 using Robust.Shared.Containers;
 using Robust.Shared.Network;
 
@@ -21,6 +22,7 @@ public sealed class BinSystem : EntitySystem
     [Dependency] private readonly ISharedAdminLogManager _admin = default!;
     [Dependency] private readonly SharedContainerSystem _container = default!;
     [Dependency] private readonly SharedHandsSystem _hands = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public const string BinContainerId = "bin-container";
 
@@ -130,7 +132,7 @@ public sealed class BinSystem : EntitySystem
         if (component.Items.Count >= component.MaxItems)
             return false;
 
-        if (component.Whitelist != null && !component.Whitelist.IsValid(toInsert))
+        if (_whitelistSystem.IsWhitelistFail(component.Whitelist, toInsert))
             return false;
 
         _container.Insert(toInsert, component.ItemContainer);
index a5e151f4ea62cfdb271162655a22b342dacd0d43..2557f8100c66db6fec1ed3d1c33334549485cda0 100644 (file)
@@ -1,5 +1,6 @@
-using System.Linq;
+using System.Linq;
 using Content.Shared.Storage.Components;
+using Content.Shared.Whitelist;
 using JetBrains.Annotations;
 using Robust.Shared.Containers;
 
@@ -15,6 +16,7 @@ namespace Content.Shared.Storage.EntitySystems
     {
         [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
         [Dependency] private readonly SharedContainerSystem _container = default!;
+        [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
         /// <inheritdoc />
         public override void Initialize()
@@ -93,7 +95,7 @@ namespace Content.Shared.Storage.EntitySystems
             var list = new List<string>();
             foreach (var mapLayerData in itemMapper.MapLayers.Values)
             {
-                var count = containedLayers.Count(ent => mapLayerData.ServerWhitelist.IsValid(ent));
+                var count = containedLayers.Count(ent => _whitelistSystem.IsWhitelistPass(mapLayerData.ServerWhitelist, ent));
                 if (count >= mapLayerData.MinCount && count <= mapLayerData.MaxCount)
                 {
                     list.Add(mapLayerData.Layer);
index bc73baa61adfa7949425b46e30ece0c81d5efcd9..58c249fec54f873212564f3703242a604eed4a03 100644 (file)
@@ -4,6 +4,7 @@ using Content.Shared.Interaction;
 using Content.Shared.Popups;
 using Content.Shared.Teleportation.Components;
 using Content.Shared.Verbs;
+using Content.Shared.Whitelist;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Containers;
 using Robust.Shared.Map.Components;
@@ -24,6 +25,7 @@ public sealed class SwapTeleporterSystem : EntitySystem
     [Dependency] private readonly SharedContainerSystem _container = default!;
     [Dependency] private readonly SharedPopupSystem _popup = default!;
     [Dependency] private readonly SharedTransformSystem _transform = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     private EntityQuery<TransformComponent> _xformQuery;
 
@@ -51,8 +53,8 @@ public sealed class SwapTeleporterSystem : EntitySystem
         if (!TryComp<SwapTeleporterComponent>(target, out var targetComp))
             return;
 
-        if (!comp.TeleporterWhitelist.IsValid(target, EntityManager) ||
-            !targetComp.TeleporterWhitelist.IsValid(uid, EntityManager))
+        if (_whitelistSystem.IsWhitelistFail(comp.TeleporterWhitelist, target) ||
+            _whitelistSystem.IsWhitelistFail(targetComp.TeleporterWhitelist, uid))
         {
             return;
         }
index 1bb11f337f65533855b88642b6e285f5d6be382a..b1006b2a74238237385e0eee488c17f5601659a1 100644 (file)
@@ -8,6 +8,7 @@ using Content.Shared.Interaction;
 using Content.Shared.Interaction.Events;
 using Content.Shared.Popups;
 using Content.Shared.Verbs;
+using Content.Shared.Whitelist;
 using Robust.Shared.Utility;
 
 namespace Content.Shared.UserInterface;
@@ -19,6 +20,7 @@ public sealed partial class ActivatableUISystem : EntitySystem
     [Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!;
     [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
     [Dependency] private readonly SharedHandsSystem _hands = default!;
+    [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
     public override void Initialize()
     {
@@ -96,7 +98,7 @@ public sealed partial class ActivatableUISystem : EntitySystem
         if (!args.CanAccess)
             return false;
 
-        if (!component.RequiredItems?.IsValid(args.Using ?? default, EntityManager) ?? false)
+        if (_whitelistSystem.IsWhitelistFail(component.RequiredItems, args.Using ?? default))
             return false;
 
         if (component.RequireHands)
@@ -156,7 +158,7 @@ public sealed partial class ActivatableUISystem : EntitySystem
         if (component.RequiredItems == null)
             return;
 
-        if (!component.RequiredItems.IsValid(args.Used, EntityManager))
+        if (_whitelistSystem.IsWhitelistFail(component.RequiredItems, args.Used))
             return;
 
         args.Handled = InteractUI(args.User, uid, component);
index 1f9e6cee76aa342390b3693735a7899a67c0c84f..9123661c8e96928de894578729ee90b1b4df7d52 100644 (file)
@@ -15,6 +15,7 @@ public abstract partial class SharedGunSystem
 {
     [Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
 
+
     protected virtual void InitializeBallistic()
     {
         SubscribeLocalEvent<BallisticAmmoProviderComponent, ComponentInit>(OnBallisticInit);
@@ -125,7 +126,7 @@ public abstract partial class SharedGunSystem
             if (ent == null)
                 continue;
 
-            if (!target.Whitelist.IsValid(ent.Value))
+            if (_whitelistSystem.IsWhitelistFail(target.Whitelist, ent.Value))
             {
                 Popup(
                     Loc.GetString("gun-ballistic-transfer-invalid",
index 77ee419ac3bc68fb71f88ac83085afaaf125b751..d4aa024f4c84d909b33cbb9eb490ea9c47a3f5d5 100644 (file)
@@ -42,7 +42,7 @@ public partial class SharedGunSystem
 
         while (enumerator.NextItem(out var item))
         {
-            if (component.ProviderWhitelist == null || !component.ProviderWhitelist.IsValid(item, EntityManager))
+            if (_whitelistSystem.IsWhitelistFailOrNull(component.ProviderWhitelist, item))
                 continue;
 
             slotEntity = item;