From a2f8fd0a5d20e052cd8b7504026e55b48ae02fb6 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sun, 21 Nov 2021 03:57:18 +0100 Subject: [PATCH] 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 --- src/gs-entbase/shared/NSSurfacePropEntity.qc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gs-entbase/shared/NSSurfacePropEntity.qc b/src/gs-entbase/shared/NSSurfacePropEntity.qc index 9c33dd40..2c19d854 100644 --- a/src/gs-entbase/shared/NSSurfacePropEntity.qc +++ b/src/gs-entbase/shared/NSSurfacePropEntity.qc @@ -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();