Pistol start tweaks.

This commit is contained in:
Mari the Deer 2022-10-08 15:45:19 +02:00
commit 564c99782a
16 changed files with 86 additions and 41 deletions

View file

@ -2005,30 +2005,29 @@ Class SWWMUtility
p.health = p.mo.Health = p.mo.SpawnHealth();
}
// sets all carried ammo back to zero
// resets all carried ammo to its backpack give amount
// resets hammerspace capacity
// re-initializes any carried weapons
static play void ResetAmmo( Actor mo )
{
PlayerInfo p = mo.player;
if ( !p || !p.mo ) return;
for ( Inventory i=p.mo.inv; i; i=i.inv )
{
if ( (i is 'Ammo') || (i is 'MagAmmo') )
if ( i is 'Ammo' )
{
i.Amount = 0;
i.Amount = Ammo(i).BackpackAmount;
i.MaxAmount = i.default.MaxAmount;
}
if ( i is 'HammerspaceEmbiggener' )
else if ( i is 'MagAmmo' )
{
i.Amount = MagAmmo(i).BackpackAmount;
i.MaxAmount = i.default.MaxAmount;
}
else if ( i is 'HammerspaceEmbiggener' )
i.Amount = 0;
}
// also gives back any ammo from carried weapons (provided they don't have NOFIRSTGIVE)
for ( Inventory i=p.mo.inv; i; i=i.inv )
{
if ( !(i is 'Weapon') ) continue;
let w = Weapon(i);
if ( (w is 'SWWMWeapon') && SWWMWeapon(w).bNOFIRSTGIVE ) continue;
if ( w.Ammo1 ) w.Ammo1.Amount = min(w.Ammo1.MaxAmount,w.Ammo1.Amount+w.AmmoGive1);
if ( w.Ammo2 && (w.Ammo2 != w.Ammo1) ) w.Ammo2.Amount = min(w.Ammo2.MaxAmount,w.Ammo2.Amount+w.AmmoGive2);
else if ( i is 'SWWMWeapon' )
SWWMWeapon(i).InitializeWeapon();
}
}