Briefly lock out TRIPWIRE_BLASTER after failing a tripwire

This commit is contained in:
AJ Martinez 2023-02-24 00:30:21 -07:00 committed by NepDisk
parent 899b6e2ce5
commit 87d5eb6267
4 changed files with 18 additions and 1 deletions

View file

@ -417,6 +417,7 @@ typedef struct player_s
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 tripwireReboundDelay; // When failing Tripwire, brieftly lock out speed-based tripwire pass (anti-cheese)
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

@ -2688,7 +2688,7 @@ tripwirepass_t K_TripwirePassConditions(player_t *player)
if (
player->flamedash ||
player->speed > 2 * K_GetKartSpeed(player, false, false)
(player->speed > 2 * K_GetKartSpeed(player, false, false) && player->tripwireReboundDelay == 0)
)
return TRIPWIRE_BOOST;
@ -3297,10 +3297,17 @@ void K_SquishPlayer(player_t *player, mobj_t *inflictor, mobj_t *source)
void K_ApplyTripWire(player_t *player, tripwirestate_t state)
{
// We are either softlocked or wildly misbehaving. Stop that!
if (state == TRIPSTATE_BLOCKED && player->tripwireReboundDelay && (player->speed > 5 * K_GetKartSpeed(player, false, false)))
P_DamageMobj(player->mo, NULL, NULL, 1, DMG_STING);
if (state == TRIPSTATE_PASSED)
S_StartSound(player->mo, sfx_ssa015);
else if (state == TRIPSTATE_BLOCKED)
{
S_StartSound(player->mo, sfx_kc40);
player->tripwireReboundDelay = 60;
}
player->tripwireState = state;
}
@ -6722,6 +6729,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
player->pogospring = 0;
}
if (player->tripwireReboundDelay)
player->tripwireReboundDelay--;
if (player->ringdelay)
player->ringdelay--;

View file

@ -282,6 +282,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->tripwirePass);
else if (fastcmp(field,"tripwireLeniency"))
lua_pushinteger(L, plr->tripwireLeniency);
else if (fastcmp(field,"tripwireReboundDelay"))
lua_pushinteger(L, plr->tripwireReboundDelay);
else if (fastcmp(field,"itemroulette"))
lua_pushinteger(L, plr->itemroulette);
else if (fastcmp(field,"roulettetype"))
@ -634,6 +636,8 @@ static int player_set(lua_State *L)
plr->tripwirePass = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tripwireLeniency"))
plr->tripwireLeniency = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tripwireReboundDelay"))
plr->tripwireReboundDelay = luaL_checkinteger(L, 3);
else if (fastcmp(field,"itemroulette"))
plr->itemroulette = luaL_checkinteger(L, 3);
else if (fastcmp(field,"roulettetype"))

View file

@ -296,6 +296,7 @@ static void P_NetArchivePlayers(void)
WRITEUINT8(save_p, players[i].tripwireState);
WRITEUINT8(save_p, players[i].tripwirePass);
WRITEUINT16(save_p, players[i].tripwireLeniency);
WRITEUINT8(save_p, players[i].tripwireReboundDelay);
WRITEUINT16(save_p, players[i].itemroulette);
WRITEUINT8(save_p, players[i].roulettetype);
@ -564,6 +565,7 @@ static void P_NetUnArchivePlayers(void)
players[i].tripwireState = READUINT8(save_p);
players[i].tripwirePass = READUINT8(save_p);
players[i].tripwireLeniency = READUINT16(save_p);
players[i].tripwireReboundDelay = READUINT8(save_p);
players[i].itemroulette = READUINT16(save_p);
players[i].roulettetype = READUINT8(save_p);