diff --git a/language.version b/language.version index a2fb069dc..830e2915c 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw1.1.43 \cu(Tue 23 Nov 23:40:04 CET 2021)\c-"; -SWWM_SHORTVER="\cw1.1.43 \cu(2021-11-23 23:40:04)\c-"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw1.1.43 \cu(Mon 29 Nov 16:40:57 CET 2021)\c-"; +SWWM_SHORTVER="\cw1.1.43 \cu(2021-11-29 16:40:57)\c-"; diff --git a/zscript/items/swwm_baseammo.zsc b/zscript/items/swwm_baseammo.zsc index 3247196bf..35f953cb3 100644 --- a/zscript/items/swwm_baseammo.zsc +++ b/zscript/items/swwm_baseammo.zsc @@ -177,6 +177,32 @@ Class SWWMAmmo : Ammo } } } + else if ( MagAmmoType ) + { + // can we split it into mag ammo? + let ma = MagAmmo(Owner.FindInventory(MagAmmoType)); + if ( !ma ) + { + ma = MagAmmo(Spawn(MagAmmoType)); + ma.Amount = 0; + ma.AttachToOwner(Owner); + } + if ( ma.Amount < ma.MaxAmount ) + { + // split into bullets + for ( int i=0; i 0 ) ma.CreateTossable(dropamt); + if ( (bul == ma.ClipSize) && (Amount < MaxAmount) ) Amount++; + else ma.Amount = min(ma.MaxAmount,ma.Amount+bul); + } + item.bPickupGood = true; + return true; + } + } } return Super.HandlePickup(item); } @@ -330,35 +356,6 @@ Class MagAmmo : Inventory abstract override bool HandlePickup( Inventory item ) { - // see if the mag can be split apart - if ( (item is 'Ammo') && (ParentAmmo == Ammo(item).GetParentAmmo()) ) - { - // double-check that parent ammo exists - if ( !pamo ) - { - pamo = Ammo(Owner.FindInventory(ParentAmmo)); - if ( !pamo ) - { - pamo = Ammo(Spawn(ParentAmmo)); - pamo.AttachToOwner(Owner); - pamo.Amount = 0; - } - } - if ( (pamo.Amount >= pamo.MaxAmount) && (Amount < MaxAmount) ) - { - // split - for ( int i=0; i 0 ) CreateTossable(dropamt); - Amount = min(MaxAmount,Amount+bul); - } - item.bPickupGood = true; - return true; - } - } // drop excess mag ammo if ( (item is 'MagAmmo') && (MagAmmo(item).GetParentMagAmmo() == GetClass()) ) {