From df9e0e5fcf8116abc30016fa2f7ddf7b35c9db5c Mon Sep 17 00:00:00 2001 From: Lacyway <20912169+Lacyway@users.noreply.github.com> Date: Thu, 23 May 2024 17:14:00 +0200 Subject: [PATCH] Improve logic to enforced spawn limits --- Fika.Core/Coop/GameMode/CoopGame.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Fika.Core/Coop/GameMode/CoopGame.cs b/Fika.Core/Coop/GameMode/CoopGame.cs index 47f27e43..3e368d87 100644 --- a/Fika.Core/Coop/GameMode/CoopGame.cs +++ b/Fika.Core/Coop/GameMode/CoopGame.cs @@ -323,7 +323,7 @@ private async Task CreateBot(Profile profile, Vector3 position) if (!CoopHandler.TryGetCoopHandler(out CoopHandler coopHandler)) { - Logger.LogError($"{nameof(CreateBot)}:Unable to find {nameof(CoopHandler)}"); + Logger.LogError($"{nameof(CreateBot)}: Unable to find {nameof(CoopHandler)}"); return null; } @@ -337,7 +337,7 @@ private async Task CreateBot(Profile profile, Vector3 position) isSpecial = true; } - if (FikaPlugin.EnforcedSpawnLimits.Value && botsController_0.AliveAndLoadingBotsCount >= botsController_0.BotSpawner.MaxBots) + if (FikaPlugin.EnforcedSpawnLimits.Value && Bots.Count >= botsController_0.BotSpawner.MaxBots) { bool despawned = false; @@ -485,6 +485,9 @@ private bool TryDespawnFurthest(Profile profile, Vector3 position, CoopHandler c if (botKey == string.Empty) { +#if DEBUG + Logger.LogWarning("TryDespawnFurthest: botKey was empty"); +#endif return false; }