From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sun, 26 Mar 2023 13:17:38 +0000 (+1100) Subject: Prevent really latejoins from being T (#14866) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=492a361dd9e4c26b59e93f749127cbe4dbf3791b;p=space-station-14.git Prevent really latejoins from being T (#14866) AKA if they're still on arrivals and either padded time or got lucky with timing. --- 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();