/*================ func_lightstyle This entity creates a custom lightstyle that other lights can use. It isn't used to emit any of its own light. ================*/ entity lightstyles; void() lightstyle_use = { //bprint("toggle lightstyle\n"); if (self.spawnflags & START_OFF || self.spawnflags & 2) // 2 is just turn on again { lightstyle(self.style, self.message); if(self.spawnflags & START_OFF) self.spawnflags = self.spawnflags - START_OFF; } else { lightstyle(self.style, "a"); self.spawnflags = self.spawnflags + START_OFF; } }; void() func_lightstyle = { if(self.style > 63) dprint("Warning: style > 63! Invalid range?"); if(self.style <= 11) dprint("Warning: style <= 11: Old styles overwritten!"); // allow the user to enter any value at his own risk if (!self.spawnflags & START_OFF) lightstyle(self.style, self.message); if (self.targetname == "") { //dprint("no lightstyle targetname\n"); remove(self); return; } self.use = lightstyle_use; if (self.spawnflags & START_OFF) lightstyle(self.style, "a"); self.enemy = lightstyles; lightstyles = self; };