From 492a361dd9e4c26b59e93f749127cbe4dbf3791b Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 27 Mar 2023 00:17:38 +1100 Subject: [PATCH] Prevent really latejoins from being T (#14866) AKA if they're still on arrivals and either padded time or got lucky with timing. --- .../GameTicking/Rules/TraitorRuleSystem.cs | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs b/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs index 735bf3cb76..e005357f1f 100644 --- a/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs @@ -6,6 +6,7 @@ using Content.Server.Roles; using Content.Server.Traitor; using Content.Server.Traitor.Uplink; using Content.Server.NPC.Systems; +using Content.Server.Shuttles.Components; using Content.Shared.CCVar; using Content.Shared.Dataset; using Content.Shared.Preferences; @@ -171,9 +172,23 @@ public sealed class TraitorRuleSystem : GameRuleSystem public List FindPotentialTraitors(in Dictionary candidates) { - var list = new List(candidates.Keys).Where(x => - x.Data.ContentData()?.Mind?.AllRoles.All(role => role is not Job { CanBeAntag: false }) ?? false - ).ToList(); + var list = new List(); + var pendingQuery = GetEntityQuery(); + + foreach (var player in candidates.Keys) + { + // Role prevents antag. + if (!(player.Data.ContentData()?.Mind?.AllRoles.All(role => role is not Job { CanBeAntag: false }) ?? false)) + { + continue; + } + + // Latejoin + if (player.AttachedEntity != null && pendingQuery.HasComponent(player.AttachedEntity.Value)) + continue; + + list.Add(player); + } var prefList = new List(); -- 2.51.2