Files
wylab-station-14/Content.Server/Store/Conditions/StoreWhitelistCondition.cs
slarticodefast a428130d45 Remove blacklist methods in EntityWhitelistSystem (#40932)
* replace blacklist methods

* VS is trolling me
2025-11-24 00:38:08 +00:00

38 lines
1.0 KiB
C#

using Content.Shared.Store;
using Content.Shared.Whitelist;
namespace Content.Server.Store.Conditions;
/// <summary>
/// Filters out an entry based on the components or tags on the store itself.
/// </summary>
public sealed partial class StoreWhitelistCondition : ListingCondition
{
/// <summary>
/// A whitelist of tags or components.
/// </summary>
[DataField("whitelist")]
public EntityWhitelist? Whitelist;
/// <summary>
/// A blacklist of tags or components.
/// </summary>
[DataField("blacklist")]
public EntityWhitelist? Blacklist;
public override bool Condition(ListingConditionArgs args)
{
if (args.StoreEntity == null)
return false;
var ent = args.EntityManager;
var whitelistSystem = ent.System<EntityWhitelistSystem>();
if (whitelistSystem.IsWhitelistFail(Whitelist, args.StoreEntity.Value) ||
whitelistSystem.IsWhitelistPass(Blacklist, args.StoreEntity.Value))
return false;
return true;
}
}