FireBullets(): Difference between revisions
Jump to navigation
Jump to search
m (→See also: Fixed Traceline link) |
|||
| Line 32: | Line 32: | ||
* [[AmmoDef]] | * [[AmmoDef]] | ||
* <code>[[FireBulletsInfo t]]</code> | * <code>[[FireBulletsInfo t]]</code> | ||
* <code>[[TraceLine]]</code> | * <code>[[UTIL_TraceLine|TraceLine]]</code> | ||
[[Category:Weapons programming]] | [[Category:Weapons programming]] | ||
Latest revision as of 18:11, 9 April 2011
FireBullets() is a method which handles damage for any hitscan weapon. It is passed FireBulletsInfo_t as its required parameter, which describes the bullet in question.
Members
info
- Name given to the
FireBulletsInfostruct that is passed into method.
pAmmoDef
- Stores the ammo definition in a pointer.
flActualDamage
- Used to store the actual damage to be done to entity.
iPlayerDamage
- If it's deemed we are damaging a player, this is used instead of
flActualDamage
tr
TraceLineused when the weapon fired.tr.m_pEntis the entity that was intersected e.g. NPC, crate, wall.
Damage
This is the core function where the damage is done to the entity. DispatchTraceAttack is passed dmgInfo which contains the attacker, damage value and damage type.
CTakeDamageInfo dmgInfo( this, pAttacker, flActualDamage, nActualDamageType ); CalculateBulletDamageForce( &dmgInfo, info.m_iAmmoType, vecDir, tr.endpos ); dmgInfo.ScaleDamageForce( info.m_flDamageForceScale ); dmgInfo.SetAmmoType( info.m_iAmmoType ); tr.m_pEnt->DispatchTraceAttack( dmgInfo, vecDir, &tr );