Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/game/server/tf/tf_ammo_pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void CTFAmmoPack::InitAmmoPack( CTFPlayer *pPlayer, CTFWeaponBase *pWeapon, int
// Fill up the ammo pack.
GiveAmmo( iPrimary, TF_AMMO_PRIMARY ); // Gets recalculated in PackTouch
GiveAmmo( iSecondary, TF_AMMO_SECONDARY ); // Gets recalculated in PackTouch
GiveAmmo( iMetal, TF_AMMO_METAL );
GiveAmmo( iMetal, TF_AMMO_METAL ); // Gets recalculated in PackTouch if it's not a building gib
SetHealthInstead( pWeapon && pWeapon->GetWeaponID() == TF_WEAPON_LUNCHBOX && pPlayer->IsPlayerClass( TF_CLASS_HEAVYWEAPONS ) );
}
else
Expand Down Expand Up @@ -350,6 +350,16 @@ void CTFAmmoPack::PackTouch( CBaseEntity *pOther )
int iMaxSecondary = pPlayer->GetMaxAmmo(TF_AMMO_SECONDARY);
GiveAmmo( ceil( iMaxSecondary * m_flAmmoRatio ), TF_AMMO_SECONDARY );

// Do not scale building gibs
if ( GetOwnerEntity() && !GetOwnerEntity()->IsBaseObject() )
{
int iMetalRatio = pPlayer->GetMaxAmmo(TF_AMMO_METAL) / 200;

// Scale metal given
int iMetal = m_iAmmo[TF_AMMO_METAL] == 100 ? ceil( pPlayer->GetMaxAmmo(TF_AMMO_METAL) * m_flAmmoRatio ) : ceil( m_iAmmo[TF_AMMO_METAL] * iMetalRatio );
GiveAmmo( iMetal, TF_AMMO_METAL );
}

int iAmmoTaken = 0;

for ( int i=0;i<TF_AMMO_COUNT;i++ )
Expand Down