Fixed zombie serverside ragdoll gibs crashing when one of the models isn't valid

This commit is contained in:
Blixibon 2022-05-04 20:52:21 -05:00
parent ad4adf90ca
commit 39ec4ee704

View File

@ -2354,6 +2354,8 @@ void CNPC_BaseZombie::BecomeTorso( const Vector &vecTorsoForce, const Vector &ve
if ( m_bForceServerRagdoll )
{
pGib = CreateServerRagdollSubmodel( this, GetLegsModel(), GetAbsOrigin() - Vector(0, 0, 40), GetAbsAngles(), COLLISION_GROUP_INTERACTIVE_DEBRIS );
if (pGib && pGib->VPhysicsGetObject())
{
pGib->VPhysicsGetObject()->AddVelocity( &vecLegsForce, NULL );
if (flFadeTime > 0.0)
@ -2361,6 +2363,7 @@ void CNPC_BaseZombie::BecomeTorso( const Vector &vecTorsoForce, const Vector &ve
pGib->SUB_StartFadeOut( flFadeTime, false );
}
}
}
else
pGib = CreateRagGib( GetLegsModel(), GetAbsOrigin() - Vector(0, 0, 40), GetAbsAngles(), vecLegsForce, flFadeTime );
#else
@ -2506,12 +2509,15 @@ void CNPC_BaseZombie::ReleaseHeadcrab( const Vector &vecOrigin, const Vector &ve
if ( m_bForceServerRagdoll )
{
pGib = CreateServerRagdollSubmodel( this, GetHeadcrabModel(), vecOrigin, GetLocalAngles(), COLLISION_GROUP_INTERACTIVE_DEBRIS );
if (pGib && pGib->VPhysicsGetObject())
{
pGib->VPhysicsGetObject()->AddVelocity(&vecVelocity, NULL);
if (ShouldIgniteZombieGib())
static_cast<CBaseAnimating*>(pGib)->Ignite( random->RandomFloat( 8.0, 12.0 ), false );
pGib->SUB_StartFadeOut( 15, false );
}
}
else
pGib = CreateRagGib( GetHeadcrabModel(), vecOrigin, GetLocalAngles(), vecVelocity, 15, ShouldIgniteZombieGib() );
#else