Example #1
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CFuncRespawnFlagZone::Touch( CBaseEntity *pOther )
{
	if (!IsDisabled())
	{
		CTFPlayer *pPlayer = ToTFPlayer(pOther);
		if ( pPlayer && pPlayer->HasTheFlag() )
		{
			CTFItem *pItem = pPlayer->GetItem();
			if (pItem)
			{
				CCaptureFlag *pFlag = dynamic_cast<CCaptureFlag*>(pItem);
				pPlayer->DropFlag();
				if (pFlag)
				{
					pFlag->Reset();
					pFlag->ResetMessage();
				}
			}
			else
			{
				pPlayer->DropFlag();
			}
		}
	}
}
Example #2
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pOther - The thing that touched us.
//-----------------------------------------------------------------------------
void CFuncRespawnRoom::RespawnRoomTouch(CBaseEntity *pOther)
{
	if ( PassesTriggerFilters(pOther) )
	{
		if ( pOther->IsPlayer() && InSameTeam( pOther ) )
		{
			// Players carrying the flag drop it if they try to run into a respawn room
			CTFPlayer *pPlayer = ToTFPlayer(pOther);
			if ( pPlayer->HasTheFlag() && !m_bAllowFlag )
			{
				pPlayer->DropFlag();
			}
		}
	}
}