From 890ad4508aefa582920174cd406d581ebed0117f Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Mon, 17 Feb 2025 09:27:39 +0100 Subject: [PATCH] Don't count lobby players for latejoin antag ratio (#35209) pass playercount to midround antag calculation --- Content.Server/Antag/AntagSelectionSystem.API.cs | 5 +++-- Content.Server/Antag/AntagSelectionSystem.cs | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Content.Server/Antag/AntagSelectionSystem.API.cs b/Content.Server/Antag/AntagSelectionSystem.API.cs index 23e77c2102..a4cb6fd0e5 100644 --- a/Content.Server/Antag/AntagSelectionSystem.API.cs +++ b/Content.Server/Antag/AntagSelectionSystem.API.cs @@ -19,11 +19,12 @@ public sealed partial class AntagSelectionSystem /// Tries to get the next non-filled definition based on the current amount of selected minds and other factors. /// public bool TryGetNextAvailableDefinition(Entity ent, - [NotNullWhen(true)] out AntagSelectionDefinition? definition) + [NotNullWhen(true)] out AntagSelectionDefinition? definition, + int? players = null) { definition = null; - var totalTargetCount = GetTargetAntagCount(ent); + var totalTargetCount = GetTargetAntagCount(ent, players); var mindCount = ent.Comp.SelectedMinds.Count; if (mindCount >= totalTargetCount) return false; diff --git a/Content.Server/Antag/AntagSelectionSystem.cs b/Content.Server/Antag/AntagSelectionSystem.cs index 45daa7a312..ce7f3fec4c 100644 --- a/Content.Server/Antag/AntagSelectionSystem.cs +++ b/Content.Server/Antag/AntagSelectionSystem.cs @@ -144,7 +144,10 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem x.AttachedEntity != null); + + if (!TryGetNextAvailableDefinition((uid, antag), out var def, players)) continue; if (TryMakeAntag((uid, antag), args.Player, def.Value)) -- 2.51.2