Prevent failsafe briefly after taking damage

This commit is contained in:
AJ Martinez 2023-11-04 23:42:26 -07:00
parent 1667ca591e
commit 7ba7e2b076
5 changed files with 16 additions and 1 deletions

View file

@ -902,6 +902,8 @@ struct player_t
UINT8 instaWhipChargeLockout;
UINT8 guardCooldown;
UINT8 preventfailsafe; // Set when taking damage to prevent cheesing eggboxes
UINT8 handtimer;
angle_t besthanddirection;

View file

@ -8243,6 +8243,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->invincibilitytimer && onground == true)
player->invincibilitytimer--;
if (player->preventfailsafe)
player->preventfailsafe--;
if ((player->respawn.state == RESPAWNST_NONE) && player->growshrinktimer != 0)
{
if (player->growshrinktimer > 0 && onground == true)
@ -10776,7 +10779,8 @@ static void K_AirFailsafe(player_t *player)
const fixed_t thrustSpeed = 6*player->mo->scale; // 10*player->mo->scale
if (player->speed > maxSpeed // Above the max speed that you're allowed to use this technique.
|| player->respawn.state != RESPAWNST_NONE) // Respawning, you don't need this AND drop dash :V
|| player->respawn.state != RESPAWNST_NONE // Respawning, you don't need this AND drop dash :V
|| player->preventfailsafe) // You just got hit or interacted with something committal, no mashing for distance
{
player->pflags &= ~PF_AIRFAILSAFE;
return;

View file

@ -337,6 +337,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->instaWhipCooldown);
else if (fastcmp(field,"guardCooldown"))
lua_pushinteger(L, plr->guardCooldown);
else if (fastcmp(field,"preventfailsafe"))
lua_pushinteger(L, plr->preventfailsafe);
/*
else if (fastcmp(field,"itemroulette"))
lua_pushinteger(L, plr->itemroulette);
@ -819,6 +821,8 @@ static int player_set(lua_State *L)
plr->instaWhipCharge = luaL_checkinteger(L, 3);
else if (fastcmp(field,"guardCooldown"))
plr->guardCooldown = luaL_checkinteger(L, 3);
else if (fastcmp(field,"preventfailsafe"))
plr->preventfailsafe = luaL_checkinteger(L, 3);
/*
else if (fastcmp(field,"itemroulette"))
plr->itemroulette = luaL_checkinteger(L, 3);

View file

@ -2996,6 +2996,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
player->fastfall = 0;
player->ringboost = 0;
player->glanceDir = 0;
player->preventfailsafe = TICRATE*3;
player->pflags &= ~PF_GAINAX;
if (player->spectator == false && !(player->charflags & SF_IRONMAN))

View file

@ -547,6 +547,8 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].instaWhipCooldown);
WRITEUINT8(save->p, players[i].guardCooldown);
WRITEUINT8(save->p, players[i].preventfailsafe);
WRITEUINT8(save->p, players[i].handtimer);
WRITEANGLE(save->p, players[i].besthanddirection);
@ -1061,6 +1063,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].instaWhipCooldown = READUINT8(save->p);
players[i].guardCooldown = READUINT8(save->p);
players[i].preventfailsafe = READUINT8(save->p);
players[i].handtimer = READUINT8(save->p);
players[i].besthanddirection = READANGLE(save->p);