Fixed possible recursion bug with breakables and other dead-triggers.

This commit is contained in:
Marco Cawthorne 2020-03-29 21:39:32 +02:00
parent 19a4db076b
commit ea5851a8f5
2 changed files with 7 additions and 1 deletions

View file

@ -165,6 +165,7 @@ void func_breakable::Death(int body)
void func_breakable::Trigger(void) void func_breakable::Trigger(void)
{ {
if (health > 0)
func_breakable::Death(0); func_breakable::Death(0);
} }

View file

@ -40,6 +40,11 @@ Damage_Apply(entity t, entity c, float dmg, int w, int type)
return; return;
} }
/* already dead, please avoid recursion */
if (t.health <= 0) {
return;
}
/* skip armor */ /* skip armor */
if not (type & DMG_SKIP_ARMOR) if not (type & DMG_SKIP_ARMOR)
if (t.armor && dmg > 0) { if (t.armor && dmg > 0) {