Prototype/Lamp: Difference between revisions
(Set prototype parent) |
(Converted to SMW format) |
||
Line 1: | Line 1: | ||
{{Prototype parent|Prototype/EntityWithHealth}} | {{Prototype parent|Prototype/EntityWithHealth}} | ||
A [[lamp]] to provide light, using energy. | |||
{{Prototype TOC|lamp}} | |||
Prototype | |||
== Mandatory properties == | == Mandatory properties == | ||
This prototype inherits all the properties from [[Prototype/EntityWithHealth]]. | This prototype inherits all the properties from [[Prototype/EntityWithHealth]]. | ||
{{Prototype property|picture_on|[[Types/Sprite|Sprite]]}} | |||
The lamps graphics when it's on. | The lamps graphics when it's on. | ||
{{Prototype property|picture_off|[[Types/Sprite|Sprite]]}} | |||
The lamps graphics when it's off. | The lamps graphics when it's off. | ||
{{Prototype property|energy_usage_per_tick|[[Types/Energy|Energy]]}} | |||
The amount of energy the lamp uses. Must be greater than > 0. | The amount of energy the lamp uses. Must be greater than > 0. | ||
{{Prototype property|energy_source|[[Types/EnergySource|EnergySource]]}} | |||
Must be an electric or void energy source. | Must be an electric or void energy source. | ||
== Optional properties == | == Optional properties == | ||
{{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. | ||
{{Prototype property|light_when_colored|[[Types/LightDefinition|LightDefinition]]|optional=true}} | |||
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. | ||
{{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. | ||
{{Prototype property|circuit_wire_max_distance|[[Types/double|double]]|0|optional=true}} | |||
The maximum circuit wire distance for this entity. | The maximum circuit wire distance for this entity. | ||
{{Prototype property|draw_copper_wires|[[Types/bool|bool]]|true|optional=true}} | |||
= | |||
{{Prototype property|draw_circuit_wires|[[Types/bool|bool]]|true|optional=true}} | |||
{{Prototype property|circuit_connector_sprites|[[Types/CircuitConnectorSprites|CircuitConnectorSprites]]|optional=true}} | |||
The pictures displayed for circuit connections to this lamp. | The pictures displayed for circuit connections to this lamp. | ||
{{Prototype property|glow_size|[[Types/float|float]]|0|optional=true}} | |||
{{Prototype property|glow_color_intensity|[[Types/float|float]]|0|optional=true}} | |||
{{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. | ||
{{Prototype property|darkness_for_all_lamps_off|[[Types/float|float]]|0.3|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. | ||
{{Prototype property|always_on|[[Types/bool|bool]]|false|optional=true}} | |||
Whether the lamp should always be on. | Whether the lamp should always be on. | ||
{{Prototype property|signal_to_color_mapping|[[Types/table|table]] of [[Types/SignalColorMapping|SignalColorMapping]]|optional=true}} | |||
= | |||
{{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", |
Revision as of 16:40, 5 August 2019
Template:Prototype parent A lamp to provide light, using energy.
Mandatory properties
This prototype inherits all the properties from Prototype/EntityWithHealth.
Template:Prototype property The lamps graphics when it's on.
Template:Prototype property The lamps graphics when it's off.
Template:Prototype property The amount of energy the lamp uses. Must be greater than > 0.
Template:Prototype property Must be an electric or void energy source.
Optional properties
Template:Prototype property What color the lamp will be when it is on, and receiving power.
Template:Prototype property This refers to when the light is in a circuit network, and is lit a certain color based on a Circuit value.
Template:Prototype property Defines how wires visually connect to this lamp.
Template:Prototype property The maximum circuit wire distance for this entity.
Template:Prototype property The pictures displayed for circuit connections to this lamp.
Template:Prototype property darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be between 0 and 1.
Template:Prototype property darkness_for_all_lamps_on must be > darkness_for_all_lamps_off. Values must be between 0 and 1.
Template:Prototype property Whether the lamp should always be on.
Template:Prototype property 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
}