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:
@@ -6,6 +6,7 @@ using Content.Server.Roles;
|
|||||||
using Content.Server.Traitor;
|
using Content.Server.Traitor;
|
||||||
using Content.Server.Traitor.Uplink;
|
using Content.Server.Traitor.Uplink;
|
||||||
using Content.Server.NPC.Systems;
|
using Content.Server.NPC.Systems;
|
||||||
|
using Content.Server.Shuttles.Components;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Dataset;
|
using Content.Shared.Dataset;
|
||||||
using Content.Shared.Preferences;
|
using Content.Shared.Preferences;
|
||||||
@@ -171,9 +172,23 @@ public sealed class TraitorRuleSystem : GameRuleSystem
|
|||||||
|
|
||||||
public List<IPlayerSession> FindPotentialTraitors(in Dictionary<IPlayerSession, HumanoidCharacterProfile> candidates)
|
public List<IPlayerSession> FindPotentialTraitors(in Dictionary<IPlayerSession, HumanoidCharacterProfile> candidates)
|
||||||
{
|
{
|
||||||
var list = new List<IPlayerSession>(candidates.Keys).Where(x =>
|
var list = new List<IPlayerSession>();
|
||||||
x.Data.ContentData()?.Mind?.AllRoles.All(role => role is not Job { CanBeAntag: false }) ?? false
|
var pendingQuery = GetEntityQuery<PendingClockInComponent>();
|
||||||
).ToList();
|
|
||||||
|
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>();
|
var prefList = new List<IPlayerSession>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user