Merge branch 'aerial-boost-shenanigans' into 'master'

Tripwire leniency decreases at 1/5x speed in the air

See merge request kart-krew-dev/ring-racers-internal!2656
This commit is contained in:
Oni VelocitOni 2025-07-01 19:39:39 +00:00
commit bb9d461aca
4 changed files with 34 additions and 3 deletions

View file

@ -791,6 +791,7 @@ struct player_t
UINT8 tripwireState; // see tripwirestate_t
UINT8 tripwirePass; // see tripwirepass_t
UINT16 tripwireLeniency; // When reaching a state that lets you go thru tripwire, you get an extra second leniency after it ends to still go through it.
UINT8 tripwireAirLeniency; // Timer that elongates tripwire leniency when in midair.
UINT8 fakeBoost; // Some items need to grant tripwire pass briefly, even when their effect is thrust/instathrust. This is a fake boost type to control that.
itemroulette_t itemRoulette; // Item roulette data

View file

@ -9295,19 +9295,43 @@ static void K_UpdateTripwire(player_t *player)
// so that stripping Garden Top feels consistent.
if (triplevel == TRIPWIRE_NONE || triplevel == TRIPWIRE_CONSUME)
{
// Peek at the relevant values:
/*
if (player->airtime == 0)
CONS_Printf("airtime: , twLen: %d, twAirLen: %d\n", player->tripwireLeniency, player->tripwireAirLeniency);
else
CONS_Printf("airtime: %d, twLen: %d, twAirLen: %d\n", player->airtime, player->tripwireLeniency, player->tripwireAirLeniency);
*/
if (boostExists)
{
player->tripwireLeniency--;
if (goodSpeed == false && player->tripwireLeniency > 0)
// If player is MOSTLY on the ground.
// Takes 3 tics to be considered midair, because midair leniency is NOT meant for twerking
if (player->airtime < 3)
{
// Decrease at double speed when your speed is bad.
player->tripwireLeniency--;
if (goodSpeed == false && player->tripwireLeniency > 0)
{
// Decrease at double speed when your speed is bad.
player->tripwireLeniency--;
}
}
// ...Until they're NOT, in which case tripwire leniency is reduced at a decimal rate!
else
{
player->tripwireAirLeniency++;
if (player->tripwireAirLeniency >= 5) // Once every 5 tics
{
player->tripwireAirLeniency = 0;
player->tripwireLeniency--;
}
}
}
if (player->tripwireLeniency <= 0 && triplevel == TRIPWIRE_NONE)
{
player->tripwirePass = TRIPWIRE_NONE;
player->tripwireAirLeniency = 0;
}
}
}

View file

@ -378,6 +378,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->fakeBoost);
else if (fastcmp(field,"tripwireleniency"))
lua_pushinteger(L, plr->tripwireLeniency);
else if (fastcmp(field,"tripwireairleniency"))
lua_pushinteger(L, plr->tripwireAirLeniency);
else if (fastcmp(field,"tripwirerebounddelay"))
lua_pushinteger(L, plr->tripwireReboundDelay);
else if (fastcmp(field,"eggmantransferdelay"))
@ -1021,6 +1023,8 @@ static int player_set(lua_State *L)
plr->fakeBoost = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tripwireleniency"))
plr->tripwireLeniency = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tripwireairleniency"))
plr->tripwireAirLeniency = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tripwirerebounddelay"))
plr->tripwireReboundDelay = luaL_checkinteger(L, 3);
else if (fastcmp(field,"eggmantransferdelay"))

View file

@ -520,6 +520,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].tripwireState);
WRITEUINT8(save->p, players[i].tripwirePass);
WRITEUINT16(save->p, players[i].tripwireLeniency);
WRITEUINT8(save->p, players[i].tripwireAirLeniency);
WRITEUINT8(save->p, players[i].fakeBoost);
WRITESINT8(save->p, players[i].itemtype);
@ -1182,6 +1183,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].tripwireState = READUINT8(save->p);
players[i].tripwirePass = READUINT8(save->p);
players[i].tripwireLeniency = READUINT16(save->p);
players[i].tripwireAirLeniency = READUINT8(save->p);
players[i].fakeBoost = READUINT8(save->p);
players[i].itemtype = READSINT8(save->p);