Page 1 of 1
LuaTile.get_light_level()
Posted: Fri Oct 25, 2019 5:06 pm
by PyroFire
Can has a method to get the light level on a surface's x,y position (or a LuaTile) please?
Re: LuaTile.get_light_level()
Posted: Fri Oct 25, 2019 8:35 pm
by captain828
What do you mean by light level? related to the day-night schedule or something else?
AFAIK light level is only at the surface-level and you can get it from LuaSurface.darkness
Re: LuaTile.get_light_level()
Posted: Sat Oct 26, 2019 4:45 am
by PyroFire
Another name for this function could be LuaTile.get_luminosity()
The use is to return some value showing how "lit" a given position is, taking into account things like lamps, time of day, darkness and the player flashlight.
Screenshot illustrating what i'm hoping to get from this request:
Re: LuaTile.get_light_level()
Posted: Sat Oct 26, 2019 11:14 am
by captain828
Ah, okay.
Not sure if it would make sense to keep this info at the tile level though as there are many things that can affect a tile's light + there could be an object covering the tile.
All that sounds expensive to keep per-tile as it is outside the scope of a single tile and would have to be recalculated every time an entity is added + the tod changes.
A higher-level LuaLighting might make more sense from an engine perspective - it could act as an opacity layer and you could request the light level at x, y and it would return the opacity (float 0-1), where 0 is max light and 1 pitch black.
So something like this:
Code: Select all
LuaLighting.get_opacity(surface, x, y)
Re: LuaTile.get_light_level()
Posted: Sat Oct 26, 2019 11:30 am
by boskid
It is not going to happen. Light levels are rendered from png and so headless server would not be able to compute this values.
Re: LuaTile.get_light_level()
Posted: Sat Oct 26, 2019 4:42 pm
by darkfrei
No lamp-powered solar panels.
Re: LuaTile.get_light_level()
Posted: Sat Oct 26, 2019 7:26 pm
by Rseding91
boskid wrote: ↑Sat Oct 26, 2019 11:30 am
It is not going to happen. Light levels are rendered from png and so headless server would not be able to compute this values.
Graphics in general are not deterministic (different qualities/settings/resolutions). There's no supported system to read light level at a specific tile. It's all just rendering (or lack of rendering the dark overlay on the game).