From 6ca3900b4d111667339e2f1267a9dd052929c370 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Wed, 29 Dec 2021 14:13:08 -0800 Subject: [PATCH] NSSurfacePropEntity: Handle health more appropriately to avoid conflicts, unbreaks func_button's health behaviour. --- src/gs-entbase/server/func_button.qc | 5 ----- src/gs-entbase/shared/NSSurfacePropEntity.qc | 11 ++++++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gs-entbase/server/func_button.qc b/src/gs-entbase/server/func_button.qc index 70df65f2..82c3ff67 100644 --- a/src/gs-entbase/server/func_button.qc +++ b/src/gs-entbase/server/func_button.qc @@ -82,7 +82,6 @@ class func_button:NSSurfacePropEntity { float m_flSpeed; float m_flLip; - int m_iDamage; int m_iState; vector m_vecPos1; vector m_vecPos2; @@ -261,10 +260,6 @@ func_button::Use(void) void func_button::Blocked(void) { - if (m_iDamage) { - //Damage_Apply(other, this, dmg, other.origin, FALSE); - } - if (m_flWait >= 0) { if (m_iState == STATE_DOWN) { MoveAway(); diff --git a/src/gs-entbase/shared/NSSurfacePropEntity.qc b/src/gs-entbase/shared/NSSurfacePropEntity.qc index 3960567c..65c26d5d 100644 --- a/src/gs-entbase/shared/NSSurfacePropEntity.qc +++ b/src/gs-entbase/shared/NSSurfacePropEntity.qc @@ -114,6 +114,7 @@ NSSurfacePropEntity::Save(float handle) SaveFloat(handle,"m_flBurnTime", m_flBurnTime); SaveFloat(handle, "m_flBurnNext", m_flBurnNext); SaveString(handle, "m_strOnBreak", m_strOnBreak); + SaveFloat(handle, "health", health); SaveFloat(handle, "m_oldHealth", m_oldHealth); SaveInt(handle, "m_iMaterial", m_iMaterial); SaveInt(handle, "m_iPropData", m_iPropData); @@ -140,6 +141,9 @@ NSSurfacePropEntity::Restore(string strKey, string strValue) case "m_strOnBreak": m_strOnBreak = ReadString(strValue); break; + case "health": + health = ReadFloat(strValue); + break; case "m_oldHealth": m_oldHealth = ReadFloat(strValue); break; @@ -176,6 +180,10 @@ void NSSurfacePropEntity::SpawnKey(string strKey, string strValue) { switch (strKey) { + case "health": + health = stof(strValue); + m_oldHealth = health; + break; case "propdata": SetPropData(strValue); break; @@ -276,9 +284,6 @@ NSSurfacePropEntity::NSSurfacePropEntity(void) super::NSRenderableEntity(); - /* after spawn init */ - m_oldHealth = health; - /* tokenization complete, now we can load propdata */ SurfaceDataFinish(); PropDataFinish();