fixed bot's don't shoot thru walls
added some knife-mode movement some codestyle fixes
This commit is contained in:
parent
c850e45ed2
commit
04365ab202
5 changed files with 342 additions and 399 deletions
|
|
@ -311,10 +311,6 @@ void BotManager::AddBot (const String &name, int difficulty, int personality, in
|
|||
|
||||
// put to queue
|
||||
m_creationTab.Push (bot);
|
||||
|
||||
// keep quota number up to date
|
||||
if (GetBotsNum () + 1 > yb_quota.GetInt ())
|
||||
yb_quota.SetInt (GetBotsNum () + 1);
|
||||
}
|
||||
|
||||
void BotManager::AddBot (const String &name, const String &difficulty, const String &personality, const String &team, const String &member)
|
||||
|
|
@ -331,12 +327,6 @@ void BotManager::AddBot (const String &name, const String &difficulty, const Str
|
|||
bot.personality = (personality.IsEmpty () || personality == any) ? -1 : personality.ToInt ();
|
||||
|
||||
m_creationTab.Push (bot);
|
||||
|
||||
int newBotsNum = GetBotsNum () + 1;
|
||||
|
||||
// keep quota number up to date
|
||||
if (newBotsNum < GetMaxClients () && newBotsNum > yb_quota.GetInt ())
|
||||
yb_quota.SetInt (newBotsNum);
|
||||
}
|
||||
|
||||
void BotManager::AdjustQuota (bool isPlayerConnection, edict_t *ent)
|
||||
|
|
@ -391,14 +381,6 @@ void BotManager::MaintainBotQuota (void)
|
|||
if (yb_join_after_player.GetInt () > 0 && !numHumans)
|
||||
desiredCount = 0;
|
||||
|
||||
if (m_quotaOption != QUOTA_NONE && numBots > 1 && desiredCount > 1)
|
||||
{
|
||||
if (m_quotaOption == QUOTA_INCREMENT)
|
||||
desiredCount++;
|
||||
else
|
||||
desiredCount--;
|
||||
}
|
||||
|
||||
// quota mode
|
||||
char mode = yb_quota_mode.GetString ()[0];
|
||||
|
||||
|
|
@ -412,57 +394,21 @@ void BotManager::MaintainBotQuota (void)
|
|||
else
|
||||
desiredCount = min (desiredCount, GetMaxClients () - numHumans);
|
||||
|
||||
m_quotaOption = QUOTA_NONE;
|
||||
if (m_quotaOption != QUOTA_NONE && numBots > 1 && desiredCount > 1)
|
||||
{
|
||||
if (m_quotaOption == QUOTA_INCREMENT)
|
||||
desiredCount++;
|
||||
else
|
||||
desiredCount--;
|
||||
|
||||
m_quotaOption = QUOTA_NONE;
|
||||
}
|
||||
|
||||
if (desiredCount > numBots)
|
||||
AddRandom ();
|
||||
else if (desiredCount < numBots)
|
||||
RemoveRandom ();
|
||||
|
||||
#if 0
|
||||
int botNumber = GetBotsNum ();
|
||||
int humanNumber = GetHumansNum ();
|
||||
|
||||
if (botNumber > yb_quota.GetInt ())
|
||||
RemoveRandom ();
|
||||
|
||||
if (humanNumber > 0 && yb_quota_match.GetInt () > 0)
|
||||
{
|
||||
int num = yb_quota_match.GetInt () * humanNumber;
|
||||
|
||||
if (num >= GetMaxClients () - humanNumber)
|
||||
num = GetMaxClients () - humanNumber;
|
||||
|
||||
if (yb_quota_match_max.GetInt () > 0 && num > yb_quota_match_max.GetInt ())
|
||||
num = yb_quota_match_max.GetInt ();
|
||||
|
||||
yb_quota.SetInt (num);
|
||||
yb_autovacate.SetInt (0);
|
||||
}
|
||||
|
||||
if (yb_autovacate.GetBool ())
|
||||
{
|
||||
if (botNumber < yb_quota.GetInt () && humanNumber < GetMaxClients () - 1)
|
||||
AddRandom ();
|
||||
|
||||
if (humanNumber >= GetMaxClients ())
|
||||
RemoveRandom ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (botNumber < yb_quota.GetInt () && humanNumber < GetMaxClients ())
|
||||
AddRandom ();
|
||||
}
|
||||
|
||||
int botQuota = yb_autovacate.GetBool () ? GetMaxClients () - humanNumber : GetMaxClients ();
|
||||
|
||||
// check valid range of quota
|
||||
if (yb_quota.GetInt () > botQuota)
|
||||
yb_quota.SetInt (botQuota);
|
||||
|
||||
else if (yb_quota.GetInt () < 0)
|
||||
yb_quota.SetInt (0);
|
||||
#endif
|
||||
m_maintainTime = GetWorldTime () + 0.15f;
|
||||
}
|
||||
}
|
||||
|
|
@ -922,6 +868,12 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int member, c
|
|||
m_wantedTeam = team;
|
||||
m_wantedClass = member;
|
||||
|
||||
int newBotsNum = bots.GetBotsNum () + 1;
|
||||
|
||||
// keep quota number up to date
|
||||
if (newBotsNum < GetMaxClients () && newBotsNum > yb_quota.GetInt ())
|
||||
yb_quota.SetInt (newBotsNum);
|
||||
|
||||
NewRound ();
|
||||
}
|
||||
|
||||
|
|
@ -1220,9 +1172,11 @@ void Bot::Kick (void)
|
|||
ServerCommand ("kick \"%s\"", STRING (pev->netname));
|
||||
CenterPrint ("Bot '%s' kicked", STRING (pev->netname));
|
||||
|
||||
// balances quota
|
||||
if (bots.GetBotsNum () - 1 < yb_quota.GetInt ())
|
||||
yb_quota.SetInt (bots.GetBotsNum () - 1);
|
||||
int newBotsNum = bots.GetBotsNum () - 1;
|
||||
|
||||
// keep quota number up to date
|
||||
if (newBotsNum < GetMaxClients () && newBotsNum < yb_quota.GetInt ())
|
||||
yb_quota.SetInt (newBotsNum);
|
||||
}
|
||||
|
||||
void Bot::StartGame (void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue