From 4e13a682f6242fb1f440f8b4b779623e40598e5a Mon Sep 17 00:00:00 2001 From: Lacyway <20912169+Lacyway@users.noreply.github.com> Date: Fri, 18 Oct 2024 22:16:32 +0200 Subject: [PATCH] Recalculate connected peers every cycle --- Fika.Core/Coop/GameMode/CoopGame.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Fika.Core/Coop/GameMode/CoopGame.cs b/Fika.Core/Coop/GameMode/CoopGame.cs index c0401b15..4b256f7e 100644 --- a/Fika.Core/Coop/GameMode/CoopGame.cs +++ b/Fika.Core/Coop/GameMode/CoopGame.cs @@ -574,7 +574,8 @@ private async Task WaitForPlayersToLoadBotProfile(int netId) { botQueue.Add(netId, 0); DateTime start = DateTime.Now; - int connectedPeers = Singleton.Instance.NetServer.ConnectedPeersCount; + FikaServer server = Singleton.Instance; + int connectedPeers = server.NetServer.ConnectedPeersCount; while (botQueue[netId] < connectedPeers) { @@ -586,6 +587,7 @@ private async Task WaitForPlayersToLoadBotProfile(int netId) } await Task.Delay(250); + connectedPeers = server.NetServer.ConnectedPeersCount; } botQueue.Remove(netId);