PrimaryAttack(): Difference between revisions
Jump to navigation
Jump to search
(Created page with 'This is a method to control the primary attack of bullet-based weapons. It exists in CBaseCombatWeapon::PrimaryAttack() form, but it is generally overloaded in specific metho…') |
mNo edit summary |
||
Line 18: | Line 18: | ||
This sets the vectors that will be passed to [[FireBullets()]]. | This sets the vectors that will be passed to [[FireBullets()]]. | ||
[[Category:Programming]] |
Latest revision as of 14:01, 24 May 2012
This is a method to control the primary attack of bullet-based weapons. It exists in CBaseCombatWeapon::PrimaryAttack() form, but it is generally overloaded in specific methods. Half-Life 2 weapons that use PrimaryAttack():
- 357 Magnum
- Alyxgun
- AR2 Machine Gun
- Pistol
- Shotgun
- SMG
Generally the method is concerned with checking ammo for the weapon, calling the FireBullets() method, playing the sound and adding the view kick.
Functions
m_flNextPrimaryAttack = gpGlobals->curtime + 0.75;
- (Example taken from weapon_357.cpp) Sets the time until next attack can be made to 3/4 of a second.
Vector vecSrc = pPlayer->Weapon_ShootPosition(); Vector vecAiming = pPlayer->GetAutoaimVector( AUTOAIM_SCALE_DEFAULT );
This sets the vectors that will be passed to FireBullets().