Skip to content

Commit

Permalink
Fix the bug when player start the same practice from menu, kicked bot…
Browse files Browse the repository at this point in the history
…s are not added back
  • Loading branch information
lengran committed Mar 25, 2024
1 parent 7e63dd5 commit bd0cf18
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion OpenPrefirePrac.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace OpenPrefirePrac;
public class OpenPrefirePrac : BasePlugin
{
public override string ModuleName => "Open Prefire Prac";
public override string ModuleVersion => "0.0.17";
public override string ModuleVersion => "0.0.18";
public override string ModuleAuthor => "Lengran";
public override string ModuleDescription => "A plugin for practicing prefire routes in CS2. https://github.com/lengran/OpenPrefirePrac";

Expand Down Expand Up @@ -414,6 +414,17 @@ public void OnRouteSelect(CCSPlayerController player, ChatMenuOption option)
// Setup practice
AddBot(player, _practices[practiceNo].NumBots);
}
else
{
// If some bots have already been kicked, add them back.
var numRemainingBots = _playerStatuses[player].Bots.Count;

if (numRemainingBots < _practices[practiceNo].NumBots)
{
_playerStatuses[player].Progress = 0;
AddBot(player, _practices[practiceNo].NumBots - numRemainingBots);
}
}


// Practice begin
Expand Down

0 comments on commit bd0cf18

Please sign in to comment.