Beispiel #1
0
bool CWeaponM4A1::Holster(CBaseCombatWeapon *pSwitchingTo)
{
    if (m_flDoneSwitchingSilencer > 0.0f && m_flDoneSwitchingSilencer > gpGlobals->curtime)
    {
        // still switching the silencer.  Cancel the switch.
        m_bSilencerOn = !m_bSilencerOn;
        SetWeaponModelIndex(GetWorldModel());
    }

    return BaseClass::Holster(pSwitchingTo);
}
bool CWeaponDODBase::DefaultDeploy( char *szViewModel, char *szWeaponModel, int iActivity, char *szAnimExt )
{
	CBasePlayer *pOwner = GetPlayerOwner();
	if ( !pOwner )
	{
		return false;
	}

	pOwner->SetAnimationExtension( szAnimExt );

	SetViewModel();
	SendWeaponAnim( iActivity );

	pOwner->SetNextAttack( gpGlobals->curtime + SequenceDuration() );
	m_flNextPrimaryAttack	= gpGlobals->curtime;
	m_flNextSecondaryAttack	= gpGlobals->curtime;

	SetWeaponVisible( true );
	SetWeaponModelIndex( szWeaponModel );

	CBaseViewModel *vm = pOwner->GetViewModel( m_nViewModelIndex );

	Assert( vm );

	if( vm )
	{
		//set sleeves to proper team
		switch( pOwner->GetTeamNumber() )
		{
		case TEAM_ALLIES:
			vm->m_nSkin = SLEEVE_ALLIES;
			break;
		case TEAM_AXIS:
			vm->m_nSkin = SLEEVE_AXIS;
			break;
		default:
			Assert( !"TEAM_UNASSIGNED or spectator getting a view model assigned" );
			break;
		}
	}	

	return true;
}
void CWeaponUSP::SecondaryAttack()
{
	if ( m_bSilencerOn )
	{
		SendWeaponAnim( ACT_VM_DETACH_SILENCER );
	}
	else
	{
		SendWeaponAnim( ACT_VM_ATTACH_SILENCER );
	}
	m_bSilencerOn = !m_bSilencerOn;
	m_flDoneSwitchingSilencer = gpGlobals->curtime + 3;

	m_flNextSecondaryAttack = gpGlobals->curtime + 3;
	m_flNextPrimaryAttack = gpGlobals->curtime + 3;
	SetWeaponIdleTime( gpGlobals->curtime + 3 );

	SetWeaponModelIndex( GetWorldModel() );
}