Enemies only drop ammo for owned weapons.

This commit is contained in:
Mari the Deer 2022-08-04 18:17:21 +02:00
commit fa6c8f68d6
4 changed files with 84 additions and 106 deletions

View file

@ -2117,7 +2117,9 @@ Class SWWMUtility
// mapstart: this function is being called during map load, so we
// should also check STAT_TRAVELLING inventory
// worldonly: only checks for items that are placed in the world
static bool ItemExists( Class<Inventory> itm, Inventory skipme = null, bool mapstart = false, bool worldonly = false )
// ownedonly: only checks for items that are owned by players
// (note that this is mutually exclusive with worldonly)
static bool ItemExists( Class<Inventory> itm, Inventory skipme = null, bool mapstart = false, bool worldonly = false, bool ownedonly = false )
{
let ti = ThinkerIterator.Create(itm);
Inventory i;
@ -2125,6 +2127,7 @@ Class SWWMUtility
{
if ( i == skipme ) continue;
if ( worldonly && i.Owner ) continue;
if ( ownedonly && (!i.Owner || !i.Owner.player) ) continue;
return true;
}
if ( worldonly || !mapstart ) return false;
@ -2132,6 +2135,7 @@ Class SWWMUtility
while ( i = Inventory(ti.Next()) )
{
if ( i == skipme ) continue;
if ( ownedonly && (!i.Owner || !i.Owner.player) ) continue;
return true;
}
return false;