diff --git a/src/k_bot.cpp b/src/k_bot.cpp index 372200883..0fc2436a2 100644 --- a/src/k_bot.cpp +++ b/src/k_bot.cpp @@ -654,6 +654,18 @@ fixed_t K_BotRubberband(const player_t *player) rubberband = FixedDiv(distdiff + spacing, spacing * 2); + if (player->boostpower < FRACUNIT) + { + // Do not let bots cheese offroad as much. + rubberband = FixedMul(rubberband, player->boostpower); + } + + if (P_MobjWasRemoved(player->mo) == false && player->mo->movefactor < FRACUNIT) + { + // Do not let bots speed up on ice too much. + rubberband = FixedMul(rubberband, player->mo->movefactor); + } + if (rubberband > FRACUNIT) { rubberband = FRACUNIT; @@ -1657,7 +1669,7 @@ static void K_BuildBotTiccmdNormal(const player_t *player, ticcmd_t *cmd) if (P_IsObjectOnGround(player->mo) == false) { - if (player->fastfall == 0) + if (player->fastfall == 0 && player->respawn.state == RESPAWNST_NONE) { if (botController != nullptr && (botController->flags & TMBOT_FASTFALL) == TMBOT_FASTFALL) { diff --git a/src/k_botitem.cpp b/src/k_botitem.cpp index 9aa7e39d7..a08fbb53b 100644 --- a/src/k_botitem.cpp +++ b/src/k_botitem.cpp @@ -1448,7 +1448,7 @@ static void K_BotItemRings(const player_t *player, ticcmd_t *cmd) return; } - if (player->speed < K_GetKartSpeed(player, false, true) / 2 // Being slowed down too much + if (player->speed < (K_GetKartSpeed(player, false, true) * 9) / 10 // Being slowed down too much || player->speedboost > (FRACUNIT/5)) // Have another type of boost (tethering) { saferingsval -= 5; diff --git a/src/k_kart.c b/src/k_kart.c index bbccc5d1c..b233bd9fb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -11758,17 +11758,19 @@ fixed_t K_PlayerBaseFriction(const player_t *player, fixed_t original) } else if (K_PlayerUsesBotMovement(player) == true) { + const fixed_t speedPercent = min(FRACUNIT, FixedDiv(player->speed, K_GetKartSpeed(player, false, false))); + const fixed_t extraFriction = FixedMul(FixedMul(FRACUNIT >> 5, factor), speedPercent); + // A bit extra friction to help them without drifting. // Remove this line once they can drift. - frict -= FixedMul(FRACUNIT >> 5, factor); + frict -= extraFriction; // Bots gain more traction as they rubberband. - fixed_t traction_value = FixedMul(player->botvars.rubberband, max(FRACUNIT, K_BotMapModifier())); + const fixed_t traction_value = FixedMul(player->botvars.rubberband, max(FRACUNIT, K_BotMapModifier())); if (traction_value > FRACUNIT) { - const fixed_t extraFriction = FixedMul(FRACUNIT >> 5, factor); - const fixed_t mul = traction_value - FRACUNIT; - frict -= FixedMul(extraFriction, mul); + const fixed_t traction_mul = traction_value - FRACUNIT; + frict -= FixedMul(extraFriction, traction_mul); } } }