forked from space-syndicate/space-station-14
Remove blacklist methods in EntityWhitelistSystem (#40932)
* replace blacklist methods * VS is trolling me
This commit is contained in:
@@ -147,7 +147,7 @@ public sealed class EmotesUIController : UIController, IOnStateChanged<GameplayS
|
||||
if (emote.Category == EmoteCategory.Invalid
|
||||
|| emote.ChatTriggers.Count == 0
|
||||
|| !(player.HasValue && whitelistSystem.IsWhitelistPassOrNull(emote.Whitelist, player.Value))
|
||||
|| whitelistSystem.IsBlacklistPass(emote.Blacklist, player.Value))
|
||||
|| whitelistSystem.IsWhitelistPass(emote.Blacklist, player.Value))
|
||||
continue;
|
||||
|
||||
if (!emote.Available
|
||||
|
||||
@@ -25,7 +25,7 @@ public sealed class CutWireVariationPassSystem : VariationPassSystem<CutWireVari
|
||||
continue;
|
||||
|
||||
// Check against blacklist
|
||||
if (_whitelistSystem.IsBlacklistPass(ent.Comp.Blacklist, uid))
|
||||
if (_whitelistSystem.IsWhitelistPass(ent.Comp.Blacklist, uid))
|
||||
continue;
|
||||
|
||||
if (Random.Prob(ent.Comp.WireCutChance))
|
||||
|
||||
@@ -33,7 +33,7 @@ public sealed partial class TargetObjectiveMindFilter : MindFilter
|
||||
if (entMan.TryGetComponent<TargetObjectiveComponent>(objective, out var kill) && kill.Target == mind.Owner)
|
||||
{
|
||||
// remove the mind if this objective is blacklisted
|
||||
if (whitelistSys.IsBlacklistPassOrNull(Blacklist, objective))
|
||||
if (whitelistSys.IsWhitelistPassOrNull(Blacklist, objective))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public sealed class NinjaConditionsSystem : EntitySystem
|
||||
|
||||
while (allEnts.MoveNext(out var warpUid, out var warp))
|
||||
{
|
||||
if (_whitelist.IsBlacklistFail(bombingBlacklist, warpUid)
|
||||
if (_whitelist.IsWhitelistFail(bombingBlacklist, warpUid)
|
||||
&& !string.IsNullOrWhiteSpace(warp.Location))
|
||||
{
|
||||
warps.Add(warpUid);
|
||||
|
||||
@@ -25,7 +25,7 @@ public sealed class ObjectiveBlacklistRequirementSystem : EntitySystem
|
||||
|
||||
foreach (var objective in args.Mind.Objectives)
|
||||
{
|
||||
if (_whitelistSystem.IsBlacklistPass(comp.Blacklist, objective))
|
||||
if (_whitelistSystem.IsWhitelistPass(comp.Blacklist, objective))
|
||||
{
|
||||
args.Cancelled = true;
|
||||
return;
|
||||
|
||||
@@ -42,7 +42,7 @@ public sealed partial class CableSystem
|
||||
|
||||
foreach (var anchored in _map.GetAnchoredEntities((gridUid, grid), snapPos))
|
||||
{
|
||||
if (_whitelistSystem.IsBlacklistPass(component.Blacklist, anchored))
|
||||
if (_whitelistSystem.IsWhitelistPass(component.Blacklist, anchored))
|
||||
return;
|
||||
|
||||
if (TryComp<CableComponent>(anchored, out var wire) && wire.CableType == component.BlockingCableType)
|
||||
|
||||
@@ -344,7 +344,7 @@ public sealed partial class RevenantSystem
|
||||
foreach (var ent in _lookup.GetEntitiesInRange(uid, component.MalfunctionRadius))
|
||||
{
|
||||
if (_whitelistSystem.IsWhitelistFail(component.MalfunctionWhitelist, ent) ||
|
||||
_whitelistSystem.IsBlacklistPass(component.MalfunctionBlacklist, ent))
|
||||
_whitelistSystem.IsWhitelistPass(component.MalfunctionBlacklist, ent))
|
||||
continue;
|
||||
|
||||
_emagSystem.TryEmagEffect(uid, uid, ent);
|
||||
|
||||
@@ -26,7 +26,7 @@ public sealed partial class BuyerWhitelistCondition : ListingCondition
|
||||
var whitelistSystem = ent.System<EntityWhitelistSystem>();
|
||||
|
||||
if (whitelistSystem.IsWhitelistFail(Whitelist, args.Buyer) ||
|
||||
whitelistSystem.IsBlacklistPass(Blacklist, args.Buyer))
|
||||
whitelistSystem.IsWhitelistPass(Blacklist, args.Buyer))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -29,7 +29,7 @@ public sealed partial class StoreWhitelistCondition : ListingCondition
|
||||
var whitelistSystem = ent.System<EntityWhitelistSystem>();
|
||||
|
||||
if (whitelistSystem.IsWhitelistFail(Whitelist, args.StoreEntity.Value) ||
|
||||
whitelistSystem.IsBlacklistPass(Blacklist, args.StoreEntity.Value))
|
||||
whitelistSystem.IsWhitelistPass(Blacklist, args.StoreEntity.Value))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -62,7 +62,7 @@ public sealed class SurveillanceCameraMicrophoneSystem : EntitySystem
|
||||
public void CanListen(EntityUid uid, SurveillanceCameraMicrophoneComponent microphone, ListenAttemptEvent args)
|
||||
{
|
||||
// TODO maybe just make this a part of ActiveListenerComponent?
|
||||
if (_whitelistSystem.IsBlacklistPass(microphone.Blacklist, args.Source))
|
||||
if (_whitelistSystem.IsWhitelistPass(microphone.Blacklist, args.Source))
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public sealed partial class TeleportLocationsSystem : SharedTeleportLocationsSys
|
||||
|
||||
while (allEnts.MoveNext(out var warpEnt, out var warpPointComp))
|
||||
{
|
||||
if (_whitelist.IsBlacklistPass(warpPointComp.Blacklist, warpEnt) || string.IsNullOrWhiteSpace(warpPointComp.Location))
|
||||
if (_whitelist.IsWhitelistPass(warpPointComp.Blacklist, warpEnt) || string.IsNullOrWhiteSpace(warpPointComp.Location))
|
||||
continue;
|
||||
|
||||
ent.Comp.AvailableWarps.Add(new TeleportPoint(warpPointComp.Location, GetNetEntity(warpEnt)));
|
||||
|
||||
@@ -41,7 +41,7 @@ public sealed class TraitSystem : EntitySystem
|
||||
}
|
||||
|
||||
if (_whitelistSystem.IsWhitelistFail(traitPrototype.Whitelist, args.Mob) ||
|
||||
_whitelistSystem.IsBlacklistPass(traitPrototype.Blacklist, args.Mob))
|
||||
_whitelistSystem.IsWhitelistPass(traitPrototype.Blacklist, args.Mob))
|
||||
continue;
|
||||
|
||||
// Add all components required by the prototype
|
||||
|
||||
@@ -426,7 +426,7 @@ public abstract partial class SharedActionsSystem : EntitySystem
|
||||
if (_whitelist.IsWhitelistFail(comp.Whitelist, target))
|
||||
return false;
|
||||
|
||||
if (_whitelist.IsBlacklistPass(comp.Blacklist, target))
|
||||
if (_whitelist.IsWhitelistPass(comp.Blacklist, target))
|
||||
return false;
|
||||
|
||||
if (_actionQuery.Comp(uid).CheckCanInteract && !_actionBlocker.CanInteract(user, target))
|
||||
|
||||
@@ -235,7 +235,7 @@ public abstract partial class SharedBuckleSystem
|
||||
|
||||
// Does it pass the Whitelist
|
||||
if (_whitelistSystem.IsWhitelistFail(strapComp.Whitelist, buckleUid) ||
|
||||
_whitelistSystem.IsBlacklistPass(strapComp.Blacklist, buckleUid))
|
||||
_whitelistSystem.IsWhitelistPass(strapComp.Blacklist, buckleUid))
|
||||
{
|
||||
if (popup)
|
||||
_popup.PopupClient(Loc.GetString("buckle-component-cannot-fit-message"), user, PopupType.Medium);
|
||||
|
||||
@@ -193,7 +193,7 @@ public abstract partial class SharedChatSystem
|
||||
|
||||
// Check the whitelist and blacklist
|
||||
if (_whitelist.IsWhitelistFail(emote.Whitelist, source) ||
|
||||
_whitelist.IsBlacklistPass(emote.Blacklist, source))
|
||||
_whitelist.IsWhitelistPass(emote.Blacklist, source))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
private bool CanInsertWhitelist(EntityUid usedUid, ItemSlot slot)
|
||||
{
|
||||
if (_whitelistSystem.IsWhitelistFail(slot.Whitelist, usedUid)
|
||||
|| _whitelistSystem.IsBlacklistPass(slot.Blacklist, usedUid))
|
||||
|| _whitelistSystem.IsWhitelistPass(slot.Blacklist, usedUid))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ public abstract class SharedDisposalUnitSystem : EntitySystem
|
||||
if (!storable && !HasComp<MobStateComponent>(entity))
|
||||
return false;
|
||||
|
||||
if (_whitelistSystem.IsBlacklistPass(component.Blacklist, entity) ||
|
||||
if (_whitelistSystem.IsWhitelistPass(component.Blacklist, entity) ||
|
||||
_whitelistSystem.IsWhitelistFail(component.Whitelist, entity))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public abstract class SharedImplanterSystem : EntitySystem
|
||||
protected bool CheckTarget(EntityUid target, EntityWhitelist? whitelist, EntityWhitelist? blacklist)
|
||||
{
|
||||
return _whitelistSystem.IsWhitelistPassOrNull(whitelist, target) &&
|
||||
_whitelistSystem.IsBlacklistFailOrNull(blacklist, target);
|
||||
_whitelistSystem.IsWhitelistFailOrNull(blacklist, target);
|
||||
}
|
||||
|
||||
//Draw the implant out of the target
|
||||
|
||||
@@ -275,7 +275,7 @@ public abstract partial class InventorySystem
|
||||
}
|
||||
|
||||
if (_whitelistSystem.IsWhitelistFail(slotDefinition.Whitelist, itemUid) ||
|
||||
_whitelistSystem.IsBlacklistPass(slotDefinition.Blacklist, itemUid))
|
||||
_whitelistSystem.IsWhitelistPass(slotDefinition.Blacklist, itemUid))
|
||||
{
|
||||
reason = "inventory-component-can-equip-does-not-fit";
|
||||
return false;
|
||||
|
||||
@@ -99,7 +99,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
|
||||
return false;
|
||||
|
||||
if (_whitelistSystem.IsWhitelistFail(component.Whitelist, item) ||
|
||||
_whitelistSystem.IsBlacklistPass(component.Blacklist, item))
|
||||
_whitelistSystem.IsWhitelistPass(component.Blacklist, item))
|
||||
return false;
|
||||
|
||||
if (Container.TryGetContainingContainer((item, null, null), out _) && !Container.TryRemoveFromContainer(item))
|
||||
|
||||
@@ -16,7 +16,7 @@ public sealed partial class ObjectiveMindFilter : MindFilter
|
||||
foreach (var obj in mind.Comp.Objectives)
|
||||
{
|
||||
// mind has a blacklisted objective, remove it from the pool
|
||||
if (whitelistSys.IsBlacklistPass(Blacklist, obj))
|
||||
if (whitelistSys.IsWhitelistPass(Blacklist, obj))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem
|
||||
public bool IsInvalid(ChameleonProjectorComponent comp, EntityUid target)
|
||||
{
|
||||
return _whitelist.IsWhitelistFail(comp.Whitelist, target)
|
||||
|| _whitelist.IsBlacklistPass(comp.Blacklist, target);
|
||||
|| _whitelist.IsWhitelistPass(comp.Blacklist, target);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -59,7 +59,7 @@ public abstract class SharedEmitSoundSystem : EntitySystem
|
||||
|
||||
private void HandleEmitSoundOnUIOpen(EntityUid uid, EmitSoundOnUIOpenComponent component, AfterActivatableUIOpenEvent args)
|
||||
{
|
||||
if (_whitelistSystem.IsBlacklistFail(component.Blacklist, args.User))
|
||||
if (_whitelistSystem.IsWhitelistFail(component.Blacklist, args.User))
|
||||
{
|
||||
TryEmitSound(uid, component, args.User);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public sealed class StepTriggerSystem : EntitySystem
|
||||
if (ent == uid)
|
||||
continue;
|
||||
|
||||
if (_whitelistSystem.IsBlacklistPass(component.Blacklist, ent.Value))
|
||||
if (_whitelistSystem.IsWhitelistPass(component.Blacklist, ent.Value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public sealed class StickySystem : EntitySystem
|
||||
|
||||
// check whitelist and blacklist
|
||||
if (_whitelist.IsWhitelistFail(comp.Whitelist, target) ||
|
||||
_whitelist.IsBlacklistPass(comp.Blacklist, target))
|
||||
_whitelist.IsWhitelistPass(comp.Blacklist, target))
|
||||
return false;
|
||||
|
||||
var attemptEv = new AttemptEntityStickEvent(target, user);
|
||||
|
||||
@@ -107,7 +107,7 @@ public sealed class SecretStashSystem : EntitySystem
|
||||
|
||||
// check if item is too big to fit into secret stash or is in the blacklist
|
||||
if (_item.GetSizePrototype(itemComp.Size) > _item.GetSizePrototype(entity.Comp.MaxItemSize) ||
|
||||
_whitelistSystem.IsBlacklistPass(entity.Comp.Blacklist, itemToHideUid))
|
||||
_whitelistSystem.IsWhitelistPass(entity.Comp.Blacklist, itemToHideUid))
|
||||
{
|
||||
var msg = Loc.GetString("comp-secret-stash-action-hide-item-too-big",
|
||||
("item", itemToHideUid), ("stashname", GetStashName(entity)));
|
||||
|
||||
@@ -1058,7 +1058,7 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
}
|
||||
|
||||
if (_whitelistSystem.IsWhitelistFail(storageComp.Whitelist, insertEnt) ||
|
||||
_whitelistSystem.IsBlacklistPass(storageComp.Blacklist, insertEnt))
|
||||
_whitelistSystem.IsWhitelistPass(storageComp.Blacklist, insertEnt))
|
||||
{
|
||||
reason = "comp-storage-invalid-container";
|
||||
return false;
|
||||
|
||||
@@ -119,7 +119,7 @@ public abstract partial class SharedStunSystem : EntitySystem
|
||||
if (args.OurFixtureId != ent.Comp.FixtureId)
|
||||
return;
|
||||
|
||||
if (_entityWhitelist.IsBlacklistPass(ent.Comp.Blacklist, args.OtherEntity))
|
||||
if (_entityWhitelist.IsWhitelistPass(ent.Comp.Blacklist, args.OtherEntity))
|
||||
return;
|
||||
|
||||
TryUpdateStunDuration(args.OtherEntity, ent.Comp.Duration);
|
||||
|
||||
@@ -125,42 +125,6 @@ public sealed class EntityWhitelistSystem : EntitySystem
|
||||
return !IsValid(whitelist, uid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper function to determine if Blacklist is not null and entity is on list
|
||||
/// Duplicate of equivalent Whitelist function
|
||||
/// </summary>
|
||||
public bool IsBlacklistPass(EntityWhitelist? blacklist, EntityUid uid)
|
||||
{
|
||||
return IsWhitelistPass(blacklist, uid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper function to determine if Blacklist is not null and entity is not on the list
|
||||
/// Duplicate of equivalent Whitelist function
|
||||
/// </summary>
|
||||
public bool IsBlacklistFail(EntityWhitelist? blacklist, EntityUid uid)
|
||||
{
|
||||
return IsWhitelistFail(blacklist, uid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper function to determine if Blacklist is either null or the entity is on the list
|
||||
/// Duplicate of equivalent Whitelist function
|
||||
/// </summary>
|
||||
public bool IsBlacklistPassOrNull(EntityWhitelist? blacklist, EntityUid uid)
|
||||
{
|
||||
return IsWhitelistPassOrNull(blacklist, uid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper function to determine if Blacklist is either null or the entity is not on the list
|
||||
/// Duplicate of equivalent Whitelist function
|
||||
/// </summary>
|
||||
public bool IsBlacklistFailOrNull(EntityWhitelist? blacklist, EntityUid uid)
|
||||
{
|
||||
return IsWhitelistFailOrNull(blacklist, uid);
|
||||
}
|
||||
|
||||
private List<ComponentRegistration>? StringsToRegs(string[]? input)
|
||||
{
|
||||
if (input == null || input.Length == 0)
|
||||
|
||||
Reference in New Issue
Block a user