//-----------------------------------------------------------------------------
// Purpose: Show/hide weapon and corresponding view model if any
// Input  : visible - 
//-----------------------------------------------------------------------------
void CTFWeaponInvis::SetWeaponVisible( bool visible )
{
	CBaseViewModel *vm = NULL;

	CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
	if ( pOwner )
	{
		vm = pOwner->GetViewModel( m_nViewModelIndex );
	}

	if ( visible )
	{
		RemoveEffects( EF_NODRAW );
		if ( vm )
		{
			vm->RemoveEffects( EF_NODRAW );
		}
	}
	else
	{
		AddEffects( EF_NODRAW );
		if ( vm )
		{
			vm->AddEffects( EF_NODRAW );
		}
	}
}
//-----------------------------------------------------------------------------
// Purpose: Show/hide weapon and corresponding view model if any
// Input  : visible - 
//-----------------------------------------------------------------------------
void CWarsWeapon::SetWeaponVisible( bool visible )
{
	CBaseViewModel *vm = NULL;
	CUnitBase *pUnit;

	if( GetOwner() )
	{
		pUnit = GetOwner()->MyUnitPointer();
		if( pUnit && pUnit->GetCommander() )
		{
			CBasePlayer *pOwner = ToBasePlayer( pUnit->GetCommander() );
			if ( pOwner )
			{
				vm = pOwner->GetViewModel( m_nViewModelIndex );
			}
		}
	}

	if ( vm )
	{
		if ( visible )
		{
			vm->RemoveEffects( EF_NODRAW );
		}
		else
		{
			vm->AddEffects( EF_NODRAW );
		}
	}
	BaseClass::SetWeaponVisible( visible );
}
Beispiel #3
0
void CEntHost::CreateHands( int index, int parent )
{
    Assert( IsPlayer() );
    Assert( index >= 1 && index < MAX_VIEWMODELS );

    if ( !IsPlayer() )
        return;

    if ( !GetPlayer()->GetViewModel( parent ) )
        return;

    if ( !GetHandsModel( index ) )
        return;

    CBaseViewModel *hands = GetPlayer()->GetViewModel( index );
    CBaseViewModel *vm = GetPlayer()->GetViewModel( parent );

    // Ya existe, actualizamos el modelo
    if ( hands ) {
        hands->SetModel( GetHandsModel( index ) );
        return;
    }

    hands = (CBaseViewModel *)CreateEntityByName( "predicted_viewmodel" );

    if ( hands ) {
        hands->SetAbsOrigin( GetAbsOrigin() );
        hands->SetOwner( GetPlayer() );
        hands->SetIndex( index );

        DispatchSpawn( hands );

        hands->SetModel( GetHandsModel( index ) );
        hands->SetOwnerViewModel( vm );
        hands->SetOwnerEntity( GetPlayer() );
        hands->AddEffects( EF_NODRAW );

        GetPlayer()->m_hViewModel.Set( index, hands );
    }
}
void CC4::UpdateShieldState( void )
{
	//ADRIANTODO
	CCSPlayer *pPlayer = GetPlayerOwner();
	if ( !pPlayer )
		return;
	
	if ( pPlayer->HasShield() )
	{
		pPlayer->SetShieldDrawnState( false );

		CBaseViewModel *pVM = pPlayer->GetViewModel( 1 );

		if ( pVM )
		{
			pVM->AddEffects( EF_NODRAW );
		}
			//pPlayer->SetHitBoxSet( 3 );
	}
	else
		BaseClass::UpdateShieldState();
}