Prototype/Lamp: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(A page for the Lamp Prototype Definition.)
 
(0.16.23)
Line 12: Line 12:
The type of energy the lamp uses.
The type of energy the lamp uses.


=== energy_usage ===
=== energy_usage_per_tick ===
Type: [[Types/EnergyUsage]]
Type: [[Types/Energy]]


The amount of energy the lamp uses.
The amount of energy the lamp uses.


=== light ===
=== light ===
Type: [[Types/Light]]
Type: [[Types/LightDefinition]]


What color the lamp will be when it is on, and receiving power.
What color the lamp will be when it is on, and receiving power.


=== light_when_colored ===
=== light_when_colored ===
Type: [[Types/Light]]
Type: [[Types/LightDefinition]]


This refers to when the light is in a Circuit Network, and is lit a certain color based on a Circuit value.
This refers to when the light is in a Circuit Network, and is lit a certain color based on a Circuit value.
Line 36: Line 36:


The lamp's entity if it's off.
The lamp's entity if it's off.
=== circuit_wire_connection_point ===
'''Type''': [[Types/WireConnectionPoint]]
Defines how wires visually connect to this lamp.
=== circuit_wire_max_distance ===
'''Type''': [[Types/double]]
'''Default''': 0
The maximum circuit wire distance for this lamp.
=== circuit_connector_sprites ===
'''Type''': [[Types/CircuitConnectorSprites]]
The pictures displayed for circuit connections to this lamp. Not mandatory.
=== glow_size ===
'''Type''': [[Types/float]]
'''Default''': 0
=== glow_color_intensity ===
'''Type''': [[Types/float]]
'''Default''': 0
=== darkness_for_all_lamps_on ===
'''Type''': [[Types/float]]
'''Default''': 0.5
darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be from 0 to 1.
=== darkness_for_all_lamps_off ===
'''Type''': [[Types/float]]
'''Default''': 0.3
darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be from 0 to 1.
=== signal_to_color_mapping ===
'''Type''': [[Types/table]] of [[Types/SignalColorMapping]]
=== glow_render_mode ===
'''Type''': [[Types/string]]
'''Default''': "additive"
Options: "additive", "multiplicative"


