//----------------------------------------------------------------------------- // Purpose: Burn targets around us //----------------------------------------------------------------------------- void CEntityFlame::FlameThink( void ) { if ( m_flLifetime < gpGlobals->curtime ) { SetThink( &CEntityFlame::SUB_Remove ); SetNextThink( gpGlobals->curtime + 0.1f ); return; } RadiusDamage( CTakeDamageInfo( this, this, 4.0f, DMG_BURN ), GetAbsOrigin(), m_flSize/2, CLASS_NONE ); FireSystem_AddHeatInRadius( GetAbsOrigin(), m_flSize/2, 2.0f ); SetNextThink( gpGlobals->curtime + 0.1f ); }
//----------------------------------------------------------------------------- // Purpose: Burn targets around us //----------------------------------------------------------------------------- void CEntityFlame::FlameThink( void ) { // Assure that this function will be ticked again even if we early-out in the if below. SetNextThink( gpGlobals->curtime + FLAME_DAMAGE_INTERVAL ); if ( m_hEntAttached ) { if ( m_hEntAttached->GetFlags() & FL_TRANSRAGDOLL ) { SetRenderColorA( 0 ); return; } CAI_BaseNPC *pNPC = m_hEntAttached->MyNPCPointer(); if ( pNPC && !pNPC->IsAlive() ) { UTIL_Remove( this ); // Notify the NPC that it's no longer burning! pNPC->Extinguish(); return; } if( m_hEntAttached->GetWaterLevel() > 0 ) { Vector mins, maxs; mins = m_hEntAttached->WorldSpaceCenter(); maxs = mins; maxs.z = m_hEntAttached->WorldSpaceCenter().z; maxs.x += 32; maxs.y += 32; mins.z -= 32; mins.x -= 32; mins.y -= 32; UTIL_Bubbles( mins, maxs, 12 ); } } else { UTIL_Remove( this ); return; } // See if we're done burning, or our attached ent has vanished if ( m_flLifetime < gpGlobals->curtime || m_hEntAttached == NULL ) { EmitSound( "General.StopBurning" ); m_bPlayingSound = false; SetThink( &CEntityFlame::SUB_Remove ); SetNextThink( gpGlobals->curtime + 0.5f ); // Notify anything we're attached to if ( m_hEntAttached ) { CBaseCombatCharacter *pAttachedCC = m_hEntAttached->MyCombatCharacterPointer(); if( pAttachedCC ) { // Notify the NPC that it's no longer burning! pAttachedCC->Extinguish(); } } return; } if ( m_hEntAttached ) { // Do radius damage ignoring the entity I'm attached to. This will harm things around me. RadiusDamage( CTakeDamageInfo( this, this, 4.0f, DMG_BURN ), GetAbsOrigin(), m_flSize/2, CLASS_NONE, m_hEntAttached ); // Directly harm the entity I'm attached to. This is so we can precisely control how much damage the entity // that is on fire takes without worrying about the flame's position relative to the bodytarget (which is the // distance that the radius damage code uses to determine how much damage to inflict) m_hEntAttached->TakeDamage( CTakeDamageInfo( this, this, FLAME_DIRECT_DAMAGE, DMG_BURN | DMG_DIRECT ) ); if( !m_hEntAttached->IsNPC() && hl2_episodic.GetBool() ) { const int ENTITYFLAME_MOVE_AWAY_DIST = 24; // Make a sound near my origin, and up a little higher (in case I'm on the ground, so NPC's still hear it) CSoundEnt::InsertSound( SOUND_MOVE_AWAY, GetAbsOrigin(), ENTITYFLAME_MOVE_AWAY_DIST, 0.1f, this, SOUNDENT_CHANNEL_REPEATED_DANGER ); CSoundEnt::InsertSound( SOUND_MOVE_AWAY, GetAbsOrigin() + Vector( 0, 0, 48.0f ), ENTITYFLAME_MOVE_AWAY_DIST, 0.1f, this, SOUNDENT_CHANNEL_REPEATING ); } } else { RadiusDamage( CTakeDamageInfo( this, this, FLAME_RADIUS_DAMAGE, DMG_BURN ), GetAbsOrigin(), m_flSize/2, CLASS_NONE, NULL ); } FireSystem_AddHeatInRadius( GetAbsOrigin(), m_flSize/2, 2.0f ); }