DoKnockback/DoExplosion: Reduce momentum transfer for crouching targets.

This commit is contained in:
Mari the Deer 2024-01-17 12:39:00 +01:00
commit 751215c5d3
2 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1089 \cu(Tue 16 Jan 10:41:48 CET 2024)\c-";
SWWM_SHORTVER="\cw1.3pre r1089 \cu(2024-01-16 10:41:48)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1090 \cu(Wed 17 Jan 12:39:00 CET 2024)\c-";
SWWM_SHORTVER="\cw1.3pre r1090 \cu(2024-01-17 12:39:00)\c-";

View file

@ -30,6 +30,9 @@ extend Class SWWMUtility
return;
if ( Victim.bDONTTHRUST || (Victim.Mass >= Actor.LARGE_MASS) )
return;
// crouching reduces knockback
if ( (Victim.Height < Victim.default.Height) && (Victim.default.Height != 0.) )
MomentumTransfer *= Victim.Height/Victim.default.Height;
Vector3 Momentum = HitDirection*MomentumTransfer;
if ( (Victim.pos.z <= Victim.floorz) || !Victim.TestMobjZ() )
Momentum.z = max(Momentum.z,(ExtraZThrust?.4:.1)*Momentum.length());
@ -130,6 +133,9 @@ extend Class SWWMUtility
// no knockback if massive/unpushable
if ( (abs(mm) > 0.) && !a.bDORMANT && !a.bDONTTHRUST && (a.Mass < Actor.LARGE_MASS) )
{
// crouching reduces knockback
if ( (a.Height < a.default.Height) && (a.default.Height != 0.) )
mm *= a.Height/a.default.Height;
Vector3 Momentum = dir*mm;
if ( (a.pos.z <= a.floorz) || !a.TestMobjZ() )
Momentum.z = max(Momentum.z,(flags&DE_EXTRAZTHRUST?.4:.1)*Momentum.length());