LuaTile.get_light_level()
LuaTile.get_light_level()
Can has a method to get the light level on a surface's x,y position (or a LuaTile) please?
-
- Manual Inserter
- Posts: 4
- Joined: Sat Oct 12, 2019 12:13 pm
- Contact:
Re: LuaTile.get_light_level()
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
AFAIK light level is only at the surface-level and you can get it from LuaSurface.darkness
Re: LuaTile.get_light_level()
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:
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:
-
- Manual Inserter
- Posts: 4
- Joined: Sat Oct 12, 2019 12:13 pm
- Contact:
Re: LuaTile.get_light_level()
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:
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()
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()
No lamp-powered solar panels.
Re: LuaTile.get_light_level()
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).
If you want to get ahold of me I'm almost always on Discord.