Added model instance snatching for serverside ragdolls (retains decals)

This commit is contained in:
Blixibon 2021-09-24 00:26:51 -05:00
parent 8341a65a89
commit f11d7e0be8

View File

@ -487,6 +487,9 @@ int C_ServerRagdoll::InternalDrawModel( int flags )
return ret;
}
#ifdef MAPBASE
static ConVar g_ragdoll_server_snatch_instance( "g_ragdoll_server_snatch_instance", "1", FCVAR_NONE, "Allows serverside ragdolls to snatch their source entities' model instances in the same way clientside ragdolls do, thereby retaining decals." );
#endif
CStudioHdr *C_ServerRagdoll::OnNewModel( void )
{
@ -509,6 +512,26 @@ CStudioHdr *C_ServerRagdoll::OnNewModel( void )
m_iv_ragAngles.SetMaxCount( m_elementCount );
}
#ifdef MAPBASE
if ( GetOwnerEntity() )
{
if (GetOwnerEntity()->GetModelName() == GetModelName())
{
// TODO: Is there a better place for this?
if (GetOwnerEntity()->GetBaseAnimating())
GetOwnerEntity()->GetBaseAnimating()->m_pServerRagdoll = this;
if (g_ragdoll_server_snatch_instance.GetBool())
{
GetOwnerEntity()->SnatchModelInstance( this );
}
}
}
// Add server ragdolls to the creation tick list
NoteRagdollCreationTick( this );
#endif
return hdr;
}