FX_Corpse: transfer player bbox to corpse, so we can handle crouching etc.

This commit is contained in:
Marco Cawthorne 2024-03-06 19:09:40 -08:00
parent 153a711955
commit 42f7c82029
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
2 changed files with 10 additions and 5 deletions

View File

@ -158,7 +158,12 @@ HLMultiplayerRules::PlayerDeath(NSClientPlayer pl)
break;
}
FX_Corpse_Spawn((player)pl, deathAnimation);
NSEntity newCorpse = (NSEntity)FX_Corpse_Spawn((player)pl, deathAnimation);
/* if we were crouching, adjust the bbox (thx 2 lack of crouch death animation) */
if (pl.flags & FL_CROUCHING) {
newCorpse.SetSize(VEC_HULL_MIN, [16, 16, -16]);
}
}
/* now let's make the real client invisible */

View File

@ -58,6 +58,9 @@ entity
FX_Corpse_Spawn(player pl, float anim)
{
NSRenderableEntity body_next = (NSRenderableEntity)FX_Corpse_Next();
body_next.SetMovetype(MOVETYPE_BOUNCE);
body_next.SetSolid(SOLID_CORPSE);
body_next.SetModel(pl.GetModel());
if (pl.flags & FL_CROUCHING) {
body_next.SetOrigin(pl.GetOrigin() + [0,0,32]);
@ -65,10 +68,7 @@ FX_Corpse_Spawn(player pl, float anim)
body_next.SetOrigin(pl.GetOrigin());
}
body_next.SetMovetype(MOVETYPE_BOUNCE);
body_next.SetSolid(SOLID_CORPSE);
body_next.SetModel(pl.GetModel());
body_next.SetSize(VEC_HULL_MIN, [16, 16, -16]);
body_next.SetSize(pl.GetMins(), pl.GetMaxs());
body_next.SetAngles(pl.GetAngles());
body_next.SetVelocity(pl.GetVelocity() + [0,0,120]);
body_next.SetFrame(anim);