Fix warden being and qm being not considered head for tot kill head objective (#32721)

* fixed warden being and qm being not considered head for traitor kill head objective

* fixed hypothetical warden traitor not getting disk objective

* change suggested by deltanedas

* cleanup

* cleanup

* fix

* changed as suggested

* removed a dot in the comment

* removed an empty line

* reformulation
This commit is contained in:
Theodore Lukin
2024-10-18 16:43:05 +07:00
committed by GitHub
parent adb7aee831
commit c78b5ae83d
4 changed files with 9 additions and 15 deletions

View File

@@ -1,13 +1,11 @@
using Content.Server.Objectives.Components;
using Content.Server.Revolutionary.Components;
using Content.Shared.Objectives.Components;
using Content.Shared.Roles.Jobs;
namespace Content.Server.Objectives.Systems;
public sealed class NotCommandRequirementSystem : EntitySystem
{
[Dependency] private readonly SharedJobSystem _job = default!;
public override void Initialize()
{
base.Initialize();
@@ -20,8 +18,7 @@ public sealed class NotCommandRequirementSystem : EntitySystem
if (args.Cancelled)
return;
// cheap equivalent to checking that job department is command, since all command members require admin notification when leaving
if (_job.MindTryGetJob(args.MindId, out var prototype) && prototype.RequireAdminNotify)
if (args.Mind.OwnedEntity is { } ent && HasComp<CommandStaffComponent>(ent))
args.Cancelled = true;
}
}