[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;
// 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)
bool ignoreActionBlocker = false
)
{
+
if (_whitelistSystem.IsWhitelistFail(emote.Whitelist, source) || _whitelistSystem.IsBlacklistPass(emote.Blacklist, source))
return;
-using Content.Shared.Chemistry.Reaction;
+using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Content.Shared.Maps;
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)
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;
[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.
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;
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;
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;
[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()
{
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));
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;
/// </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;
continue;
// Check against blacklist
- if (ent.Comp.Blacklist.IsValid(uid))
+ if (_whitelistSystem.IsBlacklistPass(ent.Comp.Blacklist, uid))
continue;
if (Random.Prob(ent.Comp.WireCutChance))
-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;
[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();
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;
using Content.Shared.Interaction;
using Content.Shared.Mech.Components;
using Content.Shared.Mech.Equipment.Components;
+using Content.Shared.Whitelist;
namespace Content.Server.Mech.Systems;
[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()
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);
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.Player;
+using Content.Shared.Whitelist;
namespace Content.Server.Mech.Systems;
[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/>
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;
using Robust.Shared.Prototypes;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Timing;
+using Content.Shared.Whitelist;
namespace Content.Server.Ninja.Systems;
[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()
{
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)
-using Content.Server.Administration.Logs;
+using Content.Server.Administration.Logs;
using Content.Server.Popups;
using Content.Shared.Database;
using Content.Shared.IdentityManagement;
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;
[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();
if (!CanReproduce(partner))
return false;
- return component.PartnerWhitelist.IsValid(partner);
+ return _whitelistSystem.IsWhitelistPass(component.PartnerWhitelist, partner);
}
/// <summary>
using Robust.Shared.Utility;
using System.Linq;
using Robust.Server.GameObjects;
+using Content.Shared.Whitelist;
namespace Content.Server.Nutrition.EntitySystems;
[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;
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;
using Content.Server.Objectives.Components;
using Content.Shared.Objectives.Components;
+using Content.Shared.Whitelist;
namespace Content.Server.Objectives.Systems;
/// </summary>
public sealed class ObjectiveBlacklistRequirementSystem : EntitySystem
{
+ [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
+
public override void Initialize()
{
base.Initialize();
foreach (var objective in args.Mind.AllObjectives)
{
- if (comp.Blacklist.IsValid(objective, EntityManager))
+ if (_whitelistSystem.IsBlacklistPass(comp.Blacklist, objective))
{
args.Cancelled = true;
return;
using Content.Server.Objectives.Components;
using Content.Shared.Objectives.Components;
+using Content.Shared.Whitelist;
namespace Content.Server.Objectives.Systems;
/// </summary>
public sealed class RoleRequirementSystem : EntitySystem
{
+ [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize()
{
base.Initialize();
// 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;
}
}
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;
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
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));
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;
[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";
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);
-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;
[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))
var count = 0;
foreach (var entity in component.Container.ContainedEntities)
{
- if (itemCounter.Count.IsValid(entity))
+ if (_whitelistSystem.IsWhitelistPass(itemCounter.Count, entity))
count++;
}
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;
}
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;
}
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;
public sealed class SurveillanceCameraMicrophoneSystem : EntitySystem
{
[Dependency] private readonly SharedTransformSystem _xforms = default!;
-
+ [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize()
{
base.Initialize();
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();
}
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;
[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()
{
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
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;
[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()
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);
-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;
[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()
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))
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;
[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()
{
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))
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;
public abstract partial class SharedBuckleSystem
{
+ [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
+
private void InitializeBuckle()
{
SubscribeLocalEvent<BuckleComponent, ComponentStartup>(OnBuckleComponentStartup);
}
// 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);
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()
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;
[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";
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;
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;
[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()
{
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");
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);
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;
[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";
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))
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;
[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()
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;
using Content.Shared.Movement.Components;
+using Content.Shared.Whitelist;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
{
[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.
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;
[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()
{
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
-using Robust.Shared.Physics.Events;
+using Content.Shared.Whitelist;
+using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
namespace Content.Shared.Placeable;
{
[Dependency] private readonly CollisionWakeSystem _wake = default!;
[Dependency] private readonly PlaceableSurfaceSystem _placeableSurface = default!;
+ [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize()
{
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))
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;
[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>>();
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++;
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;
[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()
{
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);
}
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;
[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()
{
if (ent == uid)
continue;
- if (component.Blacklist.IsValid(ent.Value, EntityManager) == true)
+ if (_whitelistSystem.IsBlacklistPass(component.Blacklist, ent.Value))
{
return false;
}
-using System.Linq;
+using System.Linq;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Content.Shared.Examine;
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;
[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";
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);
-using System.Linq;
+using System.Linq;
using Content.Shared.Storage.Components;
+using Content.Shared.Whitelist;
using JetBrains.Annotations;
using Robust.Shared.Containers;
{
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
+ [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
/// <inheritdoc />
public override void Initialize()
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);
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;
[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;
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;
}
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;
[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()
{
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)
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);
{
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
+
protected virtual void InitializeBallistic()
{
SubscribeLocalEvent<BallisticAmmoProviderComponent, ComponentInit>(OnBallisticInit);
if (ent == null)
continue;
- if (!target.Whitelist.IsValid(ent.Value))
+ if (_whitelistSystem.IsWhitelistFail(target.Whitelist, ent.Value))
{
Popup(
Loc.GetString("gun-ballistic-transfer-invalid",
while (enumerator.NextItem(out var item))
{
- if (component.ProviderWhitelist == null || !component.ProviderWhitelist.IsValid(item, EntityManager))
+ if (_whitelistSystem.IsWhitelistFailOrNull(component.ProviderWhitelist, item))
continue;
slotEntity = item;