mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-01 20:52:47 +00:00
Merge branch 'nerf-bumper-car-bots' into 'master'
Nerf bumper car bots See merge request kart-krew-dev/ring-racers-internal!2533
This commit is contained in:
commit
52d39aeae2
7 changed files with 26 additions and 1 deletions
|
|
@ -407,6 +407,7 @@ struct botvars_t
|
|||
// All entries above persist between rounds and must be recorded in demos
|
||||
|
||||
fixed_t rubberband; // Bot rubberband value
|
||||
UINT8 bumpslow;
|
||||
|
||||
tic_t itemdelay; // Delay before using item at all
|
||||
tic_t itemconfirm; // When high enough, they will use their item
|
||||
|
|
|
|||
|
|
@ -803,8 +803,13 @@ fixed_t K_UpdateRubberband(player_t *player)
|
|||
fixed_t dest = K_BotRubberband(player);
|
||||
fixed_t ret = player->botvars.rubberband;
|
||||
|
||||
UINT8 ease_soften = 8;
|
||||
|
||||
if (player->botvars.bumpslow && dest > ret)
|
||||
ease_soften *= 10;
|
||||
|
||||
// Ease into the new value.
|
||||
ret += (dest - player->botvars.rubberband) / 8;
|
||||
ret += (dest - player->botvars.rubberband) / ease_soften;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
12
src/k_kart.c
12
src/k_kart.c
|
|
@ -9494,6 +9494,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
if (player->trickboost)
|
||||
player->trickboost--;
|
||||
|
||||
if (K_PlayerUsesBotMovement(players) && player->botvars.bumpslow && player->incontrol)
|
||||
player->botvars.bumpslow--;
|
||||
|
||||
if (player->flamedash)
|
||||
{
|
||||
player->flamedash--;
|
||||
|
|
@ -15514,6 +15517,15 @@ UINT32 K_GetNumGradingPoints(void)
|
|||
return numlaps * (1 + Obj_GetCheckpointCount());
|
||||
}
|
||||
|
||||
void K_BotHitPenalty(player_t *player)
|
||||
{
|
||||
if (K_PlayerUsesBotMovement(player))
|
||||
{
|
||||
player->botvars.rubberband = max(player->botvars.rubberband/2, FRACUNIT/2);
|
||||
player->botvars.bumpslow = TICRATE*2;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean K_PickUp(player_t *player, mobj_t *picked)
|
||||
{
|
||||
SINT8 type = -1;
|
||||
|
|
|
|||
|
|
@ -314,6 +314,8 @@ UINT16 K_GetDisplayEXP(player_t *player);
|
|||
|
||||
UINT32 K_GetNumGradingPoints(void);
|
||||
|
||||
void K_BotHitPenalty(player_t *player);
|
||||
|
||||
boolean K_TryPickMeUp(mobj_t *m1, mobj_t *m2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -3204,6 +3204,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
if (source && source != player->mo && source->player)
|
||||
{
|
||||
K_SpawnAmps(source->player, K_PvPAmpReward((type == DMG_WHUMBLE) ? 30 : 20, source->player, player), target);
|
||||
K_BotHitPenalty(player);
|
||||
|
||||
// Extend the invincibility if the hit was a direct hit.
|
||||
if (inflictor == source && source->player->invincibilitytimer &&
|
||||
|
|
|
|||
|
|
@ -4118,6 +4118,8 @@ static void P_BouncePlayerMove(mobj_t *mo, TryMoveResult_t *result)
|
|||
if (mo->player)
|
||||
mo->player->bumpUnstuck += 5;
|
||||
|
||||
K_BotHitPenalty(mo->player);
|
||||
|
||||
// Combo avoidance!
|
||||
if (mo->player && P_PlayerInPain(mo->player) && gametyperules & GTR_BUMPERS && mo->health == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -737,6 +737,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
|||
WRITEUINT8(save->p, players[i].botvars.diffincrease);
|
||||
WRITEUINT8(save->p, players[i].botvars.rival);
|
||||
WRITEFIXED(save->p, players[i].botvars.rubberband);
|
||||
WRITEUINT8(save->p, players[i].botvars.bumpslow);
|
||||
WRITEUINT32(save->p, players[i].botvars.itemdelay);
|
||||
WRITEUINT32(save->p, players[i].botvars.itemconfirm);
|
||||
WRITESINT8(save->p, players[i].botvars.turnconfirm);
|
||||
|
|
@ -1380,6 +1381,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
|||
players[i].botvars.diffincrease = READUINT8(save->p);
|
||||
players[i].botvars.rival = (boolean)READUINT8(save->p);
|
||||
players[i].botvars.rubberband = READFIXED(save->p);
|
||||
players[i].botvars.bumpslow = READUINT8(save->p);
|
||||
players[i].botvars.itemdelay = READUINT32(save->p);
|
||||
players[i].botvars.itemconfirm = READUINT32(save->p);
|
||||
players[i].botvars.turnconfirm = READSINT8(save->p);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue