dlls/EntityFlame.cpp
113114115116117118119
// Purpose: Creates a flame and attaches it to a target entity.
// Input : pTarget -
//-----------------------------------------------------------------------------
CEntityFlame *CEntityFlame::Create( CBaseEntity *pTarget, bool useHitboxes )
{
CEntityFlame *pFlame = (CEntityFlame *) CreateEntityByName( "entityflame" );
113114115116117118119
// Purpose: Creates a flame and attaches it to a target entity.
// Input : pTarget -
//-----------------------------------------------------------------------------
CEntityFlame *CEntityFlame::Create( CBaseEntity *pTarget, bool useHitboxes, float flameSize )
{
CEntityFlame *pFlame = (CEntityFlame *) CreateEntityByName( "entityflame" );
124125126127128129130131132133134135
float ySize = pTarget->CollisionProp()->OBBMaxs().y - pTarget->CollisionProp()->OBBMins().y;
float size = ( xSize + ySize ) * 0.5f;
if ( size < 16.0f )
{
size = 16.0f;
}
UTIL_SetOrigin( pFlame, pTarget->GetAbsOrigin() );
pFlame->m_flSize = size;
124125126127128129130131132133134135136137138139140
float ySize = pTarget->CollisionProp()->OBBMaxs().y - pTarget->CollisionProp()->OBBMins().y;
float size = ( xSize + ySize ) * 0.5f;
if( size != 0 )
{
size = size * flameSize;
}
else
{
size = flameSize;
}
UTIL_SetOrigin( pFlame, pTarget->GetAbsOrigin() );
pFlame->m_flSize = size;
286287288289290291292293294
FireSystem_AddHeatInRadius( GetAbsOrigin(), m_flSize/2, 2.0f );
SetNextThink( gpGlobals->curtime + FLAME_DAMAGE_INTERVAL );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : pEnt -
291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
FireSystem_AddHeatInRadius( GetAbsOrigin(), m_flSize/2, 2.0f );
SetNextThink( gpGlobals->curtime + FLAME_DAMAGE_INTERVAL );
}
//-----------------------------------------------------------------------------
// Purpose: Kill the flame NOW
//-----------------------------------------------------------------------------
void CEntityFlame::Extinguish( void )
{
m_flLifetime = 0.0f;
SetParent( NULL );
if( m_hEntAttached )
{
m_hEntAttached->RemoveFlag( FL_ONFIRE );
m_hEntAttached = NULL;
}
if( m_bPlayingSound )
EmitSound( "General.StopBurning" );
SetThink( NULL );
UTIL_Remove( this );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : pEnt -