Don't mind me.

This commit is contained in:
Mari the Deer 2021-07-01 12:43:08 +02:00
commit 9ddaa01545
10 changed files with 86 additions and 41 deletions

View file

@ -172,6 +172,31 @@ Mixin Class SWWMAmmo
}
}
override bool CanPickup( Actor toucher )
{
// don't allow picking up ammo for weapons we can't pick up
// (future-proofing for player classes)
if ( !Super.CanPickup(toucher) ) return false;
for ( int i=0; i<AllActorClasses.Size(); i++ )
{
let w = (Class<Weapon>)(AllActorClasses[i]);
if ( !w ) continue;
if ( w is 'SWWMWeapon' )
{
let def = GetDefaultByType((Class<SWWMWeapon>)(w));
if ( !def.UsesAmmo(GetClass()) ) continue;
if ( !def.CanPickup(toucher) ) return false;
}
else
{
let def = GetDefaultByType(w);
if ( (def.AmmoType1 != GetClass()) && (def.AmmoType2 != GetClass()) ) continue;
if ( !def.CanPickup(toucher) ) return false;
}
}
return true;
}
default
{
+INVENTORY.IGNORESKILL;
@ -236,6 +261,15 @@ Class MagAmmo : Inventory abstract
return Super.HandlePickup(item);
}
override bool CanPickup( Actor toucher )
{
// don't allow picking up ammo for weapons we can't pick up
// (future-proofing for player classes)
if ( !Super.CanPickup(toucher) ) return false;
let def = GetDefaultByType(ParentAmmo);
return def.CanPickup(toucher);
}
private Inventory DoDrop( Class<Inventory> type )
{
let copy = Inventory(Spawn(type,Owner.Pos,NO_REPLACE));