TraceAttack: Add case for when a weapon with a penetrationpower of 2 might have a fall-off.

This commit is contained in:
Marco Cawthorne 2022-04-24 17:24:49 -07:00
parent e80cd05ef8
commit 659be3db46
Signed by: eukara
GPG Key ID: C196CD8BA993248A
1 changed files with 11 additions and 1 deletions

View File

@ -140,11 +140,21 @@ TraceAttack_FireSingle(vector vecPos, vector vAngle, int iDamage, int iWeapon, f
#ifdef BULLETPENETRATION
if (iTotalPenetrations > 0) {
float cont;
if (!(trace_surfaceflagsi & SURF_PENETRATE))
iTotalPenetrations -= 1;
float cont = pointcontents(trace_endpos + v_forward * g_pen_flMaxThickness);
/* check if this wall is 6 units thick... */
if (iTotalPenetrations > 0) {
cont = pointcontents(trace_endpos + v_forward * 5);
if (cont == CONTENT_SOLID)
iTotalPenetrations -= 1; /* deduct 1 penetration power */
}
cont = pointcontents(trace_endpos + v_forward * g_pen_flMaxThickness);
if (cont == CONTENT_EMPTY)
TraceAttack_FireSingle(trace_endpos + (v_forward * 2), vAngle, iDamage / 2, iWeapon, dist);
}