using Content.Server.Objectives.Components; using Content.Shared.Objectives.Components; using Content.Shared.Whitelist; namespace Content.Server.Objectives.Systems; /// /// Handles role requirement for objectives that require a certain (probably antagonist) role(s). /// public sealed class RoleRequirementSystem : EntitySystem { [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnCheck); } private void OnCheck(EntityUid uid, RoleRequirementComponent comp, ref RequirementCheckEvent args) { if (args.Cancelled) return; if (_whitelistSystem.IsWhitelistFail(comp.Roles, args.MindId)) args.Cancelled = true; } }