NSSurfacePropEntity: Keep track if .health is ever set manually, take that

and PropData info into account for determining if any child classes will
'break' by default
This commit is contained in:
Marco Cawthorne 2021-11-21 03:57:18 +01:00
parent eb85121716
commit a2f8fd0a5d
Signed by: eukara
GPG key ID: C196CD8BA993248A

View file

@ -90,8 +90,19 @@ NSSurfacePropEntity::IsOnFire(void)
void
NSSurfacePropEntity::Respawn(void)
{
float sh = GetSpawnHealth();
NSRenderableEntity::Respawn();
health = GetSpawnHealth();
if (HasPropData() && sh == -1) {
health = (float)GetPropData(PROPINFO_HEALTH);
} else {
health = sh;
}
if (health > 0)
takedamage = DAMAGE_YES;
else
takedamage = DAMAGE_NO;
}
void
@ -263,6 +274,7 @@ NSSurfacePropEntity::NSSurfacePropEntity(void)
#ifdef SERVER
m_iPropData = -1;
m_iMaterial = -1;
health = -1;
super::NSRenderableEntity();