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

@ -88,3 +88,4 @@ Event Chatter_GottaFindTheBomb = theres_the_bomb, theres_the_bomb2
Event Chatter_Lost_The_Commander = weve_lost_the_commander, the_commander_is_down, the_commander_is_down_repeat
Event Chatter_CoverMe = cover_me, cover_me2
Event Chatter_BombSiteSecured = i_wasnt_worried_for_a_minute, that_was_a_close_one, well_done, whew_that_was_close
Event Chatter_OnARoll = i_got_more_where_that_came_from, who_wants_some_more, i_am_on_fire, look_out_brag, thats_right, whos_the_man

View file

@ -230,6 +230,7 @@ CR_DECLARE_SCOPED_ENUM (Chatter,
CoverMe,
BehindSmoke,
BombsiteSecured,
OnARoll,
Count
)

View file

@ -226,6 +226,7 @@ private:
int m_tryOpenDoor {}; // attempt's to open the door
int m_liftState {}; // state of lift handling
int m_radioSelect {}; // radio entry
int m_killsCount {}; // the kills count of a bot
int m_lastPredictIndex { kInvalidNodeIndex }; // last predicted path index
int m_lastPredictLength {}; // last predicted path length
@ -286,6 +287,8 @@ private:
float m_breakableTime {}; // breakable acquired time
float m_stuckTimestamp {}; // last time was stuck
float m_timeDebugUpdateTime {}; // time to update last debug timestamp
float m_lastVictimTime {}; // time when bot killed an enemy
float m_killsInterval {}; // interval between kills
bool m_moveToGoal {}; // bot currently moving to goal??
bool m_isStuck {}; // bot is stuck

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 ()) {

View file

@ -322,6 +322,7 @@ void BotConfig::loadChatterConfig () {
{ "Chatter_BombSiteSecured", Chatter::BombsiteSecured, 3.5f },
{ "Chatter_GoingToCamp", Chatter::GoingToCamp, 30.0f },
{ "Chatter_Camp", Chatter::Camping, 10.0f },
{ "Chatter_OnARoll", Chatter::OnARoll, kMaxChatterRepeatInterval},
};
while (file.getLine (line)) {