//-----------------------------------------------------------------------------
// Purpose: Passes Use along to certain named doors.
//-----------------------------------------------------------------------------
void CBaseDoor::ChainUse( void )
{
	if ( m_isChaining )
		return;

	CBaseEntity *ent = NULL;
	while ( ( ent = gEntList.FindEntityByName( ent, m_ChainTarget, NULL ) ) != NULL )
	{
		if ( ent == this )
			continue;

		CBaseDoor *door = dynamic_cast< CBaseDoor * >( ent );
		if ( door )
		{
			door->SetChaining( true );
			door->Use( m_hActivator, NULL, USE_TOGGLE, 0.0f ); // only the first param is used
			door->SetChaining( false );
		}
	}
}
Esempio n. 2
0
void CBaseDoor :: ChainUse( USE_TYPE useType, float value )
{
	// to prevent recursion
	if( m_isChaining ) return;

	CBaseEntity *pEnt = NULL;

	while(( pEnt = UTIL_FindEntityByTargetname( pEnt, STRING( m_iChainTarget ))) != NULL )
	{
		if( pEnt == this ) continue;

		CBaseDoor *pDoor = (CBaseDoor *)pEnt;

		if( pDoor )
		{
			pDoor->SetChaining( true );
			pDoor->Use( m_hActivator, this, useType, value );
			pDoor->SetChaining( false );
		}
	}
}