light: make sure lightstyles reset upon round respawn

This commit is contained in:
Marco Cawthorne 2019-01-15 22:29:04 +01:00
parent f13cb921b3
commit 95b60757e7

View file

@ -11,18 +11,29 @@ class light : CBaseTrigger
string m_strPattern; string m_strPattern;
int m_iEnabled; int m_iEnabled;
float m_flStyle; float m_flStyle;
void() light; void() light;
virtual void() Trigger; virtual void() Trigger;
virtual void() Respawn;
}; };
void light::Trigger(void) void light::Trigger(void)
{ {
if (m_iEnabled == TRUE) { if (m_iEnabled == TRUE) {
//dprint( "light: Turned off!\n" );
lightstyle(m_flStyle, "a"); lightstyle(m_flStyle, "a");
m_iEnabled = FALSE; m_iEnabled = FALSE;
} else { } else {
//dprint( "light: Turned on!\n" ); lightstyle(m_flStyle, m_strPattern);
m_iEnabled = TRUE;
}
}
void light::Respawn(void)
{
if (spawnflags & 1) {
lightstyle(m_flStyle, "a");
m_iEnabled = FALSE;
} else {
lightstyle(m_flStyle, m_strPattern); lightstyle(m_flStyle, m_strPattern);
m_iEnabled = TRUE; m_iEnabled = TRUE;
} }
@ -44,21 +55,11 @@ void light :: light ( void )
} }
} }
/*if ( !m_strPattern ) {
m_strPattern = getlightstyle( m_flStyle );
}*/
if (!m_strPattern) { if (!m_strPattern) {
m_strPattern = "m"; m_strPattern = "m";
} }
if ( spawnflags & 1 ) { light::Respawn();
lightstyle( m_flStyle, "a" );
m_iEnabled = FALSE;
} else {
lightstyle( m_flStyle, m_strPattern );
m_iEnabled = TRUE;
}
} }
CLASSEXPORT(light_spot, light) CLASSEXPORT(light_spot, light)