From ebed6803a17e36ac11cb140c60e0af587a8ef6c0 Mon Sep 17 00:00:00 2001 From: Beck Date: Fri, 20 Dec 2024 13:23:00 -0800 Subject: [PATCH] fixes --- .../Components/PickRandomTraitorComponent.cs | 6 ++---- .../Systems/KillFellowTraitorObjectiveSystem.cs | 13 ++++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Content.Server/DeltaV/Objectives/Components/PickRandomTraitorComponent.cs b/Content.Server/DeltaV/Objectives/Components/PickRandomTraitorComponent.cs index d0cf14e51db..8f870ed7738 100644 --- a/Content.Server/DeltaV/Objectives/Components/PickRandomTraitorComponent.cs +++ b/Content.Server/DeltaV/Objectives/Components/PickRandomTraitorComponent.cs @@ -5,7 +5,5 @@ namespace Content.Server.DeltaV.Objectives.Components; /// /// Sets the target for to a random traitor. /// -[RegisterComponent, Access(typeof(KillPersonConditionSystem))] -public sealed partial class PickRandomTraitorComponent : Component -{ -} +[RegisterComponent] +public sealed partial class PickRandomTraitorComponent : Component; diff --git a/Content.Server/DeltaV/Objectives/Systems/KillFellowTraitorObjectiveSystem.cs b/Content.Server/DeltaV/Objectives/Systems/KillFellowTraitorObjectiveSystem.cs index 4eeba585ebe..781040ddc0a 100644 --- a/Content.Server/DeltaV/Objectives/Systems/KillFellowTraitorObjectiveSystem.cs +++ b/Content.Server/DeltaV/Objectives/Systems/KillFellowTraitorObjectiveSystem.cs @@ -46,16 +46,19 @@ private void OnTraitorKillAssigned(EntityUid uid, PickRandomTraitorComponent com // Going through each OTHER traitor foreach (var traitor in traitors) { - // Assume it will be a valid traitor. - validTraitorMinds.Add(traitor.Id); - + var valid = true; // Going through each of OUR objectives. foreach (var objective in args.Mind.Objectives) { - // If one of OUR objectives already targets a traitor, remove them from the vaild list. + // If one of OUR objectives already targets a traitor, don't add it to the list. if (TryComp(objective, out var targetComp) && targetComp.Target == traitor.Id) - validTraitorMinds.RemoveAt(validTraitorMinds.Count - 1); + { + valid = false; + break; + } } + if (valid) + validTraitorMinds.Add(traitor.Id); } // No other traitors