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_flSpeed;
float m_flLip; float m_flLip;
int m_iDamage;
int m_iState; int m_iState;
vector m_vecPos1; vector m_vecPos1;
vector m_vecPos2; vector m_vecPos2;
@ -261,10 +260,6 @@ func_button::Use(void)
void void
func_button::Blocked(void) func_button::Blocked(void)
{ {
if (m_iDamage) {
//Damage_Apply(other, this, dmg, other.origin, FALSE);
}
if (m_flWait >= 0) { if (m_flWait >= 0) {
if (m_iState == STATE_DOWN) { if (m_iState == STATE_DOWN) {
MoveAway(); MoveAway();

View file

@ -114,6 +114,7 @@ NSSurfacePropEntity::Save(float handle)
SaveFloat(handle,"m_flBurnTime", m_flBurnTime); SaveFloat(handle,"m_flBurnTime", m_flBurnTime);
SaveFloat(handle, "m_flBurnNext", m_flBurnNext); SaveFloat(handle, "m_flBurnNext", m_flBurnNext);
SaveString(handle, "m_strOnBreak", m_strOnBreak); SaveString(handle, "m_strOnBreak", m_strOnBreak);
SaveFloat(handle, "health", health);
SaveFloat(handle, "m_oldHealth", m_oldHealth); SaveFloat(handle, "m_oldHealth", m_oldHealth);
SaveInt(handle, "m_iMaterial", m_iMaterial); SaveInt(handle, "m_iMaterial", m_iMaterial);
SaveInt(handle, "m_iPropData", m_iPropData); SaveInt(handle, "m_iPropData", m_iPropData);
@ -140,6 +141,9 @@ NSSurfacePropEntity::Restore(string strKey, string strValue)
case "m_strOnBreak": case "m_strOnBreak":
m_strOnBreak = ReadString(strValue); m_strOnBreak = ReadString(strValue);
break; break;
case "health":
health = ReadFloat(strValue);
break;
case "m_oldHealth": case "m_oldHealth":
m_oldHealth = ReadFloat(strValue); m_oldHealth = ReadFloat(strValue);
break; break;
@ -176,6 +180,10 @@ void
NSSurfacePropEntity::SpawnKey(string strKey, string strValue) NSSurfacePropEntity::SpawnKey(string strKey, string strValue)
{ {
switch (strKey) { switch (strKey) {
case "health":
health = stof(strValue);
m_oldHealth = health;
break;
case "propdata": case "propdata":
SetPropData(strValue); SetPropData(strValue);
break; break;
@ -276,9 +284,6 @@ NSSurfacePropEntity::NSSurfacePropEntity(void)
super::NSRenderableEntity(); super::NSRenderableEntity();
/* after spawn init */
m_oldHealth = health;
/* tokenization complete, now we can load propdata */ /* tokenization complete, now we can load propdata */
SurfaceDataFinish(); SurfaceDataFinish();
PropDataFinish(); PropDataFinish();