Skip to content

Commit

Permalink
Improve logic to enforced spawn limits
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed May 23, 2024
1 parent 07e9949 commit df9e0e5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Fika.Core/Coop/GameMode/CoopGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private async Task<LocalPlayer> 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;
}

Expand All @@ -337,7 +337,7 @@ private async Task<LocalPlayer> 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;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit df9e0e5

Please sign in to comment.