//----------------------------------------------------------------------------- // Purpose: Player holding this weapon has started building something // Assumes we are in a valid build position //----------------------------------------------------------------------------- void CTFWeaponBuilder::StartBuilding( void ) { CTFPlayer *pPlayer = ToTFPlayer( GetOwner() ); CBaseObject *pObj = m_hObjectBeingBuilt.Get(); if ( pPlayer && pPlayer->m_Shared.IsCarryingObject() ) { Assert( pObj ); pObj->RedeployBuilding( ToTFPlayer( GetOwner() ) ); m_hObjectBeingBuilt = NULL; pPlayer->m_Shared.SetCarriedObject( NULL ); return; } Assert( pObj ); pObj->StartBuilding( GetOwner() ); pObj->AddSpawnFlags( SF_OBJ_UPGRADABLE ); m_hObjectBeingBuilt = NULL; if ( pPlayer ) { pPlayer->RemoveInvisibility(); } }
//----------------------------------------------------------------------------- // Purpose: Player holding this weapon has started building something // Assumes we are in a valid build position //----------------------------------------------------------------------------- void CTFWeaponBuilder::StartBuilding( void ) { CBaseObject *pObj = m_hObjectBeingBuilt.Get(); Assert( pObj ); pObj->StartBuilding( GetOwner() ); m_hObjectBeingBuilt = NULL; CTFPlayer *pPlayer = ToTFPlayer( GetOwner() ); if ( pPlayer ) { pPlayer->RemoveInvisibility(); } }
//----------------------------------------------------------------------------- // Purpose: Player holding this weapon has started building something // Assumes we are in a valid build position //----------------------------------------------------------------------------- void CTFWeaponBuilder::StartBuilding( void ) { CTFPlayer *pPlayer = ToTFPlayer( GetOwner() ); CBaseObject *pObj = m_hObjectBeingBuilt.Get(); if ( pPlayer && pPlayer->m_Shared.IsCarryingObject() ) { Assert( pObj ); pObj->DropCarriedObject( pPlayer ); } Assert( pObj ); pObj->StartBuilding( GetOwner() ); m_hObjectBeingBuilt = NULL; if ( pPlayer ) { pPlayer->RemoveInvisibility(); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFWeaponBaseGun::PrimaryAttack( void ) { // Check for ammunition. if ( m_iClip1 <= 0 && m_iClip1 != -1 ) return; // Are we capable of firing again? if ( m_flNextPrimaryAttack > gpGlobals->curtime ) return; // Get the player owning the weapon. CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() ); if ( !pPlayer ) return; if ( !CanAttack() ) return; CalcIsAttackCritical(); #ifndef CLIENT_DLL pPlayer->RemoveInvisibility(); pPlayer->RemoveDisguise(); // Minigun has custom handling if ( GetWeaponID() != TF_WEAPON_MINIGUN ) { pPlayer->SpeakWeaponFire(); } CTF_GameStats.Event_PlayerFiredWeapon( pPlayer, IsCurrentAttackACrit() ); #endif // Set the weapon mode. m_iWeaponMode = TF_WEAPON_PRIMARY_MODE; SendWeaponAnim( ACT_VM_PRIMARYATTACK ); pPlayer->SetAnimation( PLAYER_ATTACK1 ); FireProjectile( pPlayer ); m_flLastFireTime = gpGlobals->curtime; // Set next attack times. m_flNextPrimaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay; // Don't push out secondary attack, because our secondary fire // systems are all separate from primary fire (sniper zooming, demoman pipebomb detonating, etc) //m_flNextSecondaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay; // Set the idle animation times based on the sequence duration, so that we play full fire animations // that last longer than the refire rate may allow. if ( Clip1() > 0 ) { SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() ); } else { SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() ); } // Check the reload mode and behave appropriately. if ( m_bReloadsSingly ) { m_iReloadMode.Set( TF_RELOAD_START ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFWeaponBaseGun::PrimaryAttack( void ) { // Check for ammunition. if ( m_iClip1 <= 0 && UsesClipsForAmmo1() ) return; // Get the player owning the weapon. CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() ); if ( !pPlayer ) return; if ( !CanAttack() ) return; if ( m_pWeaponInfo->GetWeaponData( TF_WEAPON_PRIMARY_MODE ).m_nBurstSize > 0 && m_iBurstSize == 0 ) { // Start the burst. m_iBurstSize = m_pWeaponInfo->GetWeaponData( TF_WEAPON_PRIMARY_MODE ).m_nBurstSize; } if ( m_iBurstSize > 0 ) { m_iBurstSize--; } CalcIsAttackCritical(); #ifndef CLIENT_DLL pPlayer->RemoveInvisibility(); pPlayer->RemoveDisguise(); // Minigun has custom handling if ( GetWeaponID() != TF_WEAPON_MINIGUN ) { pPlayer->SpeakWeaponFire(); } CTF_GameStats.Event_PlayerFiredWeapon( pPlayer, IsCurrentAttackACrit() ); #endif // Set the weapon mode. m_iWeaponMode = TF_WEAPON_PRIMARY_MODE; SendWeaponAnim( ACT_VM_PRIMARYATTACK ); pPlayer->SetAnimation( PLAYER_ATTACK1 ); FireProjectile( pPlayer ); m_flLastFireTime = gpGlobals->curtime; // Set next attack times. float flFireDelay = m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay; CALL_ATTRIB_HOOK_FLOAT( flFireDelay, mult_postfiredelay ); m_flNextPrimaryAttack = gpGlobals->curtime + flFireDelay; // Don't push out secondary attack, because our secondary fire // systems are all separate from primary fire (sniper zooming, demoman pipebomb detonating, etc) //m_flNextSecondaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay; // Set the idle animation times based on the sequence duration, so that we play full fire animations // that last longer than the refire rate may allow. SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() ); AbortReload(); }