diff --git a/src/botlib.cpp b/src/botlib.cpp index 1debb00..771f661 100644 --- a/src/botlib.cpp +++ b/src/botlib.cpp @@ -2411,7 +2411,9 @@ bool Bot::reactOnEnemy () { bool Bot::lastEnemyShootable () { // don't allow shooting through walls - if (!(m_aimFlags & (AimFlags::LastEnemy | AimFlags::PredictPath)) || m_lastEnemyOrigin.empty () || game.isNullEntity (m_lastEnemy)) { + if (!(m_aimFlags & (AimFlags::LastEnemy | AimFlags::PredictPath)) + || m_lastEnemyOrigin.empty () + || game.isNullEntity (m_lastEnemy)) { return false; } return util.getConeDeviation (ent (), m_lastEnemyOrigin) >= 0.90f && isPenetrableObstacle (m_lastEnemyOrigin); @@ -2422,7 +2424,13 @@ void Bot::checkRadioQueue () { // don't allow bot listen you if bot is busy - if (m_radioOrder != Radio::ReportInTeam && (getCurrentTaskId () == Task::DefuseBomb || getCurrentTaskId () == Task::PlantBomb || m_hasHostage || m_hasC4 || m_isCreature)) { + if (m_radioOrder != Radio::ReportInTeam + && (getCurrentTaskId () == Task::DefuseBomb + || getCurrentTaskId () == Task::PlantBomb + || m_hasHostage + || m_hasC4 + || m_isCreature)) { + m_radioOrder = 0; return; } diff --git a/src/combat.cpp b/src/combat.cpp index a3a3606..692f744 100644 --- a/src/combat.cpp +++ b/src/combat.cpp @@ -666,7 +666,11 @@ Vector Bot::getBodyOffsetError (float distance) { const float hitError = distance / (cr::clamp (static_cast (m_difficulty), 1.0f, 4.0f) * 1280.0f); const auto &maxs = m_enemy->v.maxs, &mins = m_enemy->v.mins; - m_aimLastError = Vector (rg (mins.x * hitError, maxs.x * hitError), rg (mins.y * hitError, maxs.y * hitError), rg (mins.z * hitError * 0.5f, maxs.z * hitError * 0.5f)); + m_aimLastError = Vector ( + rg (mins.x * hitError, maxs.x * hitError), + rg (mins.y * hitError, maxs.y * hitError), + rg (mins.z * hitError * 0.5f, maxs.z * hitError * 0.5f) + ); const auto &aimError = conf.getDifficultyTweaks (m_difficulty)->aimError; m_aimLastError += Vector (rg (-aimError.x, aimError.x), rg (-aimError.y, aimError.y), rg (-aimError.z, aimError.z)); diff --git a/src/config.cpp b/src/config.cpp index 2c2f7bc..b8ecea5 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -243,7 +243,9 @@ void BotConfig::loadChatterConfig () { MemFile file {}; // chatter initialization - if (game.is (GameFlags::HasBotVoice) && cv_radio_mode.as () == 2 && openConfig ("chatter", "Couldn't open chatter system configuration", &file)) { + if (game.is (GameFlags::HasBotVoice) && cv_radio_mode.as () == 2 + && openConfig ("chatter", "Couldn't open chatter system configuration", &file)) { + m_chatter.clear (); struct EventMap { diff --git a/src/graph.cpp b/src/graph.cpp index 73980ce..51809a7 100644 --- a/src/graph.cpp +++ b/src/graph.cpp @@ -2384,7 +2384,12 @@ void BotGraph::frame () { message.assignf (" %s node:\n" " Node %d of %d, Radius: %.1f, Light: %s\n" " Flags: %s\n" - " Origin: (%.1f, %.1f, %.1f)\n", type, node, m_paths.length () - 1, p.radius, cr::fequal (p.light, kInvalidLightLevel) ? "Invalid" : strings.format ("%1.f", p.light), flags, p.origin.x, p.origin.y, p.origin.z); + " Origin: (%.1f, %.1f, %.1f)\n", + type, node, m_paths.length () - 1, p.radius, + cr::fequal (p.light, kInvalidLightLevel) ? "Invalid" : strings.format ("%1.f", p.light), + flags, p.origin.x, p.origin.y, p.origin.z + ); + return message; }; @@ -2410,7 +2415,12 @@ void BotGraph::frame () { String practiceText {}; practiceText.assignf (" Node practice data (index / damage):\n" " CT: %d / %d\n" - " T: %d / %d\n\n", dangerIndexCT, dangerIndexCT != kInvalidNodeIndex ? practice.getDamage (Team::CT, nearestIndex, dangerIndexCT) : 0, dangerIndexT, dangerIndexT != kInvalidNodeIndex ? practice.getDamage (Team::Terrorist, nearestIndex, dangerIndexT) : 0); + " T: %d / %d\n\n", + dangerIndexCT, + dangerIndexCT != kInvalidNodeIndex ? practice.getDamage (Team::CT, nearestIndex, dangerIndexCT) : 0, + dangerIndexT, + dangerIndexT != kInvalidNodeIndex ? practice.getDamage (Team::Terrorist, nearestIndex, dangerIndexT) : 0 + ); sendHudMessage ({ 255, 255, 255 }, 0.0f, 0.16f, practiceText + timeMessage); } diff --git a/src/tasks.cpp b/src/tasks.cpp index 8cfb114..bf9d1ad 100644 --- a/src/tasks.cpp +++ b/src/tasks.cpp @@ -1329,7 +1329,8 @@ void Bot::throwSmoke_ () { void Bot::doublejump_ () { if (!util.isAlive (m_doubleJumpEntity) || (m_aimFlags & AimFlags::Enemy) - || (m_travelStartIndex != kInvalidNodeIndex && getTask ()->time + (graph.calculateTravelTime (pev->maxspeed, graph[m_travelStartIndex].origin, m_doubleJumpOrigin) + 11.0f) < game.time ())) { + || (m_travelStartIndex != kInvalidNodeIndex + && getTask ()->time + (graph.calculateTravelTime (pev->maxspeed, graph[m_travelStartIndex].origin, m_doubleJumpOrigin) + 11.0f) < game.time ())) { resetDoubleJump (); return; } diff --git a/src/vision.cpp b/src/vision.cpp index 998cbf3..0d4e7ff 100644 --- a/src/vision.cpp +++ b/src/vision.cpp @@ -586,7 +586,12 @@ void Bot::setAimDirection () { } const bool horizontalMovement = (m_pathFlags & NodeFlag::Ladder) || isOnLadder (); - if (m_numEnemiesLeft > 0 && m_canChooseAimDirection && m_seeEnemyTime + 4.0f < game.time () && m_currentNodeIndex != kInvalidNodeIndex && !horizontalMovement) { + if (m_numEnemiesLeft > 0 + && m_canChooseAimDirection + && m_seeEnemyTime + 4.0f < game.time () + && m_currentNodeIndex != kInvalidNodeIndex + && !horizontalMovement) { + const auto dangerIndex = practice.getIndex (m_team, m_currentNodeIndex, m_currentNodeIndex); if (graph.exists (dangerIndex)