Screenshots
https://i.postimg.cc/LXRK1bRz/Screensho ... 185013.png
https://i.postimg.cc/LXTdB36G/Screensho ... 185025.png
This works similar to the former when the WorldLoaded event fires:
Code: Select all
class brighter_EventHandler : EventHandler
{
struct thingcolor
{
string cname;
color lightcolor;
int radius;
int flags;
vector3 offset;
}
thingcolor ThingColors[50];
int thingCounter;
void AddThingColor(string cname, string lightcolor, int radius, int flags, vector3 offset)
{
ThingColors[thingCounter].cname = cname;
ThingColors[thingCounter].lightcolor = lightcolor;
ThingColors[thingCounter].radius = radius;
ThingColors[thingCounter].flags = flags;
ThingColors[thingCounter].offset = offset;
thingCounter++;
}
void LoadColors()
{
thingCounter = 0;
// static lights loaded with level
AddThingColor("Column", "#ffff00", 64, DynamicLight.LF_ATTENUATE | DynamicLight.LF_NOSHADOWMAP, (0, 0, 46));
AddThingColor("Candelabra", "#ffff00", 32, DynamicLight.LF_ATTENUATE | DynamicLight.LF_NOSHADOWMAP, (0, 0, 60));
AddThingColor("ExplosiveBarrel", "#00ff00", 64, DynamicLight.LF_ATTENUATE, (0, 0, 45));
}
override
void WorldLoaded(WorldEvent e)
{
LoadColors();
float br_strength = Cvar.FindCvar("br_strength").GetFloat();
ThinkerIterator lightFinder = ThinkerIterator.Create("Actor", Thinker.STAT_DEFAULT);
Actor mo;
while (mo = Actor(lightFinder.Next()))
{
string cn = mo.GetReplacee(mo.GetClassName()).GetClassName();
// console.printf("%s", cn);
for (int i = 0; i < thingCounter; i++)
{
if (cn == ThingColors[i].cname)
{
mo.A_AttachLight(ThingColors[i].cname, DynamicLight.SectorLight, ThingColors[i].lightcolor,
ThingColors[i].radius * br_strength, 0, ThingColors[i].flags, ThingColors[i].offset);
break;
}
}
}
}
}
It's an idea that seems to work. Perhaps, options unavailable in GLDEFS may be added.