diff --git a/src/game/server/NextBot/Path/NextBotPathFollow.cpp b/src/game/server/NextBot/Path/NextBotPathFollow.cpp index a8efd479dd..879a2d5859 100644 --- a/src/game/server/NextBot/Path/NextBotPathFollow.cpp +++ b/src/game/server/NextBot/Path/NextBotPathFollow.cpp @@ -205,6 +205,15 @@ bool PathFollower::IsAtGoal( INextBot *bot ) const // reached goal return true; } + +#ifdef NEO + // a bot that walked off past the top of the drop has started its fall, + // so steer for the landing instead of back toward the edge behind it + if ( !mover->IsOnGround() && DotProduct2D( toGoal.AsVector2D(), current->forward.AsVector2D() ) < 0.0f ) + { + return true; + } +#endif } /// @todo: it is possible to fall into a bad place and get stuck - should move back onto the path @@ -573,6 +582,14 @@ bool PathFollower::CheckProgress( INextBot *bot ) // iterate to next segment of the path const Path::Segment *nextSegment = pSkipToGoal ? pSkipToGoal : NextSegment( m_goal ); +#ifdef NEO + // a drop's landing lies straight below its top, so it is behind a bot already falling past the top + if ( !pSkipToGoal && m_goal->type == DROP_DOWN && !mover->IsOnGround() && nextSegment && NextSegment( nextSegment ) ) + { + nextSegment = NextSegment( nextSegment ); + } +#endif + if ( nextSegment == NULL ) { // must be on ground to complete the path @@ -815,6 +832,16 @@ void PathFollower::Update( INextBot *bot ) const bool hasJustLanded = isOnGround && !m_wasOnGround; m_wasOnGround = isOnGround; + // a bot that skipped a drop's landing in the air can come down on a ledge part way down, + // so aim for the top of the drop again instead of the path past the landing it missed + const Path::Segment *landing = hasJustLanded ? PriorSegment( m_goal ) : NULL; + const Path::Segment *dropTop = landing ? PriorSegment( landing ) : NULL; + const float feetZ = mover->GetFeet().z; + if ( dropTop && dropTop->type == DROP_DOWN && feetZ > landing->pos.z + mover->GetStepHeight() && feetZ < dropTop->pos.z - mover->GetStepHeight() ) + { + m_goal = dropTop; + } + if ( hasJustLanded && HasFallenBelowPath( bot ) && IsNearNavMesh( bot ) ) { mover->GetBot()->OnMoveToFailure( this, FAIL_FELL_OFF );