Prototype/Accumulator: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(→‎Example: updated)
(updated)
Line 4: Line 4:
== Usage in base==
== Usage in base==
*[[Accumulator]]
*[[Accumulator]]
== Properties ==
== Mandatory properties ==
This prototype inherits all the properties from [[Prototype/EntityWithHealth]].
 
=== energy_source ===
=== energy_source ===
'''Type''': [[Types/EnergySource]]
'''Type''': [[Types/EnergySource]]


The capacity of the energy source buffer specifies the capacity of the accumulator. Has to be an electric energy source.
The capacity of the energy source buffer specifies the capacity of the accumulator. Must be an electric energy source.


=== picture ===
=== picture ===
'''Type''': [[Types/Sprite]]
'''Type''': [[Types/Sprite]]
=== charge_cooldown ===
'''Type''': [[Types/uint16]]
Count of ticks to preserve the animation even when the charging ends.\n\nUsed to prevent rapid blinking of the accumulator with unstable need to use it.
=== discharge_cooldown ===
'''Type''': [[Types/uint16]]
How long (in ticks) the animation will last after discharge has been initialized.
== Optional properties ==


=== charge_animation ===
=== charge_animation ===
Line 18: Line 32:
=== charge_light ===
=== charge_light ===
'''Type''': [[Types/LightDefinition]]
'''Type''': [[Types/LightDefinition]]
=== charge_cooldown ===
'''Type''': [[Types/uint16]]
Count of ticks to preserve the animation even when the charging ends.
Used to prevent rapid blinking of the accumulator with unstable need to use it.


=== discharge_animation ===
=== discharge_animation ===
Line 31: Line 38:
=== discharge_light ===
=== discharge_light ===
'''Type''': [[Types/LightDefinition]]
'''Type''': [[Types/LightDefinition]]
=== discharge_cooldown ===
'''Type''': [[Types/uint16]]
How long (in ticks) the animation will last after discharge has been initialized.


=== circuit_wire_connection_point ===
=== circuit_wire_connection_point ===
Line 55: Line 57:


=== default_output_signal ===
=== default_output_signal ===
'''Type''': [[Types/string]]
'''Type''': [[Types/SignalIDConnector]]
 
The name of the signal that is the default for when a accumulator is connected to the circuit network.


The name of the signal that is the default for when an accumulator is connected to the circuit network.
== Example ==
== Example ==
<syntaxhighlight lang="lua">{
<syntaxhighlight lang="lua">{

Revision as of 13:24, 28 October 2018

Basics

Entity with energy source with specialised animation for charging/decharging. Extends the Prototype/EntityWithHealth

Usage in base

Mandatory properties

This prototype inherits all the properties from Prototype/EntityWithHealth.

energy_source

Type: Types/EnergySource

The capacity of the energy source buffer specifies the capacity of the accumulator. Must be an electric energy source.

picture

Type: Types/Sprite

charge_cooldown

Type: Types/uint16

Count of ticks to preserve the animation even when the charging ends.\n\nUsed to prevent rapid blinking of the accumulator with unstable need to use it.

discharge_cooldown

Type: Types/uint16

How long (in ticks) the animation will last after discharge has been initialized.

Optional properties

charge_animation

Type: Types/Animation

charge_light

Type: Types/LightDefinition

discharge_animation

Type: Types/Animation

discharge_light

Type: Types/LightDefinition

circuit_wire_connection_point

Type: Types/WireConnectionPoint

Defines how wires visually connect to this accumulator.

circuit_wire_max_distance

Type: Types/double

Default: 0

The maximum circuit wire distance for this accumulator.

circuit_connector_sprites

Type: Types/CircuitConnectorSprites

The pictures displayed for circuit connections to this accumulator.

default_output_signal

Type: Types/SignalIDConnector

The name of the signal that is the default for when an accumulator is connected to the circuit network.

Example

{
    type = "accumulator",
    name = "accumulator",
    icon = "__base__/graphics/icons/accumulator.png",
    icon_size = 32,
    flags = {"placeable-neutral", "player-creation"},
    minable = {hardness = 0.2, mining_time = 0.5, result = "accumulator"},
    max_health = 150,
    corpse = "medium-remnants",
    collision_box = {{-0.9, -0.9}, {0.9, 0.9}},
    selection_box = {{-1, -1}, {1, 1}},
    drawing_box = {{-1, -1.5}, {1, 1}},
    energy_source =
    {
      type = "electric",
      buffer_capacity = "5MJ",
      usage_priority = "terciary",
      input_flow_limit = "300kW",
      output_flow_limit = "300kW"
    },
    picture =
    {
      filename = "__base__/graphics/entity/accumulator/accumulator.png",
      priority = "extra-high",
      width = 124,
      height = 103,
      shift = {0.6875, -0.203125}
    },
    charge_animation =
    {
      filename = "__base__/graphics/entity/accumulator/accumulator-charge-animation.png",
      width = 138,
      height = 135,
      line_length = 8,
      frame_count = 24,
      shift = {0.46875, -0.640625},
      animation_speed = 0.5
    },

    charge_cooldown = 30,
    charge_light = {intensity = 0.3, size = 7, color = {r = 1.0, g = 1.0, b = 1.0}},
    discharge_animation =
    {
      filename = "__base__/graphics/entity/accumulator/accumulator-discharge-animation.png",
      width = 147,
      height = 128,
      line_length = 8,
      frame_count = 24,
      shift = {0.390625, -0.53125},
      animation_speed = 0.5
    },
    discharge_cooldown = 60,
    discharge_light = {intensity = 0.7, size = 7, color = {r = 1.0, g = 1.0, b = 1.0}},
    vehicle_impact_sound =  { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
    working_sound =
    {
      sound =
      {
        filename = "__base__/sound/accumulator-working.ogg",
        volume = 1
      },
      idle_sound =
      {
        filename = "__base__/sound/accumulator-idle.ogg",
        volume = 0.4
      },
      max_sounds_per_type = 5
    },

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

    default_output_signal = {type = "virtual", name = "signal-A"}
  }