diff --git a/inc/yapb.h b/inc/yapb.h index 8987055..3af0f22 100644 --- a/inc/yapb.h +++ b/inc/yapb.h @@ -402,9 +402,9 @@ private: bool canStrafeRight (TraceResult *tr); bool isBlockedLeft (); bool isBlockedRight (); - bool checkWallOnLeft (); - bool checkWallOnRight (); - bool checkWallOnBehind (); + bool checkWallOnLeft (float distance = 40.0f); + bool checkWallOnRight (float distance = 40.0f); + bool checkWallOnBehind (float distance = 40.0f); bool updateNavigation (); bool isEnemyThreat (); bool isWeaponRestricted (int wid); diff --git a/src/combat.cpp b/src/combat.cpp index 45ed1d5..3f75158 100644 --- a/src/combat.cpp +++ b/src/combat.cpp @@ -1547,8 +1547,8 @@ void Bot::attackMovement () { m_strafeSetTime = strafeUpdateTime (); } - const bool wallOnRight = checkWallOnRight (); - const bool wallOnLeft = checkWallOnLeft (); + const bool wallOnRight = checkWallOnRight (72.0f); + const bool wallOnLeft = checkWallOnLeft (72.0f); if (m_dodgeStrafeDir == Dodge::Left) { if (!wallOnLeft) { @@ -1584,7 +1584,10 @@ void Bot::attackMovement () { // do not move if inside "corridor" if (wallOnRight && wallOnLeft) { m_strafeSpeed = 0.0f; + m_moveSpeed = 0.0f; + m_strafeSetTime = game.time () + 3.0f; + m_dodgeStrafeDir = Dodge::None; } // we're setting strafe speed regardless of move angles, so not resetting forward move here cause bots to behave strange diff --git a/src/navigate.cpp b/src/navigate.cpp index ab40b43..0b6d806 100644 --- a/src/navigate.cpp +++ b/src/navigate.cpp @@ -3091,9 +3091,9 @@ bool Bot::isBlockedRight () { return false; } -bool Bot::checkWallOnLeft () { +bool Bot::checkWallOnLeft (float distance) { TraceResult tr {}; - game.testLine (pev->origin, pev->origin - pev->angles.right () * 40.0f, TraceIgnore::Monsters, ent (), &tr); + game.testLine (pev->origin, pev->origin - pev->angles.right () * distance, TraceIgnore::Monsters, ent (), &tr); // check if the trace hit something... if (tr.flFraction < 1.0f) { @@ -3102,11 +3102,11 @@ bool Bot::checkWallOnLeft () { return false; } -bool Bot::checkWallOnRight () { +bool Bot::checkWallOnRight (float distance) { TraceResult tr {}; // do a trace to the right... - game.testLine (pev->origin, pev->origin + pev->angles.right () * 40.0f, TraceIgnore::Monsters, ent (), &tr); + game.testLine (pev->origin, pev->origin + pev->angles.right () * distance, TraceIgnore::Monsters, ent (), &tr); // check if the trace hit something... if (tr.flFraction < 1.0f) { @@ -3115,11 +3115,11 @@ bool Bot::checkWallOnRight () { return false; } -bool Bot::checkWallOnBehind () { +bool Bot::checkWallOnBehind (float distance) { TraceResult tr {}; // do a trace to the right... - game.testLine (pev->origin, pev->origin - pev->angles.forward () * 40.0f, TraceIgnore::Monsters, ent (), &tr); + game.testLine (pev->origin, pev->origin - pev->angles.forward () * distance, TraceIgnore::Monsters, ent (), &tr); // check if the trace hit something... if (tr.flFraction < 1.0f) {