From 00227ee7f053e6fdf53286df2d5631453ccf21ab Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 26 Feb 2021 19:42:08 -0500 Subject: [PATCH] Don't ever go too far behind the bot --- src/k_botsearch.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/k_botsearch.c b/src/k_botsearch.c index 7362fe849..1cda1cb1f 100644 --- a/src/k_botsearch.c +++ b/src/k_botsearch.c @@ -786,6 +786,7 @@ void K_NudgePredictionTowardsObjects(botprediction_t *predict, player_t *player) fixed_t avgDist = 0; const fixed_t baseNudge = 128 * mapobjectscale; + fixed_t maxNudge = distToPredict; fixed_t nudgeDist = 0; angle_t nudgeDir = 0; @@ -844,9 +845,10 @@ void K_NudgePredictionTowardsObjects(botprediction_t *predict, player_t *player) // High handling characters dodge better nudgeDist = ((9 - globalsmuggle.botmo->player->kartweight) + 1) * baseNudge; - if (nudgeDist > distToPredict) + maxNudge = max(distToPredict - predict->radius, predict->radius); + if (nudgeDist > maxNudge) { - nudgeDist = distToPredict; + nudgeDist = maxNudge; } // Point away @@ -897,9 +899,10 @@ void K_NudgePredictionTowardsObjects(botprediction_t *predict, player_t *player) // Acceleration characters are more aggressive nudgeDist = ((9 - globalsmuggle.botmo->player->kartspeed) + 1) * baseNudge; - if (nudgeDist > distToPredict) + maxNudge = max(distToPredict - predict->radius, predict->radius); + if (nudgeDist > maxNudge) { - nudgeDist = distToPredict; + nudgeDist = maxNudge; } if (avgDist <= nudgeDist)