Page 1 of 1

Adding lighting to an entity in 1.1.30+

Posted: Mon Apr 05, 2021 4:00 pm
by demongo
just wondering how i can add lighting/glow effects to entities... my old methods don't seem to work in the current version anymore :(
in entity.dat:

Code: Select all


    glow_size = 3,
    glow_color_intensity = 3,
    glow_render_mode = "multiplicative",
    light_when_colored = {intensity = 3, size = 3, color = {r=0.4, g=0.8, b=1.2}},
    light = {intensity = 3, size = 3, color = {r=0.4, g=0.8, b=1.2}},
    
even if its by script I'm happy in my limited free time to learn.
note:
(1) It is not meant to have an on/off cycle this is a power distribution building so the only time im ok with the light not working at all is if say no power... im also ok with the light being dimmed based on lack of power supply for example.
(2) This is not a vanilla building and is one that im adding by a mod i am working on.

Re: Adding lighting to an entity in 1.1.30+

Posted: Sat Apr 10, 2021 11:18 am
by Deadlock989
I don't know what you mean by "entity.dat", as far as I know there's no such thing in Factorio mods.

In 1.0 and 1.1 Factorio got a lot more lighting options. Usually these are added to an entity in working visualisations because those give most control over when the animations/lights are displayed. However now almost any Sprite or Animation definition can be rendered as a light using draw_as_glow or draw_as_light so you're no longer restricted to entities which support working visualisations.

You can also use the rendering API's draw_light function in control scripts but from hearsay I'm not sure this scales well for thousands of entities.