From ad34b1e888555f40d7e62f7db69e615971f21457 Mon Sep 17 00:00:00 2001 From: dmitry Date: Mon, 18 Apr 2022 17:31:37 +0300 Subject: [PATCH] fix: chat percentage isn't working as expected (resolves #332) --- src/chatlib.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chatlib.cpp b/src/chatlib.cpp index b347455..5463145 100644 --- a/src/chatlib.cpp +++ b/src/chatlib.cpp @@ -317,12 +317,12 @@ bool Bot::isReplyingToChat () { void Bot::checkForChat () { // say a text every now and then - if (rg.chance (cv_chat_percent.int_ ()) || m_notKilled || !cv_chat.bool_ ()) { + if (m_notKilled || !cv_chat.bool_ ()) { return; } // bot chatting turned on? - if (m_lastChatTime + rg.get (6.0f, 10.0f) < game.time () && bots.getLastChatTimestamp () + rg.get (2.5f, 5.0f) < game.time () && !isReplyingToChat ()) { + if (rg.chance (cv_chat_percent.int_ ()) && m_lastChatTime + rg.get (6.0f, 10.0f) < game.time () && bots.getLastChatTimestamp () + rg.get (2.5f, 5.0f) < game.time () && !isReplyingToChat ()) { if (conf.hasChatBank (Chat::Dead)) { StringRef phrase = conf.pickRandomFromChatBank (Chat::Dead); bool sayBufferExists = false;