Tripwire leniency

1 full second after entering a tripwire state, you can still go through tripwires
This commit is contained in:
Sally Coolatta 2022-05-08 01:03:11 -04:00
parent c0830d1ddc
commit 9ab0e028d4
6 changed files with 28 additions and 2 deletions

View file

@ -437,6 +437,8 @@ typedef struct player_s
UINT16 draftleeway; // Leniency timer before removing draft power
SINT8 lastdraft; // (-1 to 15) - Last player being drafted
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.
UINT16 itemroulette; // Used for the roulette when deciding what item to give you (was "pw_kartitem")
UINT8 roulettetype; // Used for the roulette, for deciding type (0 = normal, 1 = better, 2 = eggman mark)

View file

@ -279,7 +279,7 @@ boolean K_BotCanTakeCut(player_t *player)
{
if (
#if 1
K_TripwirePass(player) == true
K_TripwirePassConditions(player) == true
#else
K_ApplyOffroad(player) == false
#endif

View file

@ -2742,7 +2742,7 @@ boolean K_SlopeResistance(player_t *player)
return false;
}
boolean K_TripwirePass(player_t *player)
boolean K_TripwirePassConditions(player_t *player)
{
if (
player->invincibilitytimer ||
@ -2755,6 +2755,11 @@ boolean K_TripwirePass(player_t *player)
return false;
}
boolean K_TripwirePass(player_t *player)
{
return (K_TripwirePassConditions(player) || (player->tripwireLeniency > 0));
}
boolean K_WaterRun(player_t *player)
{
if (
@ -7307,6 +7312,16 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
K_HandleTumbleBounce(player);
}
if (player->tripwireLeniency > 0)
{
player->tripwireLeniency--;
}
if (K_TripwirePassConditions(player) == true)
{
player->tripwireLeniency = max(player->tripwireLeniency, TICRATE);
}
K_KartPlayerHUDUpdate(player);
if (battleovertime.enabled && !(player->pflags & PF_ELIMINATED) && player->bumpers <= 0 && player->karmadelay <= 0)

View file

@ -116,6 +116,7 @@ void K_StripOther(player_t *player);
void K_MomentumToFacing(player_t *player);
boolean K_ApplyOffroad(player_t *player);
boolean K_SlopeResistance(player_t *player);
boolean K_TripwirePassConditions(player_t *player);
boolean K_TripwirePass(player_t *player);
boolean K_WaterRun(player_t *player);
void K_ApplyTripWire(player_t *player, tripwirestate_t state);

View file

@ -288,6 +288,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->draftleeway);
else if (fastcmp(field,"lastdraft"))
lua_pushinteger(L, plr->lastdraft);
else if (fastcmp(field,"tripwireLeniency"))
lua_pushinteger(L, plr->tripwireLeniency);
else if (fastcmp(field,"itemroulette"))
lua_pushinteger(L, plr->itemroulette);
else if (fastcmp(field,"roulettetype"))
@ -630,6 +632,8 @@ static int player_set(lua_State *L)
plr->draftleeway = luaL_checkinteger(L, 3);
else if (fastcmp(field,"lastdraft"))
plr->lastdraft = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tripwireLeniency"))
plr->tripwireLeniency = luaL_checkinteger(L, 3);
else if (fastcmp(field,"itemroulette"))
plr->itemroulette = luaL_checkinteger(L, 3);
else if (fastcmp(field,"roulettetype"))

View file

@ -278,6 +278,8 @@ static void P_NetArchivePlayers(void)
WRITEUINT16(save_p, players[i].draftleeway);
WRITESINT8(save_p, players[i].lastdraft);
WRITEUINT16(save_p, players[i].tripwireLeniency);
WRITEUINT16(save_p, players[i].itemroulette);
WRITEUINT8(save_p, players[i].roulettetype);
@ -546,6 +548,8 @@ static void P_NetUnArchivePlayers(void)
players[i].draftleeway = READUINT16(save_p);
players[i].lastdraft = READSINT8(save_p);
players[i].tripwireLeniency = READUINT16(save_p);
players[i].itemroulette = READUINT16(save_p);
players[i].roulettetype = READUINT8(save_p);