Prevent really latejoins from being T (#14866)

AKA if they're still on arrivals and either padded time or got lucky with timing.
This commit is contained in:
metalgearsloth
2023-03-27 00:17:38 +11:00
committed by GitHub
parent 93fd38cf68
commit 492a361dd9

View File

@@ -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<IPlayerSession> FindPotentialTraitors(in Dictionary<IPlayerSession, HumanoidCharacterProfile> candidates)
{
var list = new List<IPlayerSession>(candidates.Keys).Where(x =>
x.Data.ContentData()?.Mind?.AllRoles.All(role => role is not Job { CanBeAntag: false }) ?? false
).ToList();
var list = new List<IPlayerSession>();
var pendingQuery = GetEntityQuery<PendingClockInComponent>();
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<IPlayerSession>();