From 7ad54c55be1381f9d1caa7168d8ec9b6bee84aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D1=81=D0=BB=D0=B0=D0=B2=20?= =?UTF-8?q?=D0=A1=D1=83=D1=85=D0=BE=D0=B2?= <22411953+Vladislav4KZ@users.noreply.github.com> Date: Fri, 3 May 2024 17:23:36 +0000 Subject: [PATCH] add: report of the enemies' count --- cfg/addons/yapb/conf/chatter.cfg | 4 ++++ inc/constant.h | 4 ++++ src/botlib.cpp | 29 ++++++++++++++++++++++++++++- src/combat.cpp | 20 +++++++++++++++++++- src/config.cpp | 4 ++++ 5 files changed, 59 insertions(+), 2 deletions(-) diff --git a/cfg/addons/yapb/conf/chatter.cfg b/cfg/addons/yapb/conf/chatter.cfg index c2c7c0e..d77fe72 100644 --- a/cfg/addons/yapb/conf/chatter.cfg +++ b/cfg/addons/yapb/conf/chatter.cfg @@ -57,6 +57,10 @@ Event Chatter_WonTheRound = good_job_team, nice_work_team, way_to_be_team, well_ Event Chatter_QuicklyWonTheRound = i_am_dangerous, do_not_mess_with_me, we_owned_them, they_never_knew_what_hit_them, thats_the_way_this_is_done, and_thats_how_its_done, owned, yesss, yesss2, yea_baby, whoo, whoo2, oh_yea, oh_yea2 Event Chatter_ScaredEmotion = whoa, uh_oh, oh_no, yikes, oh, oh_boy, oh_boy2, aah Event Chatter_HeardEnemy = i_hear_them, hang_on_i_heard_something, i_hear_something, i_heard_them, i_heard_something_over_there +Event Chatter_SpottedOneEnemy = one_guy +Event Chatter_SpottedTwoEnemies = two_of_them +Event Chatter_SpottedThreeEnemies = three, three_of_them +Event Chatter_TooManyEnemies = a_bunch_of_them, theyre_all_over_the_place2, theyre_everywhere2, theres_too_many_of_them, theres_too_many, too_many2, the_actions_hot_here, its_a_party Event Chatter_SniperWarning = sniper, sniper2, watch_it_theres_a_sniper Event Chatter_SniperKilled = got_the_sniper, got_the_sniper2, sniper_down, took_out_the_sniper, the_sniper_is_dead Event Chatter_VIPSpotted = i_see_our_target, target_spotted, target_acquired diff --git a/inc/constant.h b/inc/constant.h index 57df4e7..753b3cf 100644 --- a/inc/constant.h +++ b/inc/constant.h @@ -195,6 +195,10 @@ CR_DECLARE_SCOPED_ENUM (Chatter, WonTheRound, ScaredEmotion, HeardTheEnemy, + SpottedOneEnemy, + SpottedTwoEnemies, + SpottedThreeEnemies, + TooManyEnemies, SniperWarning, SniperKilled, VIPSpotted, diff --git a/src/botlib.cpp b/src/botlib.cpp index 18ad290..016021c 100644 --- a/src/botlib.cpp +++ b/src/botlib.cpp @@ -2446,6 +2446,10 @@ void Bot::checkRadioQueue () { case Radio::EnemySpotted: case Radio::NeedBackup: + case Chatter::SpottedOneEnemy: + case Chatter::SpottedTwoEnemies: + case Chatter::SpottedThreeEnemies: + case Chatter::TooManyEnemies: case Chatter::ScaredEmotion: case Chatter::PinnedDown: if (((game.isNullEntity (m_enemy) && seesEntity (m_radioEntity->v.origin)) || distanceSq < cr::sqrf (2048.0f) || !m_moveToC4) @@ -2686,7 +2690,30 @@ void Bot::checkRadioQueue () { break; case Task::Attack: - pushChatterMessage (Chatter::InCombat); + if (rg.chance (50)) { + pushChatterMessage (Chatter::InCombat); + } + else { + if (cv_radio_mode.as () == 2) { + switch (numEnemiesNear (pev->origin, 384.0f)) { + case 1: + pushChatterMessage (Chatter::SpottedOneEnemy); + break; + case 2: + pushChatterMessage (Chatter::SpottedTwoEnemies); + break; + case 3: + pushChatterMessage (Chatter::SpottedThreeEnemies); + break; + default: + pushChatterMessage (Chatter::TooManyEnemies); + break; + } + } + else if (cv_radio_mode.as () == 1) { + pushRadioMessage (Radio::EnemySpotted); + } + } break; case Task::Hide: diff --git a/src/combat.cpp b/src/combat.cpp index d6d8d90..189b93c 100644 --- a/src/combat.cpp +++ b/src/combat.cpp @@ -399,7 +399,25 @@ bool Bot::lookupEnemies () { } else { if (m_seeEnemyTime + 3.0f < game.time () && (m_hasC4 || m_hasHostage || !game.isNullEntity (m_targetEntity))) { - pushRadioMessage (Radio::EnemySpotted); + if (cv_radio_mode.as () == 2) { + switch (numEnemiesNear (pev->origin, 384.0f)) { + case 1: + pushChatterMessage (Chatter::SpottedOneEnemy); + break; + case 2: + pushChatterMessage (Chatter::SpottedTwoEnemies); + break; + case 3: + pushChatterMessage (Chatter::SpottedThreeEnemies); + break; + default: + pushChatterMessage (Chatter::TooManyEnemies); + break; + } + } + else if (cv_radio_mode.as () == 1) { + pushRadioMessage (Radio::EnemySpotted); + } } m_targetEntity = nullptr; // stop following when we see an enemy... diff --git a/src/config.cpp b/src/config.cpp index a5ba0a8..5b7e986 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -297,6 +297,10 @@ void BotConfig::loadChatterConfig () { { "Chatter_FoundC4", Chatter::FoundC4, 5.5f }, { "Chatter_ScaredEmotion", Chatter::ScaredEmotion, 6.1f }, { "Chatter_HeardEnemy", Chatter::HeardTheEnemy, 12.8f }, + { "Chatter_SpottedOneEnemy", Chatter::SpottedOneEnemy, 4.0f }, + { "Chatter_SpottedTwoEnemies", Chatter::SpottedTwoEnemies, 4.0f }, + { "Chatter_SpottedThreeEnemies", Chatter::SpottedThreeEnemies, 4.0f }, + { "Chatter_TooManyEnemies", Chatter::TooManyEnemies, 4.0f }, { "Chatter_SniperWarning", Chatter::SniperWarning, 14.3f }, { "Chatter_SniperKilled", Chatter::SniperKilled, 12.1f }, { "Chatter_OneEnemyLeft", Chatter::OneEnemyLeft, 12.5f },