mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
31 lines
881 B
C#
31 lines
881 B
C#
using Content.Shared.Objectives.Components;
|
|
using Content.Shared.Roles.Jobs;
|
|
|
|
namespace Content.Server.Objectives.Systems;
|
|
|
|
/// <summary>
|
|
/// Handles checking the job blacklist for this objective.
|
|
/// </summary>
|
|
public sealed partial class NotJobRequirementSystem : EntitySystem
|
|
{
|
|
[Dependency] private SharedJobSystem _jobs = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<NotJobRequirementComponent, RequirementCheckEvent>(OnCheck);
|
|
}
|
|
|
|
private void OnCheck(EntityUid uid, NotJobRequirementComponent comp, ref RequirementCheckEvent args)
|
|
{
|
|
if (args.Cancelled)
|
|
return;
|
|
|
|
_jobs.MindTryGetJob(args.MindId, out var proto);
|
|
|
|
// if player has no job then don't care
|
|
if (proto is not null && comp.Jobs.Contains(proto.ID))
|
|
args.Cancelled = true;
|
|
}
|
|
}
|