using Content.Server.Objectives.Components;
using Content.Shared.Objectives.Components;
namespace Content.Server.Objectives.Systems;
///
/// Handles applying the objective component blacklist to the objective entity.
///
public sealed class ObjectiveBlacklistRequirementSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent(OnCheck);
}
private void OnCheck(EntityUid uid, ObjectiveBlacklistRequirementComponent comp, ref RequirementCheckEvent args)
{
if (args.Cancelled)
return;
foreach (var objective in args.Mind.AllObjectives)
{
if (comp.Blacklist.IsValid(objective, EntityManager))
{
args.Cancelled = true;
return;
}
}
}
}