Allow bots to stack sneakers
When stacking is on bots will attempt to stack them together. Their timing is based on their difficulty, less skilled bots are more wasteful while better bots are less wasteful. Also adjusts Rocket sneakers to also use this logic.
This commit is contained in:
parent
21cab921fa
commit
f18dee3db7
1 changed files with 26 additions and 5 deletions
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <tracy/tracy/Tracy.hpp>
|
||||
|
||||
#include "d_netcmd.h"
|
||||
#include "doomdef.h"
|
||||
#include "d_player.h"
|
||||
#include "g_game.h"
|
||||
|
|
@ -414,6 +415,15 @@ static void K_BotItemGenericOrbitShield(botdata_t *bd, const player_t *player)
|
|||
K_BotGenericPressItem(bd, 0);
|
||||
}
|
||||
|
||||
// Less skilled bots stack wastefully, low enough bots don't stack at all.
|
||||
static SINT8 K_BotSneakerStackThreshold(SINT8 difficulty)
|
||||
{
|
||||
if (difficulty < 5)
|
||||
return 0;
|
||||
|
||||
return 10 - ((difficulty-1)*5) / 13 + 1;
|
||||
}
|
||||
|
||||
// Item usage for sneakers.
|
||||
static void K_BotItemSneaker(botdata_t *bd, const player_t *player)
|
||||
{
|
||||
|
|
@ -425,13 +435,17 @@ static void K_BotItemSneaker(botdata_t *bd, const player_t *player)
|
|||
return;
|
||||
}
|
||||
|
||||
boolean stack = K_StackingActive() && (cv_kartstacking_sneaker_maxgrade.value > 1);
|
||||
const SINT8 stacktime = K_BotSneakerStackThreshold(player->botvars.difficulty);
|
||||
|
||||
if ((player->offroad && K_ApplyOffroad(player)) // Stuck in offroad, use it NOW
|
||||
|| K_GetWaypointIsShortcut(player->nextwaypoint) == true // Going toward a shortcut!
|
||||
|| player->speed < K_GetKartSpeed(player, false, true) / 2 // Being slowed down too much
|
||||
|| player->speedboost > (FRACUNIT/8) // Have another type of boost (tethering)
|
||||
|| (!stack && player->speedboost > (FRACUNIT/8)) // Have another type of boost (drafting)
|
||||
|| (stack && player->sneakertimer < stacktime && player->sneakertimer > 0) // Stack them sneakers!
|
||||
|| bd->itemconfirm > 4*TICRATE) // Held onto it for too long
|
||||
{
|
||||
if (player->sneakertimer == 0 && !bd->itemwasdown)
|
||||
if (((stack && player->sneakertimer < stacktime) || player->sneakertimer == 0) && !bd->itemwasdown)
|
||||
{
|
||||
bd->itemdown = true;
|
||||
//bd->itemconfirm = 2*TICRATE;
|
||||
|
|
@ -456,10 +470,17 @@ static void K_BotItemRocketSneaker(botdata_t *bd, const player_t *player)
|
|||
|
||||
if (bd->itemconfirm > TICRATE)
|
||||
{
|
||||
if (player->sneakertimer == 0 && !bd->itemwasdown)
|
||||
if (player->sneakertimer > 0 && K_StackingActive())
|
||||
{
|
||||
bd->itemdown = true;
|
||||
//bd->itemconfirm = 0;
|
||||
K_BotItemSneaker(bd, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->sneakertimer == 0 && !bd->itemwasdown)
|
||||
{
|
||||
bd->itemdown = true;
|
||||
//bd->itemconfirm = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue