NSSurfacePropEntity: Handle health more appropriately to avoid conflicts,

unbreaks func_button's health behaviour.
This commit is contained in:
Marco Cawthorne 2021-12-29 14:13:08 -08:00
parent cad1dfbcfe
commit 6ca3900b4d
Signed by: eukara
GPG key ID: C196CD8BA993248A
2 changed files with 8 additions and 8 deletions

View file

@ -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();

View file

@ -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();