Prototype/Lamp: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
m (→‎Properties: grammar)
(1.1.51: Prototype/EntityWithOwner added)
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Basics ==
{{Prototype parent|Prototype/EntityWithOwner}}
A lamp to provide light, using energy. Based on [[Prototype/EntityWithHealth]].
A [[lamp]] to provide light, using energy.


== Usage in base ==
{{Prototype TOC|lamp}}
* [[Lamp]]


== Properties ==
== Mandatory properties ==
This prototype inherits all the properties from [[Prototype/EntityWithOwner]].


=== energy_source ===
{{Prototype property|picture_on|[[Types/Sprite|Sprite]]}}
Type: [[Types/EnergySource]]
The lamps graphics when it's on.


The type of energy the lamp uses.
{{Prototype property|picture_off|[[Types/Sprite|Sprite]]}}
The lamps graphics when it's off.


=== energy_usage_per_tick ===
{{Prototype property|energy_usage_per_tick|[[Types/Energy|Energy]]}}
Type: [[Types/Energy]]
The amount of energy the lamp uses. Must be greater than > 0.


The amount of energy the lamp uses.
{{Prototype property|energy_source|[[Types/EnergySource|EnergySource]]}}
Must be an electric or void energy source. The emissions set on the energy source are ignored so lamps cannot produce pollution.


=== light ===
== Optional properties ==
Type: [[Types/LightDefinition]]


{{Prototype property|light|[[Types/LightDefinition|LightDefinition]]|optional=true}}
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 ===
{{Prototype property|light_when_colored|[[Types/LightDefinition|LightDefinition]]|optional=true}}
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.
 
=== 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]]


{{Prototype property|circuit_wire_connection_point|[[Types/WireConnectionPoint|WireConnectionPoint]]|optional=true}}
Defines how wires visually connect to this lamp.
Defines how wires visually connect to this lamp.


=== circuit_wire_max_distance ===
{{Prototype property|circuit_wire_max_distance|[[Types/double|double]]|0|optional=true}}
'''Type''': [[Types/double]]
The maximum circuit wire distance for this entity.
 
'''Default''': 0


The maximum circuit wire distance for this lamp.
{{Prototype property|draw_copper_wires|[[Types/bool|bool]]|true|optional=true}}


=== circuit_connector_sprites ===
{{Prototype property|draw_circuit_wires|[[Types/bool|bool]]|true|optional=true}}
'''Type''': [[Types/CircuitConnectorSprites]]


The pictures displayed for circuit connections to this lamp. Not mandatory.
{{Prototype property|circuit_connector_sprites|[[Types/CircuitConnectorSprites|CircuitConnectorSprites]]|optional=true}}
The pictures displayed for circuit connections to this lamp.


=== glow_size ===
{{Prototype property|glow_size|[[Types/float|float]]|0|optional=true}}
'''Type''': [[Types/float]]


'''Default''': 0
{{Prototype property|glow_color_intensity|[[Types/float|float]]|0|optional=true}}
 
=== glow_color_intensity ===
'''Type''': [[Types/float]]
 
'''Default''': 0
 
=== darkness_for_all_lamps_on ===
'''Type''': [[Types/float]]
 
'''Default''': 0.5


{{Prototype property|darkness_for_all_lamps_on|[[Types/float|float]]|0.5|optional=true}}
darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be between 0 and 1.
darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be between 0 and 1.


=== darkness_for_all_lamps_off ===
{{Prototype property|darkness_for_all_lamps_off|[[Types/float|float]]|0.3|optional=true}}
'''Type''': [[Types/float]]
 
'''Default''': 0.3
 
darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be between 0 and 1.
darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be between 0 and 1.


=== signal_to_color_mapping ===
{{Prototype property|always_on|[[Types/bool|bool]]|false|optional=true}}
'''Type''': [[Types/table]] of [[Types/SignalColorMapping]]
Whether the lamp should always be on.


=== glow_render_mode ===
{{Prototype property|signal_to_color_mapping|[[Types/table|table]] of [[Types/SignalColorMapping|SignalColorMapping]]|optional=true}}
'''Type''': [[Types/string]]
 
'''Default''': "additive"


