mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-04 04:36:21 +00:00
Tripwire leniency decreases at 1/5x speed in the air
For ramps into tripwires... I think?
This commit is contained in:
parent
4a8723bba4
commit
36d85624c0
4 changed files with 27 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
23
src/k_kart.c
23
src/k_kart.c
|
|
@ -9297,17 +9297,34 @@ static void K_UpdateTripwire(player_t *player)
|
|||
{
|
||||
if (boostExists)
|
||||
{
|
||||
player->tripwireLeniency--;
|
||||
if (goodSpeed == false && player->tripwireLeniency > 0)
|
||||
// If player is MOSTLY on the ground.
|
||||
// Arbitrary number based on other code that claimed the player is often
|
||||
// slightly aerial in ground-to-ground transitions and other such edge cases.
|
||||
if (player->airtime < 2)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue