Let flame shield punt hazards

This commit is contained in:
GenericHeroGuy 2025-10-13 21:41:48 +02:00
parent 1736fa10a9
commit aa64b9aeed
5 changed files with 23 additions and 9 deletions

View file

@ -2060,6 +2060,12 @@ boolean K_TripwirePass(const player_t *player)
return (player->tripwirePass != TRIPWIRE_NONE);
}
boolean K_PlayerCanPunt(const player_t *player)
{
return player->invincibilitytimer > 0 || player->growshrinktimer > 0 ||
(player->flamestore > 0 && K_GetShieldFromPlayer(player) == KSHIELD_FLAME);
}
// Safe guard cvars to prevent cheating in RA.
INT32 K_RAGuard(consvar_t cvar)
{

View file

@ -279,6 +279,7 @@ boolean K_ApplyOffroad(const player_t *player);
fixed_t K_PlayerTripwireSpeedThreshold(const player_t *player);
tripwirepass_t K_TripwirePassConditions(const player_t *player);
boolean K_TripwirePass(const player_t *player);
boolean K_PlayerCanPunt(const player_t *player);
boolean K_WaterRun(mobj_t *mobj);
void K_SpawnWaterTrail(mobj_t *mobj);
boolean K_ItemMobjAllowedtoWaterRun(mobj_t *item);

View file

@ -4388,6 +4388,17 @@ static int lib_kGetShieldFromPlayer(lua_State *L)
return 1;
}
static int lib_kPlayerCanPunt(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
//HUDSAFE
if (!player)
return LUA_ErrInvalid(L, "player_t");
lua_pushboolean(L, K_PlayerCanPunt(player));
return 1;
}
static int lib_kAddNewScoreboardMod(lua_State *L)
{
const char *modname = luaL_checkstring(L, 1);
@ -5322,6 +5333,7 @@ static luaL_Reg lib[] = {
{"K_AwardPlayerRings", lib_kAwardPlayerRings},
{"K_AwardScaledPlayerRings", lib_kAwardScaledPlayerRings},
{"K_GetShieldFromPlayer", lib_kGetShieldFromPlayer},
{"K_PlayerCanPunt", lib_kPlayerCanPunt},
// k_hud
{"K_AddNewScoreboardMod", lib_kAddNewScoreboardMod},

View file

@ -573,9 +573,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
return;
// kill
if (player->invincibilitytimer > 0
|| player->growshrinktimer > 0
|| player->flamestore > 0)
if (K_PlayerCanPunt(player))
{
P_KillMobj(special, toucher, toucher, DMG_NORMAL);
return;

View file

@ -1208,8 +1208,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
if (!thing->health)
return BMIT_CONTINUE; // dead
if (g_tm.thing->player->invincibilitytimer > 0
|| g_tm.thing->player->growshrinktimer > 0)
if (K_PlayerCanPunt(g_tm.thing->player))
{
if (thing->type == MT_BLUEROBRA_JOINT)
P_KillMobj(thing->target, g_tm.thing, g_tm.thing, DMG_NORMAL);
@ -1234,8 +1233,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
if (!thing->health)
return BMIT_CONTINUE; // dead
if (g_tm.thing->player->invincibilitytimer > 0
|| g_tm.thing->player->growshrinktimer > 0)
if (K_PlayerCanPunt(g_tm.thing->player))
{
P_KillMobj(thing, g_tm.thing, g_tm.thing, DMG_NORMAL);
return BMIT_CONTINUE; // kill
@ -1265,8 +1263,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
return BMIT_CONTINUE; // underneath
// kill
if (g_tm.thing->player->invincibilitytimer > 0
|| g_tm.thing->player->growshrinktimer > 0)
if (K_PlayerCanPunt(g_tm.thing->player))
{
P_KillMobj(thing, g_tm.thing, g_tm.thing, DMG_NORMAL);
return BMIT_CONTINUE;