Don't count lobby players for latejoin antag ratio (#35209)

pass playercount to midround antag calculation
This commit is contained in:
Errant
2025-02-17 09:27:39 +01:00
committed by GitHub
parent cf38814515
commit 890ad4508a
2 changed files with 7 additions and 3 deletions

View File

@@ -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.
/// </summary>
public bool TryGetNextAvailableDefinition(Entity<AntagSelectionComponent> 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;

View File

@@ -144,7 +144,10 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem<AntagSelection
DebugTools.AssertEqual(antag.SelectionTime, AntagSelectionTime.PostPlayerSpawn);
if (!TryGetNextAvailableDefinition((uid, antag), out var def))
// do not count players in the lobby for the antag ratio
var players = _playerManager.NetworkedSessions.Count(x => x.AttachedEntity != null);
if (!TryGetNextAvailableDefinition((uid, antag), out var def, players))
continue;
if (TryMakeAntag((uid, antag), args.Player, def.Value))