(Try to) fix auto-heal sounds stacking when hit multiple times in one tic.

This commit is contained in:
Mari the Deer 2022-11-15 11:47:07 +01:00
commit f9eef83dff
3 changed files with 16 additions and 4 deletions

View file

@ -15,6 +15,8 @@ Class SWWMArmor : Armor abstract
FlagDef NoDrain : SArmorFlags, 2; // amount is not drained, will always reduce as long as amount is non-zero
// useful for powerup-given armors
transient int lastautousetic; // accumulated damage can make the use sounds stack
Default
{
+INVENTORY.AUTOACTIVATE;
@ -94,7 +96,11 @@ Class SWWMArmor : Armor abstract
damage = newdamage;
if ( (amount <= (MaxAmount-default.Amount)) && (Owner.CountInv(parent) > 0) )
{
if ( GetDefaultByType(parent).UseSound ) Owner.A_StartSound(GetDefaultByType(parent).UseSound,CHAN_ITEMEXTRA,CHANF_OVERLAP,.6);
if ( GetDefaultByType(parent).UseSound && (lastautousetic < gametic) )
{
Owner.A_StartSound(GetDefaultByType(parent).UseSound,CHAN_ITEMEXTRA,CHANF_OVERLAP,.6);
lastautousetic = gametic;
}
int tgive = 0;
while ( (amount <= (MaxAmount-default.Amount)) && (Owner.CountInv(parent) > 0) )
{