]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Don't count lobby players for latejoin antag ratio (#35209)
authorErrant <35878406+Errant-4@users.noreply.github.com>
Mon, 17 Feb 2025 08:27:39 +0000 (09:27 +0100)
committerGitHub <noreply@github.com>
Mon, 17 Feb 2025 08:27:39 +0000 (11:27 +0300)
pass playercount to midround antag calculation

Content.Server/Antag/AntagSelectionSystem.API.cs
Content.Server/Antag/AntagSelectionSystem.cs

index 23e77c2102800c9c30290013daa1a36a4f0bcae9..a4cb6fd0e5975ba4de4a785cb8e659ef57730e91 100644 (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;
index 45daa7a312f48a3a4e03c1dabbd360613be9942c..ce7f3fec4c628d8a840de2dd9a08420d694bbe45 100644 (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))