mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 00:27:59 +00:00
* Cleanup datafields with matching autogenerated tag [RA0027] * Remove unused dependencies [CS0414] * Swap to AddMarkupOrThrow over PushMarkup [CS0618] * Fix namespacing [CA1050] * Prefer the generic overload [CA2263] * Fix exception throwing [CA2208] * Mark RoundStartCaptain as static [CA1822] * Don't use string literal [RA0033] * Remove un-needed null check [CS8073] * Explicitly set webhookData to null [CS0649] * Use protoId over bare string * Prefer HasComp over TryComp with no usage of the actual comp
38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using Content.Server._DV.Objectives.Components;
|
|
using Content.Shared.Objectives.Components;
|
|
using Content.Shared.Roles.Components;
|
|
|
|
namespace Content.Server._DV.Objectives.Systems;
|
|
|
|
/// <summary>
|
|
/// Handles checking the job blacklist for this objective.
|
|
/// </summary>
|
|
public sealed class NotJobsRequirementSystem : EntitySystem
|
|
{
|
|
private EntityQuery<MindRoleComponent> _query;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
_query = GetEntityQuery<MindRoleComponent>();
|
|
|
|
SubscribeLocalEvent<NotJobsRequirementComponent, RequirementCheckEvent>(OnCheck);
|
|
}
|
|
|
|
private void OnCheck(Entity<NotJobsRequirementComponent> ent, ref RequirementCheckEvent args)
|
|
{
|
|
if (args.Cancelled)
|
|
return;
|
|
|
|
foreach (var forbidJob in ent.Comp.Jobs)
|
|
{
|
|
foreach (var roleId in args.Mind.MindRoleContainer.ContainedEntities)
|
|
{
|
|
if (_query.CompOrNull(roleId)?.JobPrototype == forbidJob)
|
|
args.Cancelled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|