Talk:Shotgun

From Tripwire Interactive Wiki
Revision as of 20:14, 13 October 2012 by Benjamin (talk | contribs)
Jump to navigation Jump to search

Head shot damage calculation

Something bizarre about the way ShotgunBullet.uc handles its head shot damage, in ProcessTouch() at line 154:

if (Pawn(Other) != none && Pawn(Other).IsHeadShot(HitLocation, X, 1.0))
{
	Pawn(Other).TakeDamage(Damage * HeadShotDamageMult, Instigator, HitLocation, MomentumTransfer * Normal(Velocity), MyDamageType);
}
else
{
	Other.TakeDamage(Damage, Instigator, HitLocation, MomentumTransfer * Normal(Velocity), MyDamageType);
}

If you actually test this code you'll see that the second case is the only code that gets executed, thus ignoring the class's own HeadShotDamageMulti variable. Is this a bug or is it intentional?

So this leaves head damage multiplying to KFMonster.uc, which takes it from the damage class (the shotgun's damage class states x1.1 damage, as defined in KFWeaponDamageType).

It seems all weapons exclusively use the damagetype class to specify the head shot multiplier, EXCEPT the crossbow and M99 which use a value of 1.0 in the damagetype classes and instead pass the calculated value directly to the pawn from ProcessTouch.