Merge branch 'bots-disable-no-ring-shooter' into 'master'

No Ring Shooter in disable controls bot controller

See merge request KartKrew/Kart!1774
This commit is contained in:
Sal 2024-01-04 11:02:01 +00:00
commit 6a241772fc

View file

@ -1066,17 +1066,18 @@ static UINT8 K_TrySpindash(const player_t *player, ticcmd_t *cmd)
}
/*--------------------------------------------------
static boolean K_TryRingShooter(const player_t *player)
static boolean K_TryRingShooter(const player_t *player, const botcontroller_t *botController)
Determines conditions where the bot should attempt to respawn.
Input Arguments:-
player - Bot player to check.
botController - Bot controller struct, if it exists.
Return:-
true if we want to hold the respawn button, otherwise false.
--------------------------------------------------*/
static boolean K_TryRingShooter(const player_t *player)
static boolean K_TryRingShooter(const player_t *player, const botcontroller_t *botController)
{
ZoneScoped;
@ -1098,6 +1099,12 @@ static boolean K_TryRingShooter(const player_t *player)
return false;
}
if (botController != nullptr && (botController->flags & TMBOT_NOCONTROL) == TMBOT_NOCONTROL)
{
// Bot controls are disabled, so WANT to sit still.
return false;
}
return true;
}
@ -1618,7 +1625,7 @@ static void K_BuildBotTiccmdNormal(const player_t *player, ticcmd_t *cmd)
return;
}
if (K_TryRingShooter(player) == true && player->botvars.respawnconfirm >= BOTRESPAWNCONFIRM)
if (K_TryRingShooter(player, botController) == true && player->botvars.respawnconfirm >= BOTRESPAWNCONFIRM)
{
// We want to respawn. Simply hold Y and stop here!
cmd->buttons |= (BT_RESPAWN | BT_EBRAKEMASK);
@ -1941,7 +1948,8 @@ void K_UpdateBotGameplayVars(player_t *player)
}
}
if (K_TryRingShooter(player) == true)
const botcontroller_t *botController = K_GetBotController(player->mo);
if (K_TryRingShooter(player, botController) == true)
{
// Our anti-grief system is already a perfect system
// for determining if we're not making progress, so