fix: chat percentage isn't working as expected (resolves #332)

This commit is contained in:
dmitry 2022-04-18 17:31:37 +03:00
commit ad34b1e888
No known key found for this signature in database
GPG key ID: 8297CE728B7A7E37

View file

@ -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;