mgr: random bot kick is now more even across teams
This commit is contained in:
parent
587064e897
commit
87cbd144c2
3 changed files with 24 additions and 18 deletions
|
|
@ -126,6 +126,7 @@ public:
|
|||
|
||||
bool isTeamStacked (int team);
|
||||
bool kickRandom (bool decQuota = true, Team fromTeam = Team::Unassigned);
|
||||
bool balancedKickRandom (bool decQuota);
|
||||
bool hasCustomCSDMSpawnEntities ();
|
||||
bool isLineBlockedBySmoke (const Vector &from, const Vector &to, float grenadeBloat = 1.0f);
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ int BotControl::cmdKickBot () {
|
|||
bots.kickFromTeam (Team::Terrorist);
|
||||
}
|
||||
else {
|
||||
bots.kickRandom ();
|
||||
bots.balancedKickRandom (true);
|
||||
}
|
||||
return BotCommandResult::Handled;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -460,23 +460,7 @@ void BotManager::maintainQuota () {
|
|||
createRandom ();
|
||||
}
|
||||
else if (desiredBotCount < botsInGame) {
|
||||
const auto &tp = countTeamPlayers ();
|
||||
bool isKicked = false;
|
||||
|
||||
if (tp.first > tp.second) {
|
||||
isKicked = kickRandom (false, Team::Terrorist);
|
||||
}
|
||||
else if (tp.first < tp.second) {
|
||||
isKicked = kickRandom (false, Team::CT);
|
||||
}
|
||||
else {
|
||||
isKicked = kickRandom (false, Team::Unassigned);
|
||||
}
|
||||
|
||||
// if we can't kick player from correct team, just kick any random to keep quota control work
|
||||
if (!isKicked) {
|
||||
kickRandom (false, Team::Unassigned);
|
||||
}
|
||||
balancedKickRandom (false);
|
||||
}
|
||||
else {
|
||||
// clear the saved names when quota balancing ended
|
||||
|
|
@ -796,6 +780,27 @@ bool BotManager::kickRandom (bool decQuota, Team fromTeam) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool BotManager::balancedKickRandom (bool decQuota) {
|
||||
const auto &tp = countTeamPlayers ();
|
||||
bool isKicked = false;
|
||||
|
||||
if (tp.first > tp.second) {
|
||||
isKicked = kickRandom (decQuota, Team::Terrorist);
|
||||
}
|
||||
else if (tp.first < tp.second) {
|
||||
isKicked = kickRandom (decQuota, Team::CT);
|
||||
}
|
||||
else {
|
||||
isKicked = kickRandom (decQuota, Team::Unassigned);
|
||||
}
|
||||
|
||||
// if we can't kick player from correct team, just kick any random to keep quota control work
|
||||
if (!isKicked) {
|
||||
isKicked = kickRandom (decQuota, Team::Unassigned);
|
||||
}
|
||||
return isKicked;
|
||||
}
|
||||
|
||||
bool BotManager::hasCustomCSDMSpawnEntities () {
|
||||
if (!game.is (GameFlags::CSDM | GameFlags::FreeForAll)) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue