diff --git a/include/core.h b/include/core.h index 1b1eece..c9fd34f 100644 --- a/include/core.h +++ b/include/core.h @@ -848,6 +848,7 @@ private: float m_firstCollideTime; // time of first collision float m_probeTime; // time of probing different moves float m_lastCollTime; // time until next collision check + float m_jumpStateTimer; // timer for jumping collision check unsigned int m_collisionProbeBits; // bits of possible collision moves unsigned int m_collideMoves[MAX_COLLIDE_MOVES]; // sorted array of movements diff --git a/source/navigate.cpp b/source/navigate.cpp index 86d23bc..aa588b0 100644 --- a/source/navigate.cpp +++ b/source/navigate.cpp @@ -428,7 +428,7 @@ void Bot::CheckTerrain (float movedDistance, const Vector &dirNormal) else if (IsInWater ()) bits |= (PROBE_JUMP | PROBE_STRAFE); else - bits |= (PROBE_STRAFE | (Random.Long (0, 20) > (cantMoveForward ? 10 : 5) ? PROBE_JUMP : 0)); + bits |= (PROBE_STRAFE | (m_jumpStateTimer < GetWorldTime () ? PROBE_JUMP : 0)); // collision check allowed if not flying through the air if (IsOnFloor () || IsOnLadder () || IsInWater ()) @@ -617,7 +617,10 @@ void Bot::CheckTerrain (float movedDistance, const Vector &dirNormal) { case COLLISION_JUMP: if (IsOnFloor () || IsInWater ()) + { pev->button |= IN_JUMP; + m_jumpStateTimer = Random.Float (1.0f, 2.0f); + } break; case COLLISION_DUCK: