]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix warden being and qm being not considered head for tot kill head objective (#32721)
authorTheodore Lukin <66275205+pheenty@users.noreply.github.com>
Fri, 18 Oct 2024 09:43:05 +0000 (16:43 +0700)
committerGitHub <noreply@github.com>
Fri, 18 Oct 2024 09:43:05 +0000 (11:43 +0200)
* 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

Content.Server/Objectives/Systems/KillPersonConditionSystem.cs
Content.Server/Objectives/Systems/NotCommandRequirementSystem.cs
Content.Server/Revolutionary/Components/CommandStaffComponent.cs
Resources/Prototypes/Roles/Jobs/Cargo/quartermaster.yml

index b4de15f2b9a6cc34fda736ef231a936ad6de5dae..8dcbf191b36632a91cdacef0b1a7683c0915a366 100644 (file)
@@ -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<EntityUid>();
-        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<MindComponent>(person, out var mind) && mind.OwnedEntity is { } ent && HasComp<CommandStaffComponent>(ent))
+                allHeads.Add(person);
         }
 
         if (allHeads.Count == 0)
index 50d747c1a2a022a62585b813e35f85a868fd32d4..0808dc5bcfdcf4e48a973a8319095151dad1c178 100644 (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;
     }
 }
index dc16b87300e5f19772a226f4d5aae6d1580ec370..79349b25da7bd3fccbbb0c710e78c7bf9ea5d77a 100644 (file)
@@ -1,11 +1,9 @@
-using Content.Server.GameTicking.Rules;
-
 namespace Content.Server.Revolutionary.Components;
 
 /// <summary>
-/// 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.
 /// </summary>
-[RegisterComponent, Access(typeof(RevolutionaryRuleSystem))]
+[RegisterComponent]
 public sealed partial class CommandStaffComponent : Component
 {
 
index 740afded646b7106849dba5bc262d91c98e2587c..ee1c2c59498485d850613d83b34cd67d1abc6cfc 100644 (file)
@@ -18,6 +18,7 @@
   weight: 10
   startingGear: QuartermasterGear
   icon: "JobIconQuarterMaster"
+  requireAdminNotify: true
   supervisors: job-supervisors-captain
   canBeAntag: false
   access: