Esempio n. 1
0
//-----------------------------------------------------------------------------
// Opens the canister!
//-----------------------------------------------------------------------------
void CEnvHeadcrabCanister::InputOpenCanister( inputdata_t &inputdata )
{
	if ( m_bLanded && !m_bOpened && HasSpawnFlags( SF_WAIT_FOR_INPUT_TO_OPEN ) )
	{
		OpenCanister();
	}
}
//-----------------------------------------------------------------------------
// Landed!
//-----------------------------------------------------------------------------
void CEnvHeadcrabCanister::Landed( void )
{
	EmitSound( "HeadcrabCanister.AfterLanding" );

	// Lock us now that we've stopped
	SetLanded();

	// Hook the follow trail to the lead of the canister (which should be buried)
	// to hide problems with the edge of the follow trail
	if (m_hTrail)
	{
		m_hTrail->SetAttachment( BaseEntity(), LookupAttachment("trail") );
	}

	// Start smoke, unless we don't want it
	if ( !HasSpawnFlags( SF_NO_SMOKE ) )
	{
		// Create the smoke trail to obscure the headcrabs
		CSmokeTrail *trail = CSmokeTrail::CreateSmokeTrail();
		trail->FollowEntity( BaseEntity(), "smoke" );

		trail->m_SpawnRate			= 8;
		trail->m_ParticleLifetime	= 2.0f;

		trail->m_StartColor->Init( 0.7f, 0.7f, 0.7f );
		trail->m_EndColor->Init( 0.6, 0.6, 0.6 );

		trail->m_StartSize	= 32;
		trail->m_EndSize	= 64;
		trail->m_SpawnRadius= 8;
		trail->m_MinSpeed	= 0;
		trail->m_MaxSpeed	= 8;
		trail->m_MinDirectedSpeed	= 32;
		trail->m_MaxDirectedSpeed	= 64;
		trail->m_Opacity	= 0.35f;

		trail->SetLifetime( m_flSmokeLifetime );

		m_hSmokeTrail.Set(trail->BaseEntity());
	}

	SetThink( NULL );

	if ( !HasSpawnFlags( SF_WAIT_FOR_INPUT_TO_OPEN ) )
	{
		if ( HasSpawnFlags( SF_START_IMPACTED ) )
		{
			CanisterFinishedOpening( );
		}
		else
		{
			OpenCanister();
		}
	}
}