//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void C_EntityDissolve::ClientThink( void ) { C_BaseEntity *pEnt = GetMoveParent(); if ( !pEnt ) return; bool bIsRagdoll; #ifdef TF_CLIENT_DLL bIsRagdoll = true; #else C_BaseAnimating *pAnimating = GetMoveParent() ? GetMoveParent()->GetBaseAnimating() : NULL; if (!pAnimating) return; bIsRagdoll = pAnimating->IsRagdoll(); #endif // NOTE: IsRagdoll means *client-side* ragdoll. We shouldn't be trying to fight // the server ragdoll (or any server physics) on the client if (( !m_pController ) && ( m_nDissolveType == ENTITY_DISSOLVE_NORMAL ) && bIsRagdoll ) { IPhysicsObject *ppList[VPHYSICS_MAX_OBJECT_LIST_COUNT]; int nCount = pEnt->VPhysicsGetObjectList( ppList, ARRAYSIZE(ppList) ); if ( nCount > 0 ) { m_pController = physenv->CreateMotionController( this ); for ( int i = 0; i < nCount; ++i ) { m_pController->AttachObject( ppList[i], true ); } } } color32 color; color.r = ( 1.0f - GetFadeInPercentage() ) * m_vEffectColor.x; color.g = ( 1.0f - GetFadeInPercentage() ) * m_vEffectColor.y; color.b = ( 1.0f - GetFadeInPercentage() ) * m_vEffectColor.z; color.a = GetModelFadeOutPercentage() * 255.0f; // Setup the entity fade pEnt->SetRenderMode( kRenderTransColor ); pEnt->SetRenderColor( color.r, color.g, color.b, color.a ); if ( GetModelFadeOutPercentage() <= 0.2f ) { m_bCoreExplode = true; } // If we're dead, fade out if ( GetFadeOutPercentage() <= 0.0f ) { // Do NOT remove from the client entity list. It'll confuse the local network backdoor, and the entity will never get destroyed // because when the server says to destroy it, the client won't be able to find it. // ClientEntityList().RemoveEntity( GetClientHandle() ); partition->Remove( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle() ); RemoveFromLeafSystem(); //FIXME: Ick! //Adrian: I'll assume we don't need the ragdoll either so I'll remove that too. if ( m_bLinkedToServerEnt == false ) { Release(); C_ClientRagdoll *pRagdoll = dynamic_cast <C_ClientRagdoll *> ( pEnt ); if ( pRagdoll ) { pRagdoll->ReleaseRagdoll(); } #ifdef TF_CLIENT_DLL else { // Hide the ragdoll -- don't actually delete it or else things get unhappy when // we get a message from the server telling us to delete it pEnt->AddEffects( EF_NODRAW ); pEnt->ParticleProp()->StopEmission(); } #endif } } }