add: OnARoll chatter event with phrases that bots will say when completing a kill streak in a short amount of time

This commit is contained in:
Владислав Сухов 2024-05-20 19:58:59 +00:00
commit 9d7b037e05
5 changed files with 21 additions and 0 deletions

View file

@ -1806,6 +1806,7 @@ void Bot::refreshEnemyPredict () {
void Bot::setLastVictim (edict_t *ent) {
m_lastVictim = ent;
m_lastVictimOrigin = ent->v.origin;
m_lastVictimTime = game.time ();
m_forgetLastVictimTimer.start (rg (1.0f, 2.0f));
}
@ -1870,6 +1871,20 @@ void Bot::setConditions () {
}
}
}
else {
auto currentTime = game.time();
m_killsInterval = currentTime - m_lastVictimTime;
if (m_killsInterval <= 5) {
m_killsCount++;
if (m_killsCount > 2) {
pushChatterMessage(Chatter::OnARoll);
}
}
else {
m_killsCount = 0;
}
}
// if no more enemies found AND bomb planted, switch to knife to get to bomb place faster
if (m_team == Team::CT && !usesKnife () && m_numEnemiesLeft == 0 && bots.isBombPlanted ()) {