Types/LightDefinition: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Created page with "Uses Types/float to specify {| class="wikitable" |- ! name !! meaning !! type |- | intensity || brightness of light || float |- | size || area affected ||...")
 
(Updated styling of prototype doc migration note)
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Uses [[Types/float]] to specify
<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/LightDefinition.html https://lua-api.factorio.com/latest/types/LightDefinition.html]


{| class="wikitable"
</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>
|-
 
! name !! meaning !! type
 
|-
 
| intensity || brightness of light || [[Types/float|float]]
Either a table with the properties listed below or an [[Types/table|array]] of tables with the below properties. Specifies a light source.
|-
 
| size || area affected || [[Types/float|float]]
== Mandatory properties ==
|-
=== type ===
| color || [optional] color of light || [[Types/color|color]]
'''Type''': [[Types/string]]
|}
 
'''Default''': "basic"
 
Either "basic" or "oriented". If the type is "oriented", the following properties are read additionally to the other properties:
 
* picture - [[Types/Sprite]], mandatory
* rotation_shift - [[Types/RealOrientation]], optional
 
=== intensity ===
'''Type''': [[Types/float]]
 
Brightness of the light in the range [0, 1] where 0 is no light and 1 is the maximum light.
<syntaxhighlight lang="lua">intensity = 0.5</syntaxhighlight>
=== size ===
'''Type''': [[Types/float]]
 
The radius of the light in tiles.
Note, that the light gets darker near the edges, so the effective size of the light seems to be smaller.
<syntaxhighlight lang="lua">size = 15 -- big light source</syntaxhighlight>
 
== Optional properties ==
 
=== source_orientation_offset ===
'''Type''': [[Types/RealOrientation]]
 
'''Default''': 0
 
=== add_perspective ===
'''Type''': [[Types/bool]]
 
'''Default''': false
 
=== shift ===
'''Type''': [[Types/vector]]
 
=== color ===
'''Type''': [[Types/Color]]
 
'''Default''': Light has no color
 
Color of the light.
 
=== minimum_darkness ===
'''Type''': [[Types/float]]
 
'''Default''': 0
 
== Example ==
The light of the orange state of the rail signal.
<syntaxhighlight lang="lua">orange_light = {intensity = 0.2, size = 4, color={r=1, g=0.5}}</syntaxhighlight>
 
The front lights of the car:
<syntaxhighlight lang="lua">light =
{
  {
    type = "oriented",
    minimum_darkness = 0.3,
    picture =
    {
      filename = "__core__/graphics/light-cone.png",
      priority = "extra-high",
      flags = { "light" },
      scale = 2,
      width = 200,
      height = 200
    },
    shift = {-0.6, -14},
    size = 2,
    intensity = 0.6,
    color = {r = 0.92, g = 0.77, b = 0.3}
  },
  {
    type = "oriented",
    minimum_darkness = 0.3,
    picture =
    {
      filename = "__core__/graphics/light-cone.png",
      priority = "extra-high",
      flags = { "light" },
      scale = 2,
      width = 200,
      height = 200
    },
    shift = {0.6, -14},
    size = 2,
    intensity = 0.6,
    color = {r = 0.92, g = 0.77, b = 0.3}
  }
}</syntaxhighlight>
 
{{Prototype property type usage|{{FULLPAGENAME}}}}

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/LightDefinition.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.


Either a table with the properties listed below or an array of tables with the below properties. Specifies a light source.

Mandatory properties

type

Type: Types/string

Default: "basic"

Either "basic" or "oriented". If the type is "oriented", the following properties are read additionally to the other properties:

intensity

Type: Types/float

Brightness of the light in the range [0, 1] where 0 is no light and 1 is the maximum light.

intensity = 0.5

size

Type: Types/float

The radius of the light in tiles. Note, that the light gets darker near the edges, so the effective size of the light seems to be smaller.

size = 15 -- big light source

Optional properties

source_orientation_offset

Type: Types/RealOrientation

Default: 0

add_perspective

Type: Types/bool

Default: false

shift

Type: Types/vector

color

Type: Types/Color

Default: Light has no color

Color of the light.

minimum_darkness

Type: Types/float

Default: 0

Example

The light of the orange state of the rail signal.

orange_light = {intensity = 0.2, size = 4, color={r=1, g=0.5}}

The front lights of the car:

light =
{
  {
    type = "oriented",
    minimum_darkness = 0.3,
    picture =
    {
      filename = "__core__/graphics/light-cone.png",
      priority = "extra-high",
      flags = { "light" },
      scale = 2,
      width = 200,
      height = 200
    },
    shift = {-0.6, -14},
    size = 2,
    intensity = 0.6,
    color = {r = 0.92, g = 0.77, b = 0.3}
  },
  {
    type = "oriented",
    minimum_darkness = 0.3,
    picture =
    {
      filename = "__core__/graphics/light-cone.png",
      priority = "extra-high",
      flags = { "light" },
      scale = 2,
      width = 200,
      height = 200
    },
    shift = {0.6, -14},
    size = 2,
    intensity = 0.6,
    color = {r = 0.92, g = 0.77, b = 0.3}
  }
}

Prototype properties that use this type