using Content.Shared.Store;
using Content.Shared.Whitelist;
namespace Content.Server.Store.Conditions;
///
/// Filters out an entry based on the components or tags on the store itself.
///
public sealed partial class StoreWhitelistCondition : ListingCondition
{
///
/// A whitelist of tags or components.
///
[DataField("whitelist")]
public EntityWhitelist? Whitelist;
///
/// A blacklist of tags or components.
///
[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();
if (whitelistSystem.IsWhitelistFail(Whitelist, args.StoreEntity.Value) ||
whitelistSystem.IsBlacklistPass(Blacklist, args.StoreEntity.Value))
return false;
return true;
}
}