Types/DaytimeColorLookupTable: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(image can also be arranged vertically. Thanks for the description)
(Updated styling of prototype doc migration note)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<div class="stub"><p>'''The prototype docs have moved to a new website with an improved format.''' This documentation page can now be found here: [https://lua-api.factorio.com/latest/types/DaytimeColorLookupTable.html https://lua-api.factorio.com/latest/types/DaytimeColorLookupTable.html]
</p><p>This wiki page is no longer updated and '''will be removed at some point in the future''', so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback [https://forums.factorio.com/viewforum.php?f=233 on the forums].</p></div>
An [[Types/table|array]] of [[Types/table|arrays]].
An [[Types/table|array]] of [[Types/table|arrays]].


Line 11: Line 17:


Only one inner array means that the LUT will be used all the time, regardless of the value of the first member.
Only one inner array means that the LUT will be used all the time, regardless of the value of the first member.
The interpolation doesn't work correctly at the in-game noon because the value of the first timestamp is greater that the value of the second one.
This problem can be bypassed by moving the first value at the beginning of the list and subtracting 1 from it (making it negative).
The opposite way of moving the second value to the end and adding 1 to it also works.


=== Second member ===
=== Second member ===

Latest revision as of 10:42, 21 September 2023

The prototype docs have moved to a new website with an improved format. This documentation page can now be found here: https://lua-api.factorio.com/latest/types/DaytimeColorLookupTable.html

This wiki page is no longer updated and will be removed at some point in the future, so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback on the forums.


An array of arrays.

The first member of the inner array must be a double, second member of the inner array must be a FileName or "identity". The file pointed to by the filename must be a sprite of size 256×16 or 16×256.

Inner array

First member

The first member states at which time of the day the LUT should be used.

If the current game time is between two values defined in the color lookup that have different LUTs, the color is interpolated to create a smooth transition. (Sharp transition can be achieved by having the two values differing only by a small fraction.)

Only one inner array means that the LUT will be used all the time, regardless of the value of the first member.

Second member

The second member is a lookup table (LUT) for the color which maps the original color to a position in the sprite where is the replacement color is found.

Example

color_lookup = {{1, "identity"}}
color_lookup = {{0.5, "__core__/graphics/color_luts/nightvision.png"}}
zoom_to_world_daytime_color_lookup =
{
  {0.25, "identity"},
  {0.45, "__core__/graphics/color_luts/night.png"},
  {0.55, "__core__/graphics/color_luts/night.png"},
  {0.75, "identity"},
},