func_breakable: Be more paranoid about checking health and propdata overrides

This commit is contained in:
Marco Cawthorne 2022-01-03 13:02:56 -08:00
parent d3dcb3a12b
commit 6dcf76ac5d
Signed by: eukara
GPG Key ID: C196CD8BA993248A
1 changed files with 10 additions and 3 deletions

View File

@ -315,17 +315,24 @@ func_breakable::Respawn(void)
takedamage = DAMAGE_YES;
}
/* initially set the health to that of the ent-data */
health = GetSpawnHealth();
if (HasPropData()) {
if (HasPropData() == TRUE) {
/* assign propdata health */
health = GetPropData(PROPINFO_HEALTH);
/* didn't supply valid health */
if (health <= 0)
health = GetSpawnHealth();
m_flExplodeMag = GetPropData(PROPINFO_EXPLOSIVE_DMG);
m_flExplodeRad = GetPropData(PROPINFO_EXPLOSIVE_RADIUS);
}
if (!health) {
/* unassigned health isn't valid */
if (!health)
health = 15;
}
}
void