fix: do not apply knife mode if we're just have knife in hands

nav: increase search radius in checking node reachability
This commit is contained in:
jeefo 2023-04-13 21:12:49 +03:00
commit 5bc4e1c675
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
2 changed files with 3 additions and 3 deletions

View file

@ -1567,7 +1567,7 @@ void Bot::overrideConditions () {
}
// special handling, if we have a knife in our hands
if ((usesKnife () || !hasAnyWeapons ()) && (util.isPlayer (m_enemy) || (cv_attack_monsters.bool_ () && util.isMonster (m_enemy)))) {
if (isKnifeMode () && (util.isPlayer (m_enemy) || (cv_attack_monsters.bool_ () && util.isMonster (m_enemy)))) {
float length = pev->origin.distance2d (m_enemy->v.origin);
// do waypoint movement if enemy is not reachable with a knife

View file

@ -3415,7 +3415,7 @@ bool Bot::isReachableNode (int index) {
const Vector &dst = graph[index].origin;
// is the destination close enough?
if (dst.distanceSq (src) >= cr::square (320.0f)) {
if (dst.distanceSq (src) >= cr::square (600.0f)) {
return false;
}
@ -3423,7 +3423,6 @@ bool Bot::isReachableNode (int index) {
if (isOccupiedNode (index, true)) {
return false;
}
float ladderDist = dst.distance2d (src);
TraceResult tr {};
game.testHull (src, dst, TraceIgnore::Monsters, head_hull, ent (), &tr);
@ -3435,6 +3434,7 @@ bool Bot::isReachableNode (int index) {
if (pev->waterlevel == 2 || pev->waterlevel == 3) {
return true;
}
float ladderDist = dst.distance2d (src);
// check for ladder
bool nonLadder = !(graph[index].flags & NodeFlag::Ladder) || ladderDist > 16.0f;