diff --git a/src/botlib.cpp b/src/botlib.cpp index a708e51..e2d4b2d 100644 --- a/src/botlib.cpp +++ b/src/botlib.cpp @@ -523,7 +523,7 @@ void Bot::updatePickups () { // this function finds Items to collect or use in the near of a bot // don't try to pickup anything while on ladder or trying to escape from bomb... - if (isOnLadder () || getCurrentTaskId () == Task::EscapeFromBomb || !cv_pickup_best.bool_ () || cv_jasonmode.bool_ () || m_seeEnemyTime + 5.0f > game.time () || !game.isNullEntity (m_enemy) || !bots.hasIntrestingEntities ()) { + if (isOnLadder () || getCurrentTaskId () == Task::EscapeFromBomb || !cv_pickup_best.bool_ () || cv_jasonmode.bool_ () || m_seeEnemyTime + 3.0f > game.time () || !game.isNullEntity (m_enemy) || !bots.hasIntrestingEntities ()) { m_pickupItem = nullptr; m_pickupType = Pickup::None; @@ -1969,7 +1969,7 @@ void Bot::filterTasks () { // calculate desires to seek cover or hunt if (util.isPlayer (m_lastEnemy) && !m_lastEnemyOrigin.empty () && !m_hasC4) { - float retreatLevel = (100.0f - (m_healthValue > 50.0f ? 100.0f : m_healthValue)) * tempFear; // retreat level depends on bot health + float retreatLevel = (100.0f - (m_healthValue > 70.0f ? 100.0f : m_healthValue)) * tempFear; // retreat level depends on bot health if (m_numEnemiesLeft > m_numFriendsLeft / 2 && m_retreatTime < game.time () && m_seeEnemyTime - rg.get (2.0f, 4.0f) < game.time ()) { diff --git a/src/combat.cpp b/src/combat.cpp index e3dc7db..b36b1b7 100644 --- a/src/combat.cpp +++ b/src/combat.cpp @@ -1103,7 +1103,7 @@ void Bot::attackMovement () { m_moveSpeed = -pev->maxspeed; } - if (usesSniper () || !(m_enemyParts & (Visibility::Body | Visibility::Head))) { + if (usesSniper ()) { m_fightStyle = Fight::Stay; m_lastFightStyleCheck = game.time (); } @@ -1111,7 +1111,7 @@ void Bot::attackMovement () { if (m_lastFightStyleCheck + 3.0f < game.time ()) { int rand = rg.get (1, 100); - if (distance < 450.0f) { + if (distance < 768.0f) { m_fightStyle = Fight::Strafe; } else if (distance < 1024.0f) { @@ -1137,7 +1137,11 @@ void Bot::attackMovement () { m_fightStyle = Fight::Strafe; } - if (m_fightStyle == Fight::Strafe || ((pev->button & IN_RELOAD) || m_isReloading) || (usesPistol () && distance < 400.0f) || usesKnife ()) { + if (isInViewCone (m_enemy->v.origin) && usesKnife ()) { + m_fightStyle = Fight::Strafe; + } + + if ((m_difficulty >= Difficulty::Normal && m_fightStyle == Fight::Strafe) || ((pev->button & IN_RELOAD) || m_isReloading) || (usesPistol () && distance < 768.0f) || usesKnife ()) { if (m_strafeSetTime < game.time ()) { // to start strafing, we have to first figure out if the target is on the left side or right side @@ -1176,20 +1180,12 @@ void Bot::attackMovement () { } } - if (m_difficulty >= Difficulty::Hard && (m_jumpTime + 5.0f < game.time () && isOnFloor () && rg.get (0, 1000) < (m_isReloading ? 8 : 2) && pev->velocity.length2d () > 120.0f) && !usesSniper ()) { + if (m_difficulty >= Difficulty::Hard && (m_jumpTime + 5.0f < game.time () && isOnFloor () && rg.get (0, 1000) < (m_isReloading ? 8 : 2) && pev->velocity.length2d () > 150.0f) && !usesSniper ()) { pev->button |= IN_JUMP; } - - if (m_moveSpeed > 0.0f && distance > 100.0f && !usesKnife ()) { - m_moveSpeed = 0.0f; - } - - if (usesKnife ()) { - m_strafeSpeed = 0.0f; - } } else if (m_fightStyle == Fight::Stay) { - if ((m_enemyParts & (Visibility::Head | Visibility::Body)) && !(m_enemyParts & Visibility::Other) && getCurrentTaskId () != Task::SeekCover && getCurrentTaskId () != Task::Hunt) { + if ((m_enemyParts & (Visibility::Head | Visibility::Body)) && getCurrentTaskId () != Task::SeekCover && getCurrentTaskId () != Task::Hunt) { int enemyNearestIndex = graph.getNearest (m_enemy->v.origin); if (graph.isDuckVisible (m_currentNodeIndex, enemyNearestIndex) && graph.isDuckVisible (enemyNearestIndex, m_currentNodeIndex)) { @@ -1202,9 +1198,11 @@ void Bot::attackMovement () { } } - if (m_fightStyle == Fight::Stay || (m_duckTime > game.time () || m_sniperStopTime > game.time ())) { - if (m_moveSpeed > 0.0f && !usesKnife ()) { - m_moveSpeed = 0.0f; + if (m_difficulty >= Difficulty::Hard && isOnFloor () && (m_duckTime < game.time ())) { + if (distance < 768.0f) { + if (rg.get (0, 1000) < 10 && pev->velocity.length2d () > 150.0f && isInViewCone (m_enemy->v.origin)) { + pev->button |= IN_JUMP; + } } } diff --git a/src/graph.cpp b/src/graph.cpp index b5c994c..727a53d 100644 --- a/src/graph.cpp +++ b/src/graph.cpp @@ -2286,7 +2286,7 @@ void BotGraph::frame () { nodeColor = { 255, 160, 160 }; } else if (path.flags & NodeFlag::CTOnly) { - nodeColor = { 255, 160, 255 }; + nodeColor = { 160, 160, 255 }; } else { nodeColor = { 0, 255, 255 }; diff --git a/src/navigate.cpp b/src/navigate.cpp index 333575b..19a1801 100644 --- a/src/navigate.cpp +++ b/src/navigate.cpp @@ -1874,6 +1874,19 @@ int Bot::findNearestNode () { index = at; minimum = distance; } + + // @pr-419: temporarily disabled due to cpu usage +#if 0 + else { + TraceResult tr {}; + game.testHull (getEyesPos (), graph[at].origin, TraceIgnore::Monsters, head_hull, ent (), &tr); + + if (tr.flFraction >= 1.0f && !tr.fStartSolid) { + index = at; + minimum = distance; + } + } +#endif } }