From 411fa4a6d843a35a7ffa4cce206d1b700aefd921 Mon Sep 17 00:00:00 2001 From: SteelT Date: Tue, 6 Apr 2021 23:41:54 -0400 Subject: [PATCH] Only extend the invinc time for the player if the hit was direct --- src/p_inter.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index c46d44d4f..5077ef366 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1399,7 +1399,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget else { flingAngle = target->angle + ANGLE_180; - + if (P_RandomByte() & 1) { flingAngle -= ANGLE_45; @@ -1982,10 +1982,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (source && source != player->mo && source->player) { - if (source->player->kartstuff[k_invincibilitytimer]) + // Extend the invincibility if the hit was a direct hit. + if (inflictor == source && source->player->kartstuff[k_invincibilitytimer]) { kinvextend = (source->player->kartstuff[k_invincibilitytimer])+5*TICRATE; - CONS_Printf("extend k_invincibilitytimer for %s - old value %d new value %d\n", player_names[source->player - players], source->player->kartstuff[k_invincibilitytimer]/TICRATE, kinvextend/TICRATE); + //CONS_Printf("extend k_invincibilitytimer for %s - old value %d new value %d\n", player_names[source->player - players], source->player->kartstuff[k_invincibilitytimer]/TICRATE, kinvextend/TICRATE); source->player->kartstuff[k_invincibilitytimer] = kinvextend; }