//----------------------------------------------------------------------------- // Purpose: Check to see if there are any deteriorating objects I once owned that // I can now re-own (i.e. I switched teams back to my original team). // TODO: Make this use Steam IDs, so disconnecting & reconnecting players // get their objects back. //----------------------------------------------------------------------------- void CPlayerClass::CheckDeterioratingObjects( void ) { if ( !GetTeam() ) return; // Cycle through the team's objects looking for any deteriorating objects once owned by me for ( int i = 0; i < GetTeam()->GetNumObjects(); i++ ) { CBaseObject *pObject = GetTeam()->GetObject(i); if ( pObject->IsDeteriorating() && pObject->GetOriginalBuilder() == m_pPlayer ) { // Can this class build this object? if ( ClassCanBuild( GetTFClass(), pObject->GetType() ) ) { // Give the object back to this player pObject->SetBuilder( m_pPlayer ); m_pPlayer->AddObject( pObject ); } } } }
//----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- bool CObjectSentrygun::CanBeUpgraded( CTFPlayer *pPlayer ) { // Already upgrading if ( m_iState == SENTRY_STATE_UPGRADING ) { return false; } // only engineers if ( !ClassCanBuild( pPlayer->GetPlayerClass()->GetClassIndex(), GetType() ) ) { return false; } // max upgraded if ( m_iUpgradeLevel >= 3 ) { return false; } return true; }