diff --git a/Fika.Core/Coop/Custom/FikaDynamicAI.cs b/Fika.Core/Coop/Custom/FikaDynamicAI.cs index 827c08cb..6379b07e 100644 --- a/Fika.Core/Coop/Custom/FikaDynamicAI.cs +++ b/Fika.Core/Coop/Custom/FikaDynamicAI.cs @@ -158,8 +158,9 @@ private void CheckForPlayers(CoopBot bot) } int notInRange = 0; + float range = FikaPlugin.DynamicAIRange.Value; - foreach (CoopPlayer humanPlayer in humanPlayers) + foreach (CoopPlayer humanPlayer in humanPlayers) { if (humanPlayer == null) { @@ -173,8 +174,7 @@ private void CheckForPlayers(CoopBot bot) continue; } - float distance = Vector3.SqrMagnitude(bot.Position - humanPlayer.Position); - float range = FikaPlugin.DynamicAIRange.Value; + float distance = Vector3.SqrMagnitude(bot.Position - humanPlayer.Position); if (distance > range * range) {