fix: pingfaker overwrites pings for real players (resolves #572)

fix: crash bug introduced in #569
This commit is contained in:
jeefo 2024-05-22 11:13:52 +03:00
commit ee964e0c9a
No known key found for this signature in database
GPG key ID: D696786B81B667C8
14 changed files with 322 additions and 188 deletions

View file

@ -39,9 +39,6 @@ ConVar cv_botskin_t ("botskin_t", "0", "Specifies the bots wanted skin for Terro
ConVar cv_botskin_ct ("botskin_ct", "0", "Specifies the bots wanted skin for CT team.", true, 0.0f, 5.0f);
ConVar cv_preferred_personality ("preferred_personality", "none", "Sets the default personality when creating bots with quota management.\nAllowed values: 'none', 'normal', 'careful', 'rusher'.\nIf 'none' is specified personality chosen randomly.", false);
ConVar cv_ping_base_min ("ping_base_min", "7", "Lower bound for base bot ping shown in scoreboard upon creation.", true, 0.0f, 100.0f);
ConVar cv_ping_base_max ("ping_base_max", "34", "Upper bound for base bot ping shown in scoreboard upon creation.", true, 0.0f, 100.0f);
ConVar cv_quota_adding_interval ("quota_adding_interval", "0.10", "Interval in which bots are added to the game.", true, 0.10f, 1.0f);
ConVar cv_quota_maintain_interval ("quota_maintain_interval", "0.40", "Interval on which overall bot quota are checked.", true, 0.40f, 2.0f);
@ -1161,7 +1158,8 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int skin) {
}
m_difficulty = rg (minDifficulty, maxDifficulty);
}
m_basePing = rg (cv_ping_base_min.as <int> (), cv_ping_base_max.as <int> ());
m_pingBase = fakeping.randomBase ();
m_ping = fakeping.randomBase ();
m_previousThinkTime = game.time () - 0.1f;
m_frameInterval = game.time ();
@ -1526,7 +1524,10 @@ void Bot::newRound () {
m_followWaitTime = 0.0f;
m_hostages.clear ();
m_approachingLadderTimer.invalidate ();
m_forgetLastVictimTimer.invalidate ();
m_lostReachableNodeTimer.invalidate ();
for (auto &timer : m_chatterTimes) {
timer = kMaxChatterRepeatInterval;
@ -1713,7 +1714,7 @@ void Bot::markStale () {
showChatterIcon (false, true);
// reset bots ping to default
util.resetPings (ent ());
fakeping.reset (ent ());
// mark bot as leaving
m_isStale = true;