diff --git a/src/d_player.h b/src/d_player.h index cc176671c..8eba378ff 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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; diff --git a/src/k_kart.c b/src/k_kart.c index 088421b2b..b3b0956a4 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8250,6 +8250,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) @@ -10783,7 +10786,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; @@ -10793,9 +10797,12 @@ static void K_AirFailsafe(player_t *player) if (leveltime < introtime) return; - if ((K_GetKartButtons(player) & BT_ACCELERATE) || K_GetForwardMove(player) != 0) + UINT8 buttons = K_GetKartButtons(player); + + // Accel inputs queue air-failsafe for when they're released, + // as long as they're not part of a fastfall attempt. + if ((buttons & (BT_ACCELERATE|BT_BRAKE)) == BT_ACCELERATE || K_GetForwardMove(player) != 0) { - // Queue up later player->pflags |= PF_AIRFAILSAFE; return; } diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 6fe1e325d..7cd2ef130 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -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); diff --git a/src/p_inter.c b/src/p_inter.c index f3b66694d..e5feda38a 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3046,6 +3046,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)) diff --git a/src/p_saveg.c b/src/p_saveg.c index a1c3d1f64..1325c7440 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -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);