fix mbf21 A_ConsumeAmmo ignoring explicit amount arg if weapon's ammopershot field set

This commit is contained in:
Xaser Acheron 2022-01-12 23:08:15 -06:00 committed by Christoph Oelckers
parent 25f28c4b50
commit a4b124bff8
2 changed files with 3 additions and 3 deletions

View file

@ -994,7 +994,7 @@ class Weapon : StateProvider
// //
//=========================================================================== //===========================================================================
virtual bool DepleteAmmo(bool altFire, bool checkEnough = true, int ammouse = -1) virtual bool DepleteAmmo(bool altFire, bool checkEnough = true, int ammouse = -1, bool forceammouse = false)
{ {
if (!(sv_infiniteammo || (Owner.FindInventory ('PowerInfiniteAmmo', true) != null))) if (!(sv_infiniteammo || (Owner.FindInventory ('PowerInfiniteAmmo', true) != null)))
{ {
@ -1006,7 +1006,7 @@ class Weapon : StateProvider
{ {
if (Ammo1 != null) if (Ammo1 != null)
{ {
if (ammouse >= 0 && bDehAmmo) if (ammouse >= 0 && (bDehAmmo || forceammouse))
{ {
Ammo1.Amount -= ammouse; Ammo1.Amount -= ammouse;
} }

View file

@ -430,7 +430,7 @@ extend class Weapon
if (!weap) return; if (!weap) return;
if (consume == 0) consume = -1; if (consume == 0) consume = -1;
weap.DepleteAmmo(weap.bAltFire, false, consume); weap.DepleteAmmo(weap.bAltFire, false, consume, true);
} }
// //