fix: zombies should not emit any radio or chatter events

This commit is contained in:
jeefo 2024-05-25 23:42:55 +03:00
commit eec4101daa
No known key found for this signature in database
GPG key ID: D696786B81B667C8
3 changed files with 11 additions and 7 deletions

View file

@ -917,7 +917,7 @@ void Bot::instantChatter (int type) {
void Bot::pushRadioMessage (int message) { void Bot::pushRadioMessage (int message) {
// this function inserts the radio message into the message queue // this function inserts the radio message into the message queue
if (cv_radio_mode.as <int> () == 0 || m_numFriendsLeft == 0) { if (cv_radio_mode.as <int> () == 0 || m_numFriendsLeft == 0 || m_isCreature) {
return; return;
} }
m_forceRadio = !game.is (GameFlags::HasBotVoice) m_forceRadio = !game.is (GameFlags::HasBotVoice)
@ -931,7 +931,7 @@ void Bot::pushRadioMessage (int message) {
void Bot::pushChatterMessage (int message) { void Bot::pushChatterMessage (int message) {
// this function inserts the voice message into the message queue (mostly same as above) // this function inserts the voice message into the message queue (mostly same as above)
if (!game.is (GameFlags::HasBotVoice) || cv_radio_mode.as <int> () != 2 || !conf.hasChatterBank (message) || m_numFriendsLeft == 0) { if (!game.is (GameFlags::HasBotVoice) || m_isCreature || cv_radio_mode.as <int> () != 2 || !conf.hasChatterBank (message) || m_numFriendsLeft == 0) {
return; return;
} }
bool sendMessage = false; bool sendMessage = false;
@ -2322,7 +2322,7 @@ void Bot::checkRadioQueue () {
// don't allow bot listen you if bot is busy // don't allow bot listen you if bot is busy
if (getCurrentTaskId () == Task::DefuseBomb || getCurrentTaskId () == Task::PlantBomb || m_hasHostage || m_hasC4) { if (getCurrentTaskId () == Task::DefuseBomb || getCurrentTaskId () == Task::PlantBomb || m_hasHostage || m_hasC4 || m_isCreature) {
m_radioOrder = 0; m_radioOrder = 0;
return; return;
} }

View file

@ -374,7 +374,7 @@ void Bot::checkForChat () {
void Bot::sendToChat (StringRef message, bool teamOnly) { void Bot::sendToChat (StringRef message, bool teamOnly) {
// this function prints saytext message to all players // this function prints saytext message to all players
if (message.empty () || !cv_chat) { if (m_isCreature || message.empty () || !cv_chat) {
return; return;
} }
issueCommand ("%s \"%s\"", teamOnly ? "say_team" : "say", message); issueCommand ("%s \"%s\"", teamOnly ? "say_team" : "say", message);

View file

@ -1172,25 +1172,29 @@ void Game::ensureHealthyGameEnvironment () {
return; return;
} }
auto notifyPeacefulRevert = [] (const ConVar &cv) {
game.print ("Cvar \"%s\" reverted to peaceful value.", cv.name ());
};
// disable fake latency // disable fake latency
if (cv_show_latency.as <int> () > 1) { if (cv_show_latency.as <int> () > 1) {
cv_show_latency.set (0); cv_show_latency.set (0);
game.print ("Cvar \"%s_show_latency\" reverted to peaceful value.", product.cmdPri); notifyPeacefulRevert (cv_show_latency);
} }
// disable fake avatars // disable fake avatars
if (cv_show_avatars) { if (cv_show_avatars) {
cv_show_avatars.set (0); cv_show_avatars.set (0);
game.print ("Cvar \"%s_show_avatars\" reverted to peaceful value.", product.cmdPri); notifyPeacefulRevert (cv_show_avatars);
} }
// disable fake queries // disable fake queries
if (cv_enable_query_hook) { if (cv_enable_query_hook) {
cv_enable_query_hook.set (0); cv_enable_query_hook.set (0);
game.print ("Cvar \"%s_enable_query_hook\" reverted to peaceful value.", product.cmdPri); notifyPeacefulRevert (cv_enable_query_hook);
} }
} }