Don't select items in the air or with the Ambush flag for overtime

This commit is contained in:
TehRealSalt 2019-09-24 02:00:27 -04:00
parent 54066cc9fc
commit 7cfcb2f61a

View file

@ -1857,15 +1857,24 @@ void P_CheckTimeLimit(void)
continue;
if (thismo->threshold == 69) // Disappears
continue;
b++;
// Only select items that are on the ground, ignore ones in the air. Ambush flag inverts this rule.
if ((!P_IsObjectOnGround(thismo)) != (thismo->flags2 & MF2_AMBUSH))
continue;
if (item == NULL || (b < nummapboxes && P_RandomChance(((nummapboxes-b)*FRACUNIT)/nummapboxes))) // This is to throw off the RNG some
item = thismo;
if (b >= nummapboxes) // end early if we've found them all already
break;
}
if (item == NULL) // no item found?!
if (item == NULL) // no item found, could happen if every item is in the air or has ambush flag, or the map has none
{
CONS_Alert(CONS_WARNING, "No usuable items for Battle overtime!\n");
return;
}
item->threshold = 70; // Set constant respawn
battleovertime.x = item->x;