{{Prototype property|glow_render_mode|[[Types/string|string]]|"additive"|optional=true}}
Options: "additive", "multiplicative"
Options: "additive", "multiplicative"


==Example==
== Example ==
<syntaxhighlight lang="lua">{
<syntaxhighlight lang="lua">{
     type = "lamp",
     type = "lamp",
Line 95: Line 65:
     icon_size = 32,
     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 = {mining_time = 0.1, result = "small-lamp"},
     max_health = 100,
     max_health = 100,
     corpse = "small-remnants",
     corpse = "lamp-remnants",
     collision_box = {{-0.15, -0.15}, {0.15, 0.15}},
     collision_box = {{-0.15, -0.15}, {0.15, 0.15}},
     selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
     selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
Line 113: Line 83:
     glow_size = 6,
     glow_size = 6,
     glow_color_intensity = 0.135,
     glow_color_intensity = 0.135,
     picture_off = {
     picture_off =
    layers = {
    {
      layers =
      {
         {
         {
           filename = "__base__/graphics/entity/small-lamp/lamp.png",
           filename = "__base__/graphics/entity/small-lamp/lamp.png",
Line 124: Line 96:
           direction_count = 1,
           direction_count = 1,
           shift = util.by_pixel(0,3),
           shift = util.by_pixel(0,3),
           hr_version = {
           hr_version =
          {
             filename = "__base__/graphics/entity/small-lamp/hr-lamp.png",
             filename = "__base__/graphics/entity/small-lamp/hr-lamp.png",
             priority = "high",
             priority = "high",
Line 146: Line 119:
           shift = util.by_pixel(4,5),
           shift = util.by_pixel(4,5),
           draw_as_shadow = true,
           draw_as_shadow = true,
           hr_version = {
           hr_version =
          {
             filename = "__base__/graphics/entity/small-lamp/hr-lamp-shadow.png",
             filename = "__base__/graphics/entity/small-lamp/hr-lamp-shadow.png",
             priority = "high",
             priority = "high",
Line 171: Line 145:
       direction_count = 1,
       direction_count = 1,
       shift = util.by_pixel(0, -7),
       shift = util.by_pixel(0, -7),
       hr_version = {
       hr_version =
      {
         filename = "__base__/graphics/entity/small-lamp/hr-lamp-light.png",
         filename = "__base__/graphics/entity/small-lamp/hr-lamp-light.png",
         priority = "high",
         priority = "high",
Line 190: Line 165:
       {type="virtual", name="signal-yellow", color={r=1,g=1,b=0}},
       {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-pink", color={r=1,g=0,b=1}},
       {type="virtual", name="signal-cyan", color={r=0,g=1,b=1}},
       {type="virtual", name="signal-cyan", color={r=0,g=1,b=1}}
     },
     },



Latest revision as of 19:27, 21 January 2022

Prototype definitions » PrototypeBase » Prototype/Entity » Prototype/EntityWithHealth » Prototype/EntityWithOwner » Prototype/Lamp


A lamp to provide light, using energy.


Prototype/Lamp — lamp
energy_source::EnergySource
energy_usage_per_tick::Energy
picture_off::Sprite
picture_on::Sprite
always_on::bool (optional)
circuit_connector_sprites::CircuitConnectorSprites (optional)
circuit_wire_connection_point::WireConnectionPoint (optional)
circuit_wire_max_distance::double (optional)
darkness_for_all_lamps_off::float (optional)
darkness_for_all_lamps_on::float (optional)
draw_circuit_wires::bool (optional)
draw_copper_wires::bool (optional)
glow_color_intensity::float (optional)
glow_render_mode::string (optional)
glow_size::float (optional)
light::LightDefinition (optional)
light_when_colored::LightDefinition (optional)
signal_to_color_mapping::table of SignalColorMapping (optional)
Inherited from Prototype/EntityWithOwner
allow_run_time_change_of_is_military_target::bool (optional)
is_military_target::bool (optional)
Inherited from Prototype/EntityWithHealth
alert_when_damaged::bool (optional)
attack_reaction::AttackReaction (optional)
corpse::string or table of strings (optional)
create_ghost_on_death::bool (optional)
damaged_trigger_effect::TriggerEffect (optional)
dying_explosion::ExplosionDefinition or table of ExplosionDefinition (optional)
dying_trigger_effect::TriggerEffect (optional)
healing_per_tick::float (optional)
hide_resistances::bool (optional)
integration_patch::Sprite4Way (optional)
integration_patch_render_layer::RenderLayer (optional)
loot::Loot (optional)
max_health::float (optional)
random_corpse_variation::bool (optional)
repair_sound::Sound (optional)
repair_speed_modifier::float (optional)
resistances::Resistances (optional)
Inherited from Prototype/Entity
icons, icon, icon_size (IconSpecification)::IconSpecification
additional_pastable_entities::table of string (optional)
alert_icon_scale::float (optional)
alert_icon_shift::vector (optional)
allow_copy_paste::bool (optional)
autoplace::AutoplaceSpecification (optional)
build_base_evolution_requirement::double (optional)
build_grid_size::uint8 (optional)
build_sound::Sound (optional)
close_sound::Sound (optional)
collision_box::BoundingBox (optional)
collision_mask::CollisionMask (optional)
created_effect::Trigger (optional)
created_smoke::CreateTrivialSmokeEffectItem (optional)
drawing_box::BoundingBox (optional)
emissions_per_second::double (optional)
enemy_map_color::Color (optional)
fast_replaceable_group::string (optional)
flags::EntityPrototypeFlags (optional)
friendly_map_color::Color (optional)
hit_visualization_box::BoundingBox (optional)
map_color::Color (optional)
map_generator_bounding_box::BoundingBox (optional)
minable::MinableProperties (optional)
mined_sound::Sound (optional)
mining_sound::Sound (optional)
next_upgrade::string (optional)
open_sound::Sound (optional)
placeable_by::ItemToPlace or table of ItemToPlace (optional)
protected_from_tile_building::bool (optional)
radius_visualisation_specification::RadiusVisualisationSpecification (optional)
remains_when_mined::string or table of string (optional)
remove_decoratives::string (optional)
rotated_sound::Sound (optional)
selectable_in_game::bool (optional)
selection_box::BoundingBox (optional)
selection_priority::uint8 (optional)
shooting_cursor_size::double (optional)
sticker_box::BoundingBox (optional)
subgroup::string (optional)
tile_height::uint32 (optional)
tile_width::uint32 (optional)
trigger_target_mask::TriggerTargetMask (optional)
vehicle_impact_sound::Sound (optional)
water_reflection::WaterReflectionDefinition (optional)
working_sound::WorkingSound (optional)
Inherited from PrototypeBase
name::string
type::string
localised_description::LocalisedString (optional)
localised_name::LocalisedString (optional)
order::Order (optional)

Mandatory properties

This prototype inherits all the properties from Prototype/EntityWithOwner.

picture_on

Type: Sprite
The lamps graphics when it's on.

picture_off

Type: Sprite
The lamps graphics when it's off.

energy_usage_per_tick

Type: Energy
The amount of energy the lamp uses. Must be greater than > 0.

energy_source

Type: EnergySource
Must be an electric or void energy source. The emissions set on the energy source are ignored so lamps cannot produce pollution.

Optional properties

light

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

light_when_colored

Type: LightDefinition
This refers to when the light is in a circuit network, and is lit a certain color based on a Circuit value.

circuit_wire_connection_point

Type: WireConnectionPoint
Defines how wires visually connect to this lamp.

circuit_wire_max_distance

Type: double
Default: 0
The maximum circuit wire distance for this entity.

draw_copper_wires

Type: bool
Default: true

draw_circuit_wires

Type: bool
Default: true

circuit_connector_sprites

Type: CircuitConnectorSprites
The pictures displayed for circuit connections to this lamp.

glow_size

Type: float
Default: 0

glow_color_intensity

Type: float
Default: 0

darkness_for_all_lamps_on

Type: float
Default: 0.5
darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be between 0 and 1.

darkness_for_all_lamps_off

Type: float
Default: 0.3
darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be between 0 and 1.

always_on

Type: bool
Default: false
Whether the lamp should always be on.

signal_to_color_mapping

Type: table of SignalColorMapping

glow_render_mode

Type: 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 = {mining_time = 0.1, result = "small-lamp"},
    max_health = 100,
    corpse = "lamp-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
  }