Prevent bot auto-creation when removing bot, by delaying quota maintaining time.
This commit is contained in:
parent
10b89ca011
commit
6769ddca39
2 changed files with 14 additions and 10 deletions
|
|
@ -368,11 +368,13 @@ void BotManager::AdjustQuota (bool isPlayerConnecting, edict_t *ent)
|
|||
{
|
||||
RemoveRandom ();
|
||||
m_balanceCount--;
|
||||
|
||||
m_quotaMaintainTime = engine.Time () + 2.0f;
|
||||
}
|
||||
}
|
||||
else if (m_balanceCount < 0)
|
||||
{
|
||||
AddRandom (false);
|
||||
AddRandom ();
|
||||
m_balanceCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -475,21 +477,23 @@ void BotManager::MaintainBotQuota (void)
|
|||
}
|
||||
|
||||
int numBots = GetBotsNum ();
|
||||
int numHumans = yb_autovacate_smart_kick.GetBool () ? GetHumansJoinedTeam () : GetHumansNum ();
|
||||
int numHumans = GetHumansNum ();
|
||||
int desiredCount = yb_quota.GetInt ();
|
||||
|
||||
if (yb_join_after_player.GetBool () && !numHumans)
|
||||
desiredCount = 0;
|
||||
|
||||
int numHumansOnTeam = yb_autovacate_smart_kick.GetBool () ? GetHumansJoinedTeam () : numHumans;
|
||||
|
||||
// quota mode
|
||||
char mode = yb_quota_mode.GetString ()[0];
|
||||
|
||||
if (mode == 'f' || mode == 'F') // fill
|
||||
desiredCount = A_max (0, desiredCount - numHumans);
|
||||
desiredCount = A_max (0, desiredCount - numHumansOnTeam);
|
||||
else if (mode == 'm' || mode == 'M') // match
|
||||
desiredCount = A_max (0, yb_quota.GetInt () * numHumans);
|
||||
desiredCount = A_max (0, yb_quota.GetInt () * numHumansOnTeam);
|
||||
|
||||
desiredCount = A_min (desiredCount, engine.MaxClients () - (numHumans + (yb_autovacate.GetBool () ? 1 : 0)));
|
||||
desiredCount = A_min (desiredCount, engine.MaxClients () - (numHumansOnTeam + (yb_autovacate.GetBool () ? 1 : 0)));
|
||||
|
||||
if (yb_autovacate_smart_kick.GetBool () && numBots > 1 && desiredCount > 1)
|
||||
VerifyPlayersHasJoinedTeam (desiredCount);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue