From c78b5ae83d054e3111cce11c8ccf2febc22a4071 Mon Sep 17 00:00:00 2001 From: Theodore Lukin <66275205+pheenty@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:43:05 +0700 Subject: [PATCH] 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 --- .../Objectives/Systems/KillPersonConditionSystem.cs | 10 ++++------ .../Objectives/Systems/NotCommandRequirementSystem.cs | 7 ++----- .../Revolutionary/Components/CommandStaffComponent.cs | 6 ++---- .../Prototypes/Roles/Jobs/Cargo/quartermaster.yml | 1 + 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs index b4de15f2b9..8dcbf191b3 100644 --- a/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs +++ b/Content.Server/Objectives/Systems/KillPersonConditionSystem.cs @@ -1,9 +1,9 @@ using Content.Server.Objectives.Components; +using Content.Server.Revolutionary.Components; using Content.Server.Shuttles.Systems; using Content.Shared.CCVar; using Content.Shared.Mind; using Content.Shared.Objectives.Components; -using Content.Shared.Roles.Jobs; using Robust.Shared.Configuration; using Robust.Shared.Random; @@ -17,7 +17,6 @@ public sealed class KillPersonConditionSystem : EntitySystem [Dependency] private readonly EmergencyShuttleSystem _emergencyShuttle = default!; [Dependency] private readonly IConfigurationManager _config = default!; [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly SharedJobSystem _job = default!; [Dependency] private readonly SharedMindSystem _mind = default!; [Dependency] private readonly TargetObjectiveSystem _target = default!; @@ -86,11 +85,10 @@ public sealed class KillPersonConditionSystem : EntitySystem } var allHeads = new List(); - foreach (var mind in allHumans) + foreach (var person in allHumans) { - // RequireAdminNotify used as a cheap way to check for command department - if (_job.MindTryGetJob(mind, out var prototype) && prototype.RequireAdminNotify) - allHeads.Add(mind); + if (TryComp(person, out var mind) && mind.OwnedEntity is { } ent && HasComp(ent)) + allHeads.Add(person); } if (allHeads.Count == 0) diff --git a/Content.Server/Objectives/Systems/NotCommandRequirementSystem.cs b/Content.Server/Objectives/Systems/NotCommandRequirementSystem.cs index 50d747c1a2..0808dc5bcf 100644 --- a/Content.Server/Objectives/Systems/NotCommandRequirementSystem.cs +++ b/Content.Server/Objectives/Systems/NotCommandRequirementSystem.cs @@ -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(ent)) args.Cancelled = true; } } diff --git a/Content.Server/Revolutionary/Components/CommandStaffComponent.cs b/Content.Server/Revolutionary/Components/CommandStaffComponent.cs index dc16b87300..79349b25da 100644 --- a/Content.Server/Revolutionary/Components/CommandStaffComponent.cs +++ b/Content.Server/Revolutionary/Components/CommandStaffComponent.cs @@ -1,11 +1,9 @@ -using Content.Server.GameTicking.Rules; - namespace Content.Server.Revolutionary.Components; /// -/// Given to heads at round start for Revs. Used for tracking if heads died or not. +/// Given to heads at round start. Used for assigning traitors to kill heads and for revs to check if the heads died or not. /// -[RegisterComponent, Access(typeof(RevolutionaryRuleSystem))] +[RegisterComponent] public sealed partial class CommandStaffComponent : Component { diff --git a/Resources/Prototypes/Roles/Jobs/Cargo/quartermaster.yml b/Resources/Prototypes/Roles/Jobs/Cargo/quartermaster.yml index 740afded64..ee1c2c5949 100644 --- a/Resources/Prototypes/Roles/Jobs/Cargo/quartermaster.yml +++ b/Resources/Prototypes/Roles/Jobs/Cargo/quartermaster.yml @@ -18,6 +18,7 @@ weight: 10 startingGear: QuartermasterGear icon: "JobIconQuarterMaster" + requireAdminNotify: true supervisors: job-supervisors-captain canBeAntag: false access: