Skip to content

Commit

Permalink
Use damage values from the weapon script for non-stock-attack melee
Browse files Browse the repository at this point in the history
  • Loading branch information
TomyLobo committed Dec 24, 2020
1 parent 78367ec commit 90069ac
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions mp/src/game/shared/sdk/weapon_sdkbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,16 @@ float CWeaponSDKBase::GetMeleeDamage( bool bIsSecondary, CSDKPlayer* pVictim ) c

float flDamage;

//bool bIsStockAttack = pPlayer && pPlayer->GetActiveSDKWeapon() && !pPlayer->GetActiveSDKWeapon()->IsMeleeWeapon();
// The heavier the damage the more it hurts.
flDamage = RemapVal(GetSDKWpnData().iWeight, 7, 20, 45, 80);
bool bIsStockAttack = pPlayer && pPlayer->GetActiveSDKWeapon() && !pPlayer->GetActiveSDKWeapon()->IsMeleeWeapon();
if (bIsStockAttack)
{
// The heavier the damage the more it hurts.
flDamage = RemapVal(GetSDKWpnData().iWeight, 7, 20, 45, 80);
}
else {
// Get the damage from the weapon script.
flDamage = bIsSecondary ? GetSDKWpnData().m_iSecondaryDamage : GetSDKWpnData().m_iDamage;
}

if (pVictim)
{
Expand Down

0 comments on commit 90069ac

Please sign in to comment.