LuaTile.get_light_level()

Things that we aren't going to implement
Post Reply
PyroFire
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue Mar 08, 2016 8:18 am
Contact:

LuaTile.get_light_level()

Post by PyroFire »

Can has a method to get the light level on a surface's x,y position (or a LuaTile) please?

captain828
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Oct 12, 2019 12:13 pm
Contact:

Re: LuaTile.get_light_level()

Post 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

PyroFire
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: LuaTile.get_light_level()

Post 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:

Image

captain828
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Oct 12, 2019 12:13 pm
Contact:

Re: LuaTile.get_light_level()

Post 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)

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2250
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: LuaTile.get_light_level()

Post 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.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: LuaTile.get_light_level()

Post by darkfrei »

No lamp-powered solar panels.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: LuaTile.get_light_level()

Post 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).
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Won't implement”