using Content.Server._DV.Objectives.Components;
using Content.Shared.Objectives.Components;
using Content.Shared.Roles.Jobs;
namespace Content.Server._DV.Objectives.Systems;
///
/// Handles checking the department blacklist for this objective.
///
public sealed class NotDepartmentRequirementSystem : EntitySystem
{
[Dependency] private readonly SharedJobSystem _job = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent(OnCheck);
}
private void OnCheck(Entity ent, ref RequirementCheckEvent args)
{
if (args.Cancelled ||
!_job.MindTryGetJob(args.MindId, out var job) ||
!_job.TryGetPrimaryDepartment(job.ID, out var primary))
{
return;
}
if (primary.ID == ent.Comp.Department)
args.Cancelled = true;
}
}