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

@@ -22,6 +22,7 @@ public sealed class TargetOutlineSystem : EntitySystem
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
private bool _enabled = false; private bool _enabled = false;
@@ -137,7 +138,7 @@ public sealed class TargetOutlineSystem : EntitySystem
// check the entity whitelist // check the entity whitelist
if (valid && Whitelist != null) if (valid && Whitelist != null)
valid = Whitelist.IsValid(entity); valid = _whitelistSystem.IsWhitelistPass(Whitelist, entity);
// and check the cancellable event // and check the cancellable event
if (valid && ValidationEvent != null) if (valid && ValidationEvent != null)

View File

@@ -81,6 +81,7 @@ public partial class ChatSystem
bool ignoreActionBlocker = false bool ignoreActionBlocker = false
) )
{ {
if (_whitelistSystem.IsWhitelistFail(emote.Whitelist, source) || _whitelistSystem.IsBlacklistPass(emote.Blacklist, source)) if (_whitelistSystem.IsWhitelistFail(emote.Whitelist, source) || _whitelistSystem.IsBlacklistPass(emote.Blacklist, source))
return; return;

View File

@@ -1,4 +1,4 @@
using Content.Shared.Chemistry.Reaction; using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reagent; using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Content.Shared.Maps; using Content.Shared.Maps;
@@ -47,7 +47,8 @@ public sealed partial class CreateEntityTileReaction : ITileReaction
int acc = 0; int acc = 0;
foreach (var ent in tile.GetEntitiesInTile()) foreach (var ent in tile.GetEntitiesInTile())
{ {
if (Whitelist.IsValid(ent)) var whitelistSystem = entityManager.System<EntityWhitelistSystem>();
if (whitelistSystem.IsWhitelistPass(Whitelist, ent))
acc += 1; acc += 1;
if (acc >= MaxOnTile) if (acc >= MaxOnTile)

View File

@@ -14,6 +14,7 @@ using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.Storage; using Content.Shared.Storage;
using Content.Shared.Whitelist;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Player; using Robust.Shared.Player;
@@ -30,6 +31,7 @@ namespace Content.Server.Construction
[Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly EntityLookupSystem _lookupSystem = default!; [Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
[Dependency] private readonly SharedTransformSystem _transformSystem = default!; [Dependency] private readonly SharedTransformSystem _transformSystem = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
// --- WARNING! LEGACY CODE AHEAD! --- // --- WARNING! LEGACY CODE AHEAD! ---
// This entire file contains the legacy code for initial construction. // This entire file contains the legacy code for initial construction.
@@ -337,7 +339,7 @@ namespace Content.Server.Construction
return false; 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); _popup.PopupEntity(Loc.GetString("construction-system-cannot-start"), user, user);
return false; return false;
@@ -422,7 +424,7 @@ namespace Content.Server.Construction
return; 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); _popup.PopupEntity(Loc.GetString("construction-system-cannot-start"), user, user);
return; return;

View File

@@ -3,6 +3,7 @@ using Content.Server.GameTicking.Components;
using Content.Server.GameTicking.Rules.Components; using Content.Server.GameTicking.Rules.Components;
using Content.Server.GridPreloader; using Content.Server.GridPreloader;
using Content.Server.Spawners.Components; using Content.Server.Spawners.Components;
using Content.Shared.Whitelist;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Server.Maps; using Robust.Server.Maps;
using Robust.Shared.Map; using Robust.Shared.Map;
@@ -19,6 +20,7 @@ public sealed class LoadMapRuleSystem : GameRuleSystem<LoadMapRuleComponent>
[Dependency] private readonly MetaDataSystem _metaData = default!; [Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly TransformSystem _transform = default!; [Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly GridPreloaderSystem _gridPreloader = default!; [Dependency] private readonly GridPreloaderSystem _gridPreloader = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() 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)) if (xform.GridUid == null || !ent.Comp.MapGrids.Contains(xform.GridUid.Value))
continue; continue;
if (ent.Comp.SpawnerWhitelist != null && !ent.Comp.SpawnerWhitelist.IsValid(uid, EntityManager)) if (_whitelistSystem.IsWhitelistFail(ent.Comp.SpawnerWhitelist, uid))
continue; continue;
args.Coordinates.Add(_transform.GetMapCoordinates(xform)); args.Coordinates.Add(_transform.GetMapCoordinates(xform));

View File

@@ -1,5 +1,6 @@
using Content.Server.GameTicking.Rules.VariationPass.Components; using Content.Server.GameTicking.Rules.VariationPass.Components;
using Content.Server.Wires; using Content.Server.Wires;
using Content.Shared.Whitelist;
using Robust.Shared.Random; using Robust.Shared.Random;
namespace Content.Server.GameTicking.Rules.VariationPass; namespace Content.Server.GameTicking.Rules.VariationPass;
@@ -11,6 +12,8 @@ namespace Content.Server.GameTicking.Rules.VariationPass;
/// </summary> /// </summary>
public sealed class CutWireVariationPassSystem : VariationPassSystem<CutWireVariationPassComponent> public sealed class CutWireVariationPassSystem : VariationPassSystem<CutWireVariationPassComponent>
{ {
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
protected override void ApplyVariation(Entity<CutWireVariationPassComponent> ent, ref StationVariationPassEvent args) protected override void ApplyVariation(Entity<CutWireVariationPassComponent> ent, ref StationVariationPassEvent args)
{ {
var wiresCut = 0; var wiresCut = 0;
@@ -22,7 +25,7 @@ public sealed class CutWireVariationPassSystem : VariationPassSystem<CutWireVari
continue; continue;
// Check against blacklist // Check against blacklist
if (ent.Comp.Blacklist.IsValid(uid)) if (_whitelistSystem.IsBlacklistPass(ent.Comp.Blacklist, uid))
continue; continue;
if (Random.Prob(ent.Comp.WireCutChance)) if (Random.Prob(ent.Comp.WireCutChance))

View File

@@ -1,9 +1,10 @@
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.Hands.Systems; using Content.Server.Hands.Systems;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Item; using Content.Shared.Item;
using Content.Shared.Whitelist;
using Robust.Server.Audio; using Robust.Server.Audio;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Map.Components; using Robust.Shared.Map.Components;
@@ -24,6 +25,7 @@ public sealed class RandomGiftSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
private readonly List<string> _possibleGiftsSafe = new(); private readonly List<string> _possibleGiftsSafe = new();
private readonly List<string> _possibleGiftsUnsafe = 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) 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; return;
var name = _prototype.Index<EntityPrototype>(component.SelectedEntity).Name; var name = _prototype.Index<EntityPrototype>(component.SelectedEntity).Name;

View File

@@ -3,6 +3,7 @@ using Content.Shared.DoAfter;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Mech.Components; using Content.Shared.Mech.Components;
using Content.Shared.Mech.Equipment.Components; using Content.Shared.Mech.Equipment.Components;
using Content.Shared.Whitelist;
namespace Content.Server.Mech.Systems; namespace Content.Server.Mech.Systems;
@@ -14,6 +15,7 @@ public sealed class MechEquipmentSystem : EntitySystem
[Dependency] private readonly MechSystem _mech = default!; [Dependency] private readonly MechSystem _mech = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!; [Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
/// <inheritdoc/> /// <inheritdoc/>
public override void Initialize() public override void Initialize()
@@ -40,7 +42,7 @@ public sealed class MechEquipmentSystem : EntitySystem
if (mechComp.EquipmentContainer.ContainedEntities.Count >= mechComp.MaxEquipmentAmount) if (mechComp.EquipmentContainer.ContainedEntities.Count >= mechComp.MaxEquipmentAmount)
return; return;
if (mechComp.EquipmentWhitelist != null && !mechComp.EquipmentWhitelist.IsValid(args.Used)) if (_whitelistSystem.IsWhitelistFail(mechComp.EquipmentWhitelist, args.Used))
return; return;
_popup.PopupEntity(Loc.GetString("mech-equipment-begin-install", ("item", uid)), mech); _popup.PopupEntity(Loc.GetString("mech-equipment-begin-install", ("item", uid)), mech);

View File

@@ -22,6 +22,7 @@ using Robust.Server.Containers;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Player; using Robust.Shared.Player;
using Content.Shared.Whitelist;
namespace Content.Server.Mech.Systems; namespace Content.Server.Mech.Systems;
@@ -36,6 +37,7 @@ public sealed partial class MechSystem : SharedMechSystem
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!; [Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!; [Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
[Dependency] private readonly SharedToolSystem _toolSystem = default!; [Dependency] private readonly SharedToolSystem _toolSystem = default!;
/// <inheritdoc/> /// <inheritdoc/>
@@ -224,7 +226,7 @@ public sealed partial class MechSystem : SharedMechSystem
if (args.Cancelled || args.Handled) if (args.Cancelled || args.Handled)
return; 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); _popup.PopupEntity(Loc.GetString("mech-no-enter", ("item", uid)), args.User);
return; return;

View File

@@ -9,6 +9,7 @@ using Content.Shared.Stunnable;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using Content.Shared.Whitelist;
namespace Content.Server.Ninja.Systems; namespace Content.Server.Ninja.Systems;
@@ -24,6 +25,7 @@ public sealed class StunProviderSystem : SharedStunProviderSystem
[Dependency] private readonly SharedNinjaGlovesSystem _gloves = default!; [Dependency] private readonly SharedNinjaGlovesSystem _gloves = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedStunSystem _stun = default!; [Dependency] private readonly SharedStunSystem _stun = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() 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)) if (args.Handled || comp.BatteryUid == null || !_gloves.AbilityCheck(uid, args, out var target))
return; return;
if (target == uid || !comp.Whitelist.IsValid(target, EntityManager)) if (target == uid || _whitelistSystem.IsWhitelistFail(comp.Whitelist, target))
return; return;
if (_timing.CurTime < comp.NextStun) if (_timing.CurTime < comp.NextStun)

View File

@@ -1,4 +1,4 @@
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.Popups; using Content.Server.Popups;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.IdentityManagement; using Content.Shared.IdentityManagement;
@@ -9,6 +9,7 @@ using Content.Shared.Nutrition.AnimalHusbandry;
using Content.Shared.Nutrition.Components; using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems; using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Storage; using Content.Shared.Storage;
using Content.Shared.Whitelist;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
@@ -33,6 +34,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem
[Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
private readonly HashSet<EntityUid> _failedAttempts = new(); private readonly HashSet<EntityUid> _failedAttempts = new();
private readonly HashSet<EntityUid> _birthQueue = new(); private readonly HashSet<EntityUid> _birthQueue = new();
@@ -174,7 +176,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem
if (!CanReproduce(partner)) if (!CanReproduce(partner))
return false; return false;
return component.PartnerWhitelist.IsValid(partner); return _whitelistSystem.IsWhitelistPass(component.PartnerWhitelist, partner);
} }
/// <summary> /// <summary>

View File

@@ -32,6 +32,7 @@ using Robust.Shared.Audio.Systems;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using System.Linq; using System.Linq;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Content.Shared.Whitelist;
namespace Content.Server.Nutrition.EntitySystems; namespace Content.Server.Nutrition.EntitySystems;
@@ -57,6 +58,7 @@ public sealed class FoodSystem : EntitySystem
[Dependency] private readonly StackSystem _stack = default!; [Dependency] private readonly StackSystem _stack = default!;
[Dependency] private readonly StomachSystem _stomach = default!; [Dependency] private readonly StomachSystem _stomach = default!;
[Dependency] private readonly UtensilSystem _utensil = default!; [Dependency] private readonly UtensilSystem _utensil = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public const float MaxFeedDistance = 1.0f; public const float MaxFeedDistance = 1.0f;
@@ -408,7 +410,7 @@ public sealed class FoodSystem : EntitySystem
if (comp.SpecialDigestible == null) if (comp.SpecialDigestible == null)
continue; continue;
// Check if the food is in the whitelist // Check if the food is in the whitelist
if (comp.SpecialDigestible.IsValid(food, EntityManager)) if (_whitelistSystem.IsWhitelistPass(comp.SpecialDigestible, food))
return true; return true;
// They can only eat whitelist food and the food isn't in the whitelist. It's not edible. // They can only eat whitelist food and the food isn't in the whitelist. It's not edible.
return false; return false;

View File

@@ -1,5 +1,6 @@
using Content.Server.Objectives.Components; using Content.Server.Objectives.Components;
using Content.Shared.Objectives.Components; using Content.Shared.Objectives.Components;
using Content.Shared.Whitelist;
namespace Content.Server.Objectives.Systems; namespace Content.Server.Objectives.Systems;
@@ -8,6 +9,8 @@ namespace Content.Server.Objectives.Systems;
/// </summary> /// </summary>
public sealed class ObjectiveBlacklistRequirementSystem : EntitySystem public sealed class ObjectiveBlacklistRequirementSystem : EntitySystem
{ {
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -22,7 +25,7 @@ public sealed class ObjectiveBlacklistRequirementSystem : EntitySystem
foreach (var objective in args.Mind.AllObjectives) foreach (var objective in args.Mind.AllObjectives)
{ {
if (comp.Blacklist.IsValid(objective, EntityManager)) if (_whitelistSystem.IsBlacklistPass(comp.Blacklist, objective))
{ {
args.Cancelled = true; args.Cancelled = true;
return; return;

View File

@@ -1,5 +1,6 @@
using Content.Server.Objectives.Components; using Content.Server.Objectives.Components;
using Content.Shared.Objectives.Components; using Content.Shared.Objectives.Components;
using Content.Shared.Whitelist;
namespace Content.Server.Objectives.Systems; namespace Content.Server.Objectives.Systems;
@@ -8,6 +9,7 @@ namespace Content.Server.Objectives.Systems;
/// </summary> /// </summary>
public sealed class RoleRequirementSystem : EntitySystem public sealed class RoleRequirementSystem : EntitySystem
{ {
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() public override void Initialize()
{ {
base.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 // 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 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; args.Cancelled = true;
} }
} }

View File

@@ -1,6 +1,7 @@
using Content.Server.Polymorph.Components; using Content.Server.Polymorph.Components;
using Content.Shared.Polymorph; using Content.Shared.Polymorph;
using Content.Shared.Projectiles; using Content.Shared.Projectiles;
using Content.Shared.Whitelist;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Physics.Events; using Robust.Shared.Physics.Events;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
@@ -9,6 +10,8 @@ namespace Content.Server.Polymorph.Systems;
public partial class PolymorphSystem public partial class PolymorphSystem
{ {
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
/// <summary> /// <summary>
/// Need to do this so we don't get a collection enumeration error in physics by polymorphing /// Need to do this so we don't get a collection enumeration error in physics by polymorphing
/// an entity we're colliding with /// an entity we're colliding with
@@ -39,8 +42,8 @@ public partial class PolymorphSystem
return; return;
var other = args.OtherEntity; var other = args.OtherEntity;
if (!component.Whitelist.IsValid(other, EntityManager) if (_whitelistSystem.IsWhitelistFail(component.Whitelist, other) ||
|| component.Blacklist != null && component.Blacklist.IsValid(other, EntityManager)) _whitelistSystem.IsBlacklistPass(component.Blacklist, other))
return; return;
_queuedPolymorphUpdates.Enqueue(new (other, component.Sound, component.Polymorph)); _queuedPolymorphUpdates.Enqueue(new (other, component.Sound, component.Polymorph));

View File

@@ -7,6 +7,7 @@ using Content.Shared.Interaction;
using Content.Shared.Sticky; using Content.Shared.Sticky;
using Content.Shared.Sticky.Components; using Content.Shared.Sticky.Components;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Content.Shared.Whitelist;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -20,6 +21,7 @@ public sealed class StickySystem : EntitySystem
[Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
private const string StickerSlotId = "stickers_container"; private const string StickerSlotId = "stickers_container";
@@ -67,9 +69,8 @@ public sealed class StickySystem : EntitySystem
return false; return false;
// check whitelist and blacklist // check whitelist and blacklist
if (component.Whitelist != null && !component.Whitelist.IsValid(target)) if (_whitelistSystem.IsWhitelistFail(component.Whitelist, target) ||
return false; _whitelistSystem.IsBlacklistPass(component.Blacklist, target))
if (component.Blacklist != null && component.Blacklist.IsValid(target))
return false; return false;
var attemptEv = new AttemptEntityStickEvent(target, user); var attemptEv = new AttemptEntityStickEvent(target, user);

View File

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

View File

@@ -23,18 +23,11 @@ public sealed partial class BuyerWhitelistCondition : ListingCondition
public override bool Condition(ListingConditionArgs args) public override bool Condition(ListingConditionArgs args)
{ {
var ent = args.EntityManager; var ent = args.EntityManager;
var whitelistSystem = ent.System<EntityWhitelistSystem>();
if (Whitelist != null) if (whitelistSystem.IsWhitelistFail(Whitelist, args.Buyer) ||
{ whitelistSystem.IsBlacklistPass(Blacklist, args.Buyer))
if (!Whitelist.IsValid(args.Buyer, ent))
return false; return false;
}
if (Blacklist != null)
{
if (Blacklist.IsValid(args.Buyer, ent))
return false;
}
return true; return true;
} }

View File

@@ -26,18 +26,11 @@ public sealed partial class StoreWhitelistCondition : ListingCondition
return false; return false;
var ent = args.EntityManager; var ent = args.EntityManager;
var whitelistSystem = ent.System<EntityWhitelistSystem>();
if (Whitelist != null) if (whitelistSystem.IsWhitelistFail(Whitelist, args.StoreEntity.Value) ||
{ whitelistSystem.IsBlacklistPass(Blacklist, args.StoreEntity.Value))
if (!Whitelist.IsValid(args.StoreEntity.Value, ent))
return false; return false;
}
if (Blacklist != null)
{
if (Blacklist.IsValid(args.StoreEntity.Value, ent))
return false;
}
return true; return true;
} }

View File

@@ -1,6 +1,7 @@
using Content.Server.Chat.Systems; using Content.Server.Chat.Systems;
using Content.Server.Speech; using Content.Server.Speech;
using Content.Server.Speech.Components; using Content.Server.Speech.Components;
using Content.Shared.Whitelist;
using Robust.Shared.Player; using Robust.Shared.Player;
using static Content.Server.Chat.Systems.ChatSystem; using static Content.Server.Chat.Systems.ChatSystem;
@@ -9,7 +10,7 @@ namespace Content.Server.SurveillanceCamera;
public sealed class SurveillanceCameraMicrophoneSystem : EntitySystem public sealed class SurveillanceCameraMicrophoneSystem : EntitySystem
{ {
[Dependency] private readonly SharedTransformSystem _xforms = default!; [Dependency] private readonly SharedTransformSystem _xforms = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -60,7 +61,7 @@ public sealed class SurveillanceCameraMicrophoneSystem : EntitySystem
public void CanListen(EntityUid uid, SurveillanceCameraMicrophoneComponent microphone, ListenAttemptEvent args) public void CanListen(EntityUid uid, SurveillanceCameraMicrophoneComponent microphone, ListenAttemptEvent args)
{ {
// TODO maybe just make this a part of ActiveListenerComponent? // TODO maybe just make this a part of ActiveListenerComponent?
if (microphone.Blacklist.IsValid(args.Source)) if (_whitelistSystem.IsBlacklistPass(microphone.Blacklist, args.Source))
args.Cancel(); args.Cancel();
} }

View File

@@ -2,6 +2,7 @@ using Content.Server.GameTicking;
using Content.Shared.Hands.Components; using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems; using Content.Shared.Hands.EntitySystems;
using Content.Shared.Traits; using Content.Shared.Traits;
using Content.Shared.Whitelist;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Manager;
@@ -12,6 +13,7 @@ public sealed class TraitSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ISerializationManager _serializationManager = default!; [Dependency] private readonly ISerializationManager _serializationManager = default!;
[Dependency] private readonly SharedHandsSystem _sharedHandsSystem = default!; [Dependency] private readonly SharedHandsSystem _sharedHandsSystem = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -31,10 +33,8 @@ public sealed class TraitSystem : EntitySystem
return; return;
} }
if (traitPrototype.Whitelist != null && !traitPrototype.Whitelist.IsValid(args.Mob)) if (_whitelistSystem.IsWhitelistFail(traitPrototype.Whitelist, args.Mob) ||
continue; _whitelistSystem.IsBlacklistPass(traitPrototype.Blacklist, args.Mob))
if (traitPrototype.Blacklist != null && traitPrototype.Blacklist.IsValid(args.Mob))
continue; continue;
// Add all components required by the prototype // Add all components required by the prototype

View File

@@ -8,6 +8,7 @@ using Content.Server.Xenoarchaeology.XenoArtifacts;
using Content.Shared.Body.Components; using Content.Shared.Body.Components;
using Content.Shared.Damage; using Content.Shared.Damage;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Content.Shared.Whitelist;
using Content.Shared.Xenoarchaeology.Equipment; using Content.Shared.Xenoarchaeology.Equipment;
using Robust.Shared.Collections; using Robust.Shared.Collections;
using Robust.Shared.Random; using Robust.Shared.Random;
@@ -25,6 +26,7 @@ public sealed class ArtifactCrusherSystem : SharedArtifactCrusherSystem
[Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly StackSystem _stack = default!; [Dependency] private readonly StackSystem _stack = default!;
[Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
/// <inheritdoc/> /// <inheritdoc/>
public override void Initialize() public override void Initialize()
@@ -92,7 +94,7 @@ public sealed class ArtifactCrusherSystem : SharedArtifactCrusherSystem
var coords = Transform(ent).Coordinates; var coords = Transform(ent).Coordinates;
foreach (var contained in contents) 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 amount = _random.Next(crusher.MinFragments, crusher.MaxFragments);
var stacks = _stack.SpawnMultiple(crusher.FragmentStackProtoId, amount, coords); var stacks = _stack.SpawnMultiple(crusher.FragmentStackProtoId, amount, coords);

View 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.Server.Xenoarchaeology.XenoArtifacts.Events;
using Content.Shared.Damage; using Content.Shared.Damage;
using Content.Shared.Whitelist;
using Robust.Shared.Random; using Robust.Shared.Random;
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; 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 IRobustRandom _random = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
/// <inheritdoc/> /// <inheritdoc/>
public override void Initialize() public override void Initialize()
@@ -24,7 +26,7 @@ public sealed class BreakWindowArtifactSystem : EntitySystem
ents.Add(args.Activator.Value); ents.Add(args.Activator.Value);
foreach (var ent in ents) foreach (var ent in ents)
{ {
if (component.Whitelist != null && !component.Whitelist.IsValid(ent)) if (_whitelistSystem.IsWhitelistFail(component.Whitelist, ent))
continue; continue;
if (!_random.Prob(component.DamageChance)) if (!_random.Prob(component.DamageChance))

View File

@@ -9,6 +9,7 @@ using Content.Shared.Interaction;
using Content.Shared.Inventory.Events; using Content.Shared.Inventory.Events;
using Content.Shared.Mind; using Content.Shared.Mind;
using Content.Shared.Rejuvenate; using Content.Shared.Rejuvenate;
using Content.Shared.Whitelist;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
@@ -29,6 +30,7 @@ public abstract class SharedActionsSystem : EntitySystem
[Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedTransformSystem _transformSystem = default!; [Dependency] private readonly SharedTransformSystem _transformSystem = default!;
[Dependency] private readonly ActionContainerSystem _actionContainer = default!; [Dependency] private readonly ActionContainerSystem _actionContainer = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -477,7 +479,7 @@ public abstract class SharedActionsSystem : EntitySystem
if (!target.IsValid() || Deleted(target)) if (!target.IsValid() || Deleted(target))
return false; return false;
if (action.Whitelist != null && !action.Whitelist.IsValid(target, EntityManager)) if (_whitelistSystem.IsWhitelistFail(action.Whitelist, target))
return false; return false;
if (action.CheckCanInteract && !_actionBlockerSystem.CanInteract(user, target)) if (action.CheckCanInteract && !_actionBlockerSystem.CanInteract(user, target))

View File

@@ -15,6 +15,7 @@ using Content.Shared.Storage.Components;
using Content.Shared.Stunnable; using Content.Shared.Stunnable;
using Content.Shared.Throwing; using Content.Shared.Throwing;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Content.Shared.Whitelist;
using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events; using Robust.Shared.Physics.Events;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -24,6 +25,8 @@ namespace Content.Shared.Buckle;
public abstract partial class SharedBuckleSystem public abstract partial class SharedBuckleSystem
{ {
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
private void InitializeBuckle() private void InitializeBuckle()
{ {
SubscribeLocalEvent<BuckleComponent, ComponentStartup>(OnBuckleComponentStartup); SubscribeLocalEvent<BuckleComponent, ComponentStartup>(OnBuckleComponentStartup);
@@ -224,8 +227,8 @@ public abstract partial class SharedBuckleSystem
} }
// Does it pass the Whitelist // Does it pass the Whitelist
if (strapComp.Whitelist != null && if (_whitelistSystem.IsWhitelistFail(strapComp.Whitelist, buckleUid) ||
!strapComp.Whitelist.IsValid(buckleUid, EntityManager) || strapComp.Blacklist?.IsValid(buckleUid, EntityManager) == true) _whitelistSystem.IsBlacklistPass(strapComp.Blacklist, buckleUid))
{ {
if (_netManager.IsServer) if (_netManager.IsServer)
_popup.PopupEntity(Loc.GetString("buckle-component-cannot-fit-message"), userUid, buckleUid, PopupType.Medium); _popup.PopupEntity(Loc.GetString("buckle-component-cannot-fit-message"), userUid, buckleUid, PopupType.Medium);

View File

@@ -31,7 +31,8 @@ public sealed partial class EntityWhitelistCondition : IConstructionCondition
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction) 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() public ConstructionGuideEntry GenerateGuideEntry()

View File

@@ -11,6 +11,7 @@ using Content.Shared.Item;
using Content.Shared.Movement.Systems; using Content.Shared.Movement.Systems;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Strip.Components; using Content.Shared.Strip.Components;
using Content.Shared.Whitelist;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Timing; using Robust.Shared.Timing;
@@ -30,6 +31,7 @@ public abstract partial class InventorySystem
[Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
[ValidatePrototypeId<ItemSizePrototype>] [ValidatePrototypeId<ItemSizePrototype>]
private const string PocketableItemSize = "Small"; private const string PocketableItemSize = "Small";
@@ -267,13 +269,8 @@ public abstract partial class InventorySystem
return false; return false;
} }
if (slotDefinition.Whitelist != null && !slotDefinition.Whitelist.IsValid(itemUid)) if (_whitelistSystem.IsWhitelistFail(slotDefinition.Whitelist, itemUid) ||
{ _whitelistSystem.IsBlacklistPass(slotDefinition.Blacklist, itemUid))
reason = "inventory-component-can-equip-does-not-fit";
return false;
}
if (slotDefinition.Blacklist != null && slotDefinition.Blacklist.IsValid(itemUid))
{ {
reason = "inventory-component-can-equip-does-not-fit"; reason = "inventory-component-can-equip-does-not-fit";
return false; return false;

View File

@@ -4,6 +4,7 @@ using Content.Shared.Interaction;
using Content.Shared.Labels.Components; using Content.Shared.Labels.Components;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Content.Shared.Whitelist;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
using Robust.Shared.Network; using Robust.Shared.Network;
@@ -16,6 +17,7 @@ public abstract class SharedHandLabelerSystem : EntitySystem
[Dependency] private readonly SharedLabelSystem _labelSystem = default!; [Dependency] private readonly SharedLabelSystem _labelSystem = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly INetManager _netManager = default!; [Dependency] private readonly INetManager _netManager = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -77,7 +79,7 @@ public abstract class SharedHandLabelerSystem : EntitySystem
private void OnUtilityVerb(EntityUid uid, HandLabelerComponent handLabeler, GetVerbsEvent<UtilityVerb> args) 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; return;
var labelerText = handLabeler.AssignedLabel == string.Empty ? Loc.GetString("hand-labeler-remove-label-text") : Loc.GetString("hand-labeler-add-label-text"); 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) 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; return;
Labeling(uid, target, args.User, handLabeler); Labeling(uid, target, args.User, handLabeler);

View File

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

View File

@@ -15,6 +15,7 @@ using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems; using Content.Shared.Movement.Systems;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Weapons.Melee; using Content.Shared.Weapons.Melee;
using Content.Shared.Whitelist;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Network; using Robust.Shared.Network;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
@@ -37,6 +38,7 @@ public abstract class SharedMechSystem : EntitySystem
[Dependency] private readonly SharedMoverController _mover = default!; [Dependency] private readonly SharedMoverController _mover = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!; [Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
/// <inheritdoc/> /// <inheritdoc/>
public override void Initialize() public override void Initialize()
@@ -216,7 +218,7 @@ public abstract class SharedMechSystem : EntitySystem
if (component.EquipmentContainer.ContainedEntities.Count >= component.MaxEquipmentAmount) if (component.EquipmentContainer.ContainedEntities.Count >= component.MaxEquipmentAmount)
return; return;
if (component.EquipmentWhitelist != null && !component.EquipmentWhitelist.IsValid(toInsert)) if (_whitelistSystem.IsWhitelistFail(component.EquipmentWhitelist, toInsert))
return; return;
equipmentComponent.EquipmentOwner = uid; equipmentComponent.EquipmentOwner = uid;

View File

@@ -1,4 +1,5 @@
using Content.Shared.Movement.Components; using Content.Shared.Movement.Components;
using Content.Shared.Whitelist;
using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events; using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems; using Robust.Shared.Physics.Systems;
@@ -9,6 +10,7 @@ public sealed class SpeedModifierContactsSystem : EntitySystem
{ {
[Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly MovementSpeedModifierSystem _speedModifierSystem = default!; [Dependency] private readonly MovementSpeedModifierSystem _speedModifierSystem = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
// TODO full-game-save // TODO full-game-save
// Either these need to be processed before a map is saved, or slowed/slowing entities need to update on init. // 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)) if (!TryComp<SpeedModifierContactsComponent>(ent, out var slowContactsComponent))
continue; continue;
if (slowContactsComponent.IgnoreWhitelist != null && slowContactsComponent.IgnoreWhitelist.IsValid(uid)) if (_whitelistSystem.IsWhitelistPass(slowContactsComponent.IgnoreWhitelist, uid))
continue; continue;
walkSpeed += slowContactsComponent.WalkSpeedModifier; walkSpeed += slowContactsComponent.WalkSpeedModifier;

View File

@@ -17,6 +17,7 @@ public sealed class EmagProviderSystem : EntitySystem
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedNinjaGlovesSystem _gloves = default!; [Dependency] private readonly SharedNinjaGlovesSystem _gloves = default!;
[Dependency] private readonly TagSystem _tags = default!; [Dependency] private readonly TagSystem _tags = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -35,7 +36,7 @@ public sealed class EmagProviderSystem : EntitySystem
return; return;
// only allowed to emag entities on the whitelist // only allowed to emag entities on the whitelist
if (comp.Whitelist != null && !comp.Whitelist.IsValid(target, EntityManager)) if (_whitelistSystem.IsWhitelistFail(comp.Whitelist, target))
return; return;
// only allowed to emag non-immune entities // only allowed to emag non-immune entities

View File

@@ -1,4 +1,5 @@
using Robust.Shared.Physics.Events; using Content.Shared.Whitelist;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems; using Robust.Shared.Physics.Systems;
namespace Content.Shared.Placeable; namespace Content.Shared.Placeable;
@@ -11,6 +12,7 @@ public sealed class ItemPlacerSystem : EntitySystem
{ {
[Dependency] private readonly CollisionWakeSystem _wake = default!; [Dependency] private readonly CollisionWakeSystem _wake = default!;
[Dependency] private readonly PlaceableSurfaceSystem _placeableSurface = default!; [Dependency] private readonly PlaceableSurfaceSystem _placeableSurface = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -22,7 +24,7 @@ public sealed class ItemPlacerSystem : EntitySystem
private void OnStartCollide(EntityUid uid, ItemPlacerComponent comp, ref StartCollideEvent args) 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; return;
if (TryComp<CollisionWakeComponent>(args.OtherEntity, out var wakeComp)) if (TryComp<CollisionWakeComponent>(args.OtherEntity, out var wakeComp))

View File

@@ -1,6 +1,7 @@
using System.Numerics; using System.Numerics;
using Content.Shared.Access.Components; using Content.Shared.Access.Components;
using Content.Shared.Access.Systems; using Content.Shared.Access.Systems;
using Content.Shared.Whitelist;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Map.Components; using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Components;
@@ -14,7 +15,7 @@ public sealed class RulesSystem : EntitySystem
[Dependency] private readonly AccessReaderSystem _reader = default!; [Dependency] private readonly AccessReaderSystem _reader = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public bool IsTrue(EntityUid uid, RulesPrototype rules) public bool IsTrue(EntityUid uid, RulesPrototype rules)
{ {
var inRange = new HashSet<Entity<IComponent>>(); 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)) foreach (var ent in _lookup.GetEntitiesInRange(xform.MapID, worldPos, entity.Range))
{ {
if (!entity.Whitelist.IsValid(ent, EntityManager)) if (_whitelistSystem.IsWhitelistFail(entity.Whitelist, ent))
continue; continue;
count++; count++;

View File

@@ -8,6 +8,7 @@ using Content.Shared.Mobs;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Sound.Components; using Content.Shared.Sound.Components;
using Content.Shared.Throwing; using Content.Shared.Throwing;
using Content.Shared.Whitelist;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
@@ -34,6 +35,7 @@ public abstract class SharedEmitSoundSystem : EntitySystem
[Dependency] private readonly SharedAmbientSoundSystem _ambient = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambient = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!; [Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] protected readonly SharedPopupSystem Popup = default!; [Dependency] protected readonly SharedPopupSystem Popup = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -123,7 +125,7 @@ public abstract class SharedEmitSoundSystem : EntitySystem
private void OnEmitSoundOnInteractUsing(Entity<EmitSoundOnInteractUsingComponent> ent, ref InteractUsingEvent args) 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); TryEmitSound(ent, ent.Comp, args.User);
} }

View File

@@ -1,5 +1,6 @@
using Content.Shared.Gravity; using Content.Shared.Gravity;
using Content.Shared.StepTrigger.Components; using Content.Shared.StepTrigger.Components;
using Content.Shared.Whitelist;
using Robust.Shared.Map.Components; using Robust.Shared.Map.Components;
using Robust.Shared.Physics; using Robust.Shared.Physics;
using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Components;
@@ -12,6 +13,7 @@ public sealed class StepTriggerSystem : EntitySystem
[Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly SharedGravitySystem _gravity = default!; [Dependency] private readonly SharedGravitySystem _gravity = default!;
[Dependency] private readonly SharedMapSystem _map = default!; [Dependency] private readonly SharedMapSystem _map = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -67,7 +69,7 @@ public sealed class StepTriggerSystem : EntitySystem
if (ent == uid) if (ent == uid)
continue; continue;
if (component.Blacklist.IsValid(ent.Value, EntityManager) == true) if (_whitelistSystem.IsBlacklistPass(component.Blacklist, ent.Value))
{ {
return false; return false;
} }

View File

@@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using Content.Shared.Administration.Logs; using Content.Shared.Administration.Logs;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.Examine; using Content.Shared.Examine;
@@ -7,6 +7,7 @@ using Content.Shared.Interaction;
using Content.Shared.Item; using Content.Shared.Item;
using Content.Shared.Storage.Components; using Content.Shared.Storage.Components;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Content.Shared.Whitelist;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Network; using Robust.Shared.Network;
@@ -21,6 +22,7 @@ public sealed class BinSystem : EntitySystem
[Dependency] private readonly ISharedAdminLogManager _admin = default!; [Dependency] private readonly ISharedAdminLogManager _admin = default!;
[Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!; [Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public const string BinContainerId = "bin-container"; public const string BinContainerId = "bin-container";
@@ -130,7 +132,7 @@ public sealed class BinSystem : EntitySystem
if (component.Items.Count >= component.MaxItems) if (component.Items.Count >= component.MaxItems)
return false; return false;
if (component.Whitelist != null && !component.Whitelist.IsValid(toInsert)) if (_whitelistSystem.IsWhitelistFail(component.Whitelist, toInsert))
return false; return false;
_container.Insert(toInsert, component.ItemContainer); _container.Insert(toInsert, component.ItemContainer);

View File

@@ -1,5 +1,6 @@
using System.Linq; using System.Linq;
using Content.Shared.Storage.Components; using Content.Shared.Storage.Components;
using Content.Shared.Whitelist;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Shared.Containers; using Robust.Shared.Containers;
@@ -15,6 +16,7 @@ namespace Content.Shared.Storage.EntitySystems
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
/// <inheritdoc /> /// <inheritdoc />
public override void Initialize() public override void Initialize()
@@ -93,7 +95,7 @@ namespace Content.Shared.Storage.EntitySystems
var list = new List<string>(); var list = new List<string>();
foreach (var mapLayerData in itemMapper.MapLayers.Values) 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) if (count >= mapLayerData.MinCount && count <= mapLayerData.MaxCount)
{ {
list.Add(mapLayerData.Layer); list.Add(mapLayerData.Layer);

View File

@@ -4,6 +4,7 @@ using Content.Shared.Interaction;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Teleportation.Components; using Content.Shared.Teleportation.Components;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Content.Shared.Whitelist;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Map.Components; using Robust.Shared.Map.Components;
@@ -24,6 +25,7 @@ public sealed class SwapTeleporterSystem : EntitySystem
[Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
private EntityQuery<TransformComponent> _xformQuery; private EntityQuery<TransformComponent> _xformQuery;
@@ -51,8 +53,8 @@ public sealed class SwapTeleporterSystem : EntitySystem
if (!TryComp<SwapTeleporterComponent>(target, out var targetComp)) if (!TryComp<SwapTeleporterComponent>(target, out var targetComp))
return; return;
if (!comp.TeleporterWhitelist.IsValid(target, EntityManager) || if (_whitelistSystem.IsWhitelistFail(comp.TeleporterWhitelist, target) ||
!targetComp.TeleporterWhitelist.IsValid(uid, EntityManager)) _whitelistSystem.IsWhitelistFail(targetComp.TeleporterWhitelist, uid))
{ {
return; return;
} }

View File

@@ -8,6 +8,7 @@ using Content.Shared.Interaction;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Content.Shared.Whitelist;
using Robust.Shared.Utility; using Robust.Shared.Utility;
namespace Content.Shared.UserInterface; namespace Content.Shared.UserInterface;
@@ -19,6 +20,7 @@ public sealed partial class ActivatableUISystem : EntitySystem
[Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!; [Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!; [Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -96,7 +98,7 @@ public sealed partial class ActivatableUISystem : EntitySystem
if (!args.CanAccess) if (!args.CanAccess)
return false; return false;
if (!component.RequiredItems?.IsValid(args.Using ?? default, EntityManager) ?? false) if (_whitelistSystem.IsWhitelistFail(component.RequiredItems, args.Using ?? default))
return false; return false;
if (component.RequireHands) if (component.RequireHands)
@@ -156,7 +158,7 @@ public sealed partial class ActivatableUISystem : EntitySystem
if (component.RequiredItems == null) if (component.RequiredItems == null)
return; return;
if (!component.RequiredItems.IsValid(args.Used, EntityManager)) if (_whitelistSystem.IsWhitelistFail(component.RequiredItems, args.Used))
return; return;
args.Handled = InteractUI(args.User, uid, component); args.Handled = InteractUI(args.User, uid, component);

View File

@@ -15,6 +15,7 @@ public abstract partial class SharedGunSystem
{ {
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!; [Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
protected virtual void InitializeBallistic() protected virtual void InitializeBallistic()
{ {
SubscribeLocalEvent<BallisticAmmoProviderComponent, ComponentInit>(OnBallisticInit); SubscribeLocalEvent<BallisticAmmoProviderComponent, ComponentInit>(OnBallisticInit);
@@ -125,7 +126,7 @@ public abstract partial class SharedGunSystem
if (ent == null) if (ent == null)
continue; continue;
if (!target.Whitelist.IsValid(ent.Value)) if (_whitelistSystem.IsWhitelistFail(target.Whitelist, ent.Value))
{ {
Popup( Popup(
Loc.GetString("gun-ballistic-transfer-invalid", Loc.GetString("gun-ballistic-transfer-invalid",

View File

@@ -42,7 +42,7 @@ public partial class SharedGunSystem
while (enumerator.NextItem(out var item)) while (enumerator.NextItem(out var item))
{ {
if (component.ProviderWhitelist == null || !component.ProviderWhitelist.IsValid(item, EntityManager)) if (_whitelistSystem.IsWhitelistFailOrNull(component.ProviderWhitelist, item))
continue; continue;
slotEntity = item; slotEntity = item;