void CGib::DieThink ( void ) { if ( GetSprite() ) { CSprite *pSprite = dynamic_cast<CSprite*>( GetSprite() ); if ( pSprite ) { pSprite->FadeAndDie( 0.0 ); } } if ( GetFlame() ) { CEntityFlame *pFlame = dynamic_cast< CEntityFlame*>( GetFlame() ); if ( pFlame ) { pFlame->SetLifetime( 1.0f ); } } if ( g_pGameRules->IsMultiplayer() ) { UTIL_Remove( this ); } else { SetThink ( &CGib::SUB_FadeOut ); SetNextThink( gpGlobals->curtime ); } }
//========================================================= // WaitTillLand - in order to emit their meaty scent from // the proper location, gibs should wait until they stop // bouncing to emit their scent. That's what this function // does. //========================================================= void CGib::WaitTillLand ( void ) { if (!IsInWorld()) { UTIL_Remove( this ); return; } if ( GetAbsVelocity() == vec3_origin ) { SetRenderAlpha( 255 ); m_nRenderMode = kRenderTransTexture; if ( GetMoveType() != MOVETYPE_VPHYSICS ) { AddSolidFlags( FSOLID_NOT_SOLID ); } SetLocalAngularVelocity( vec3_angle ); SetNextThink( gpGlobals->curtime + m_lifeTime ); SetThink ( &CGib::SUB_FadeOut ); if ( GetSprite() ) { CSprite *pSprite = dynamic_cast<CSprite*>( GetSprite() ); if ( pSprite ) { //Adrian - Why am I doing this? Check InitPointGib for the answer! if ( m_lifeTime == 0 ) m_lifeTime = random->RandomFloat( 1, 3 ); pSprite->FadeAndDie( m_lifeTime ); } } if ( GetFlame() ) { CEntityFlame *pFlame = dynamic_cast< CEntityFlame*>( GetFlame() ); if ( pFlame ) { pFlame->SetLifetime( 1.0f ); } } // If you bleed, you stink! if ( m_bloodColor != DONT_BLEED ) { // ok, start stinkin! // FIXME: It's too easy to fill up the sound queue with all these meat sounds // CSoundEnt::InsertSound ( SOUND_MEAT, GetAbsOrigin(), 384, 25 ); } } else { // wait and check again in another half second. SetNextThink( gpGlobals->curtime + 0.5f ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_AntlionGrub::Event_Killed( const CTakeDamageInfo &info ) { BaseClass::Event_Killed( info ); if ( ( m_bSquashed == false ) && ( info.GetDamageType() & DMG_CLUB ) ) { // Die! Squash( info.GetAttacker() ); } else { //Restore this touch so we can still be squished SetTouch( GrubTouch ); } // Slowly fade out glow out m_pGlowSprite->FadeAndDie( 5.0f ); }