==Example==
==Example==
  {
<syntaxhighlight lang="lua">{
     type = "lamp",
     type = "lamp",
     name = "small-lamp",
     name = "small-lamp",
     icon = "__base__/graphics/icons/small-lamp.png",
     icon = "__base__/graphics/icons/small-lamp.png",
    icon_size = 32,
     flags = {"placeable-neutral", "player-creation"},
     flags = {"placeable-neutral", "player-creation"},
     minable = {hardness = 0.2, mining_time = 0.5, result = "small-lamp"},
     minable = {hardness = 0.2, mining_time = 0.5, result = "small-lamp"},
Line 52: Line 104:
     {
     {
       type = "electric",
       type = "electric",
       usage_priority = "secondary-input"
       usage_priority = "lamp"
     },
     },
     energy_usage_per_tick = "5KW",
     energy_usage_per_tick = "5KW",
    darkness_for_all_lamps_on = 0.5,
    darkness_for_all_lamps_off = 0.3,
     light = {intensity = 0.9, size = 40, color = {r=1.0, g=1.0, b=1.0}},
     light = {intensity = 0.9, size = 40, color = {r=1.0, g=1.0, b=1.0}},
     light_when_colored = {intensity = 1, size = 6, color = {r=1.0, g=1.0, b=1.0}},
     light_when_colored = {intensity = 1, size = 6, color = {r=1.0, g=1.0, b=1.0}},
     glow_size = 6,
     glow_size = 6,
     glow_color_intensity = 0.135,
     glow_color_intensity = 0.135,
     picture_off =
     picture_off = {
    layers = {
        {
          filename = "__base__/graphics/entity/small-lamp/lamp.png",
          priority = "high",
          width = 42,
          height = 36,
          frame_count = 1,
          axially_symmetrical = false,
          direction_count = 1,
          shift = util.by_pixel(0,3),
          hr_version = {
            filename = "__base__/graphics/entity/small-lamp/hr-lamp.png",
            priority = "high",
            width = 83,
            height = 70,
            frame_count = 1,
            axially_symmetrical = false,
            direction_count = 1,
            shift = util.by_pixel(0.25,3),
            scale = 0.5
          }
        },
        {
          filename = "__base__/graphics/entity/small-lamp/lamp-shadow.png",
          priority = "high",
          width = 38,
          height = 24,
          frame_count = 1,
          axially_symmetrical = false,
          direction_count = 1,
          shift = util.by_pixel(4,5),
          draw_as_shadow = true,
          hr_version = {
            filename = "__base__/graphics/entity/small-lamp/hr-lamp-shadow.png",
            priority = "high",
            width = 76,
            height = 47,
            frame_count = 1,
            axially_symmetrical = false,
            direction_count = 1,
            shift = util.by_pixel(4, 4.75),
            draw_as_shadow = true,
            scale = 0.5
          }
        }
      }
    },
    picture_on =
     {
     {
       filename = "__base__/graphics/entity/small-lamp/light-off.png",
       filename = "__base__/graphics/entity/small-lamp/lamp-light.png",
       priority = "high",
       priority = "high",
       width = 67,
       width = 46,
       height = 58,
       height = 40,
       frame_count = 1,
       frame_count = 1,
       axially_symmetrical = false,
       axially_symmetrical = false,
       direction_count = 1,
       direction_count = 1,
       shift = {-0.015625, 0.15625},
       shift = util.by_pixel(0, -7),
      hr_version = {
        filename = "__base__/graphics/entity/small-lamp/hr-lamp-light.png",
        priority = "high",
        width = 90,
        height = 78,
        frame_count = 1,
        axially_symmetrical = false,
        direction_count = 1,
        shift = util.by_pixel(0, -7),
        scale = 0.5
      }
     },
     },
     picture_on =
     signal_to_color_mapping =
     {
     {
       filename = "__base__/graphics/entity/small-lamp/light-on-patch.png",
       {type="virtual", name="signal-red", color={r=1,g=0,b=0}},
       priority = "high",
       {type="virtual", name="signal-green", color={r=0,g=1,b=0}},
       width = 62,
       {type="virtual", name="signal-blue", color={r=0,g=0,b=1}},
       height = 62,
       {type="virtual", name="signal-yellow", color={r=1,g=1,b=0}},
       frame_count = 1,
       {type="virtual", name="signal-pink", color={r=1,g=0,b=1}},
      axially_symmetrical = false,
       {type="virtual", name="signal-cyan", color={r=0,g=1,b=1}},
      direction_count = 1,
       shift = {-0.03125, -0.03125},
     },
     },
    circuit_wire_connection_point = circuit_connector_definitions["lamp"].points,
    circuit_connector_sprites = circuit_connector_definitions["lamp"].sprites,
    circuit_wire_max_distance = default_circuit_wire_max_distance
  }</syntaxhighlight>

Revision as of 20:10, 6 February 2018

Basics

A lamp to provide light, using energy. Based on Prototype/EntityWithHealth.

Usage in base

Properties

energy_source

Type: Types/EnergySource

The type of energy the lamp uses.

energy_usage_per_tick

Type: Types/Energy

The amount of energy the lamp uses.

light

Type: Types/LightDefinition

What color the lamp will be when it is on, and receiving power.

light_when_colored

Type: Types/LightDefinition

This refers to when the light is in a Circuit Network, and is lit a certain color based on a Circuit value.

picture_on

Type: Types/Sprite

The lamp's entity if it's on.

picture_off

Type: Types/Sprite

The lamp's entity if it's off.

circuit_wire_connection_point

Type: Types/WireConnectionPoint

Defines how wires visually connect to this lamp.

circuit_wire_max_distance

Type: Types/double

Default: 0

The maximum circuit wire distance for this lamp.

circuit_connector_sprites

Type: Types/CircuitConnectorSprites

The pictures displayed for circuit connections to this lamp. Not mandatory.

glow_size

Type: Types/float

Default: 0

glow_color_intensity

Type: Types/float

Default: 0

darkness_for_all_lamps_on

Type: Types/float

Default: 0.5

darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be from 0 to 1.

darkness_for_all_lamps_off

Type: Types/float

Default: 0.3

darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be from 0 to 1.

signal_to_color_mapping

Type: Types/table of Types/SignalColorMapping

glow_render_mode

Type: Types/string

Default: "additive"

Options: "additive", "multiplicative"

Example

{
    type = "lamp",
    name = "small-lamp",
    icon = "__base__/graphics/icons/small-lamp.png",
    icon_size = 32,
    flags = {"placeable-neutral", "player-creation"},
    minable = {hardness = 0.2, mining_time = 0.5, result = "small-lamp"},
    max_health = 100,
    corpse = "small-remnants",
    collision_box = {{-0.15, -0.15}, {0.15, 0.15}},
    selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
    vehicle_impact_sound =  { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
    energy_source =
    {
      type = "electric",
      usage_priority = "lamp"
    },
    energy_usage_per_tick = "5KW",
    darkness_for_all_lamps_on = 0.5,
    darkness_for_all_lamps_off = 0.3,
    light = {intensity = 0.9, size = 40, color = {r=1.0, g=1.0, b=1.0}},
    light_when_colored = {intensity = 1, size = 6, color = {r=1.0, g=1.0, b=1.0}},
    glow_size = 6,
    glow_color_intensity = 0.135,
    picture_off = {
    layers = {
        {
          filename = "__base__/graphics/entity/small-lamp/lamp.png",
          priority = "high",
          width = 42,
          height = 36,
          frame_count = 1,
          axially_symmetrical = false,
          direction_count = 1,
          shift = util.by_pixel(0,3),
          hr_version = {
            filename = "__base__/graphics/entity/small-lamp/hr-lamp.png",
            priority = "high",
            width = 83,
            height = 70,
            frame_count = 1,
            axially_symmetrical = false,
            direction_count = 1,
            shift = util.by_pixel(0.25,3),
            scale = 0.5
          }
        },
        {
          filename = "__base__/graphics/entity/small-lamp/lamp-shadow.png",
          priority = "high",
          width = 38,
          height = 24,
          frame_count = 1,
          axially_symmetrical = false,
          direction_count = 1,
          shift = util.by_pixel(4,5),
          draw_as_shadow = true,
          hr_version = {
            filename = "__base__/graphics/entity/small-lamp/hr-lamp-shadow.png",
            priority = "high",
            width = 76,
            height = 47,
            frame_count = 1,
            axially_symmetrical = false,
            direction_count = 1,
            shift = util.by_pixel(4, 4.75),
            draw_as_shadow = true,
            scale = 0.5
          }
        }
      }
    },
    picture_on =
    {
      filename = "__base__/graphics/entity/small-lamp/lamp-light.png",
      priority = "high",
      width = 46,
      height = 40,
      frame_count = 1,
      axially_symmetrical = false,
      direction_count = 1,
      shift = util.by_pixel(0, -7),
      hr_version = {
        filename = "__base__/graphics/entity/small-lamp/hr-lamp-light.png",
        priority = "high",
        width = 90,
        height = 78,
        frame_count = 1,
        axially_symmetrical = false,
        direction_count = 1,
        shift = util.by_pixel(0, -7),
        scale = 0.5
      }
    },
    signal_to_color_mapping =
    {
      {type="virtual", name="signal-red", color={r=1,g=0,b=0}},
      {type="virtual", name="signal-green", color={r=0,g=1,b=0}},
      {type="virtual", name="signal-blue", color={r=0,g=0,b=1}},
      {type="virtual", name="signal-yellow", color={r=1,g=1,b=0}},
      {type="virtual", name="signal-pink", color={r=1,g=0,b=1}},
      {type="virtual", name="signal-cyan", color={r=0,g=1,b=1}},
    },

    circuit_wire_connection_point = circuit_connector_definitions["lamp"].points,
    circuit_connector_sprites = circuit_connector_definitions["lamp"].sprites,
    circuit_wire_max_distance = default_circuit_wire_max_distance
  }