Fix ammo check logic on some weapons.

This commit is contained in:
Mari the Deer 2022-08-04 17:58:16 +02:00
commit 24a038b0a9
6 changed files with 21 additions and 15 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r248 \cu(Thu 4 Aug 17:29:07 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r248 \cu(2022-08-04 17:29:07)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r249 \cu(Thu 4 Aug 17:58:16 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r249 \cu(2022-08-04 17:58:16)\c-";

View file

@ -284,8 +284,12 @@ Class HeavyMahSheenGun : SWWMWeapon
override bool CheckAmmo( int firemode, bool autoswitch, bool requireammo, int ammocount )
{
if ( sv_infiniteammo || Owner.FindInventory('PowerInfiniteAmmo',true) ) return true;
if ( (fireMode == PrimaryFire) || (fireMode == AltFire) )
return (Ammo1.Amount > 0);
if ( (fireMode == PrimaryFire) || (fireMode == EitherFire) )
{
if ( Ammo1.Amount > 0 ) return true;
if ( autoswitch ) PlayerPawn(Owner).PickNewWeapon(null);
return false;
}
return Super.CheckAmmo(firemode,autoswitch,requireammo,ammocount);
}

View file

@ -24,10 +24,7 @@ Class Eviscerator : SWWMWeapon
override bool CheckAmmo( int firemode, bool autoswitch, bool requireammo, int ammocount )
{
if ( (firemode == PrimaryFire) || (firemode == AltFire) )
{
if ( (Ammo1.Amount > 0) || chambered ) return true;
return false;
}
return ((Ammo1.Amount > 0) || chambered);
return Super.CheckAmmo(firemode,autoswitch,requireammo,ammocount);
}

View file

@ -53,7 +53,11 @@ Class Ynykron : SWWMWeapon
{
if ( sv_infiniteammo || Owner.FindInventory('PowerInfiniteAmmo',true) ) return true;
if ( (fireMode == PrimaryFire) || (fireMode == AltFire) )
return ((clipcount > 0) || (Ammo1.Amount > 0));
{
if ( (clipcount > 0) || (Ammo1.Amount > 0) ) return true;
if ( autoswitch ) PlayerPawn(Owner).PickNewWeapon(null);
return false;
}
return Super.CheckAmmo(firemode,autoswitch,requireammo,ammocount);
}

View file

@ -164,10 +164,11 @@ Class Spreadgun : SWWMWeapon
override bool CheckAmmo( int firemode, bool autoswitch, bool requireammo, int ammocount )
{
static const Class<Ammo> types[] = {"RedShell","GreenShell","BlueShell","PurpleShell","BlackShell","GoldShell"};
if ( (firemode == PrimaryFire) || (firemode == AltFire) )
if ( (firemode == PrimaryFire) || (firemode == EitherFire) )
{
if ( !fired && chambered ) return true;
for ( int i=0; i<6; i++ ) if ( Owner.CountInv(types[i]) > 0 ) return true;
if ( autoswitch ) PlayerPawn(Owner).PickNewWeapon(null);
return false;
}
return Super.CheckAmmo(firemode,autoswitch,requireammo,ammocount);

View file

@ -276,12 +276,12 @@ Class SilverBullet : SWWMWeapon
override bool CheckAmmo( int firemode, bool autoswitch, bool requireammo, int ammocount )
{
if ( sv_infiniteammo || Owner.FindInventory('PowerInfiniteAmmo',true) ) return true;
if ( (fireMode == PrimaryFire) || (fireMode == AltFire) )
if ( (fireMode == PrimaryFire) || (fireMode == EitherFire) )
{
// allow player to still use the zoom even if there's no ammo left
// (should work fine, assuming I've correctly interpreted the execution chain of all this stuff)
if ( autoswitch && (fireMode == AltFire) ) return true;
return ((chambered && !fired) || (clipcount > 0) || (Ammo1.Amount > 0) || (Ammo2.Amount > 0) || (Owner.CountInv("SilverBullets") > 0) || (Owner.CountInv("SilverBullets2") > 0));
if ( (chambered && !fired) || (clipcount > 0) || (Ammo1.Amount > 0) || (Ammo2.Amount > 0) || (Owner.CountInv("SilverBullets") > 0) || (Owner.CountInv("SilverBullets2") > 0) )
return true;
if ( autoswitch ) PlayerPawn(Owner).PickNewWeapon(null);
return false;
}
return Super.CheckAmmo(firemode,autoswitch,requireammo,ammocount);
}