Prototype/CraftingMachine: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(0.18.26: return_ingredients_on_change defaults to true)
(0.18.31: hr mining drill)
Line 37: Line 37:


== Optional properties ==
== Optional properties ==
{{Prototype property|animation|[[Types/Animation4Way|Animation4Way]]|optional=true}}
The animation played when crafting. When the crafting machine is idle, the animation will be paused.
When a crafting machine cannot be rotated, only the north rotation of the animation will be used.
{{Prototype property|idle_animation|[[Types/Animation4Way|Animation4Way]]|optional=true}}
Idle animation must have the same frame count as animation. It is used for drawing the machine in idle state, but the is animation frozen on a single frame when the machine is idle.<br>
This is an animation and not just sprite to make it possible for idle state and working state to match their visuals when the machine switches from one state to another.
When a crafting machine cannot be rotated, only the north rotation of the idle animation will be used.


{{Prototype property|fluid_boxes|[[Types/table|table]] of [[Types/FluidBox|FluidBox]]|optional=true}}
{{Prototype property|fluid_boxes|[[Types/table|table]] of [[Types/FluidBox|FluidBox]]|optional=true}}
Line 85: Line 74:
{{Prototype property|show_recipe_icon|[[Types/bool|bool]]|true|optional=true}}
{{Prototype property|show_recipe_icon|[[Types/bool|bool]]|true|optional=true}}
Whether the "alt-mode icon" should be drawn at all.
Whether the "alt-mode icon" should be drawn at all.
{{Prototype property|return_ingredients_on_change|[[Types/bool|bool]]|true|optional=true}}
Controls whether the ingredients of an in-progress recipe are destroyed when mining the machine/changing the recipe. If set to true, the ingredients do not get destroyed. This affects only the ingredients of the recipe that is currently in progress, so those that visually have already been consumed while their resulting product has not yet been produced.
{{Prototype property|animation|[[Types/Animation4Way|Animation4Way]]|optional=true}}
The animation played when crafting. When the crafting machine is idle, the animation will be paused.
When a crafting machine cannot be rotated, only the north rotation of the animation will be used.
{{Prototype property|idle_animation|[[Types/Animation4Way|Animation4Way]]|optional=true}}
Idle animation must have the same frame count as animation. It is used for drawing the machine in idle state, but the is animation frozen on a single frame when the machine is idle.<br>
This is an animation and not just sprite to make it possible for idle state and working state to match their visuals when the machine switches from one state to another.
When a crafting machine cannot be rotated, only the north rotation of the idle animation will be used.


{{Prototype property|always_draw_idle_animation|[[Types/bool|bool]]|false|optional=true}}
{{Prototype property|always_draw_idle_animation|[[Types/bool|bool]]|false|optional=true}}
Only loaded if <code>idle_animation</code> is present.


{{Prototype property|default_recipe_tint|[[Types/table|table]] of [[Types/Color|Color]]|optional=true}}
{{Prototype property|default_recipe_tint|[[Types/table|table]] of [[Types/Color|Color]]|optional=true}}
Format:
Format:
<syntaxhighlight lang="lua">crafting_machine_tint = { primary = {r=1,g=1,b=1,a=1}, secondary = {r=1,g=1,b=1,a=1}, tertiary = {r=1,g=1,b=1,a=1}, quaternary = {r=1,g=1,b=1,a=1}}</syntaxhighlight>
<syntaxhighlight lang="lua">default_recipe_tint = { primary = {r=1,g=1,b=1,a=1}, secondary = {r=1,g=1,b=1,a=1}, tertiary = {r=1,g=1,b=1,a=1}, quaternary = {r=1,g=1,b=1,a=1}}</syntaxhighlight>
Each key/value pair is optional and defaults to the above value.
Each key/value pair is optional and defaults to the above value.


{{Prototype property|return_ingredients_on_change|[[Types/bool|bool]]|true|optional=true}}
{{Prototype property|shift_animation_waypoints|[[Types/table|table]] of [[Types/table|table]] (array) of [[Types/vector|vector]]|optional=true}}
Controls whether the ingredients of an in-progress recipe are destroyed when mining the machine/changing the recipe. If set to true, the ingredients do not get destroyed. This affects only the ingredients of the recipe that is currently in progress, so those that visually have already been consumed while their resulting product has not yet been produced.
Table with the following optional key/value pairs:
* north - [[Types/table|array]] of [[Types/vector|vector]]
* east - [[Types/table|array]] of [[Types/vector|vector]]
* south - [[Types/table|array]] of [[Types/vector|vector]]
* west - [[Types/table|array]] of [[Types/vector|vector]]
 
Only loaded if one of <code>shift_animation_waypoint_stop_duration</code> or <code>shift_animation_transition_duration</code> is not 0.
 
{{Prototype property|shift_animation_waypoint_stop_duration|[[Types/uint16|uint16]]|0|optional=true}}
Only loaded if <code>shift_animation_waypoints</code> is present.
 
{{Prototype property|shift_animation_transition_duration |[[Types/uint16|uint16]]|0|optional=true}}
Only loaded if <code>shift_animation_waypoints</code> is present.
 
{{Prototype property|status_colors|[[Types/table|table]] of [[Types/Color|Color]]|optional=true}}
Table with the following optional key/value pairs:
* idle - [[Types/Color|Color]] - Default: White
* no_minable_resources - [[Types/Color|Color]] - Default: <code>idle</code>
* full_output - [[Types/Color|Color]] - Default: <code>idle</code>
* insufficient_input - [[Types/Color|Color]] - Default: <code>idle</code>
* disabled - [[Types/Color|Color]] - Default: <code>idle</code>
* no_power - [[Types/Color|Color]] - Default: No color
* working - [[Types/Color|Color]] - Default: White
* low_power - [[Types/Color|Color]] - Default: <code>working</code>


{{Prototype property|entity_info_icon_shift|[[Types/vector|vector]]|<nowiki>{0, -0.3}</nowiki> for [[Prototype/AssemblingMachine]] and <nowiki>{0, -0.1}</nowiki> for [[Prototype/Furnace]]|optional=true}}
{{Prototype property|entity_info_icon_shift|[[Types/vector|vector]]|<nowiki>{0, -0.3}</nowiki> for [[Prototype/AssemblingMachine]] and <nowiki>{0, -0.1}</nowiki> for [[Prototype/Furnace]]|optional=true}}

Revision as of 11:23, 22 July 2020

Template:Prototype parent The abstract basis of the assembling machines and furnaces. Contains the properties that both of them have.

Note that a crafting machine cannot be rotated unless it has at least one of the following: a fluid box, a heat energy source, a fluid energy source, or a non-square collision box. Crafting machines with non-square collision boxes can only be rotated before placement, not after.

Template:Prototype TOC

Extensions

Mandatory properties

This prototype inherits all the properties from Prototype/EntityWithHealth.

Template:Prototype property Sets how much energy this machine uses while crafting. Energy usage has to be positive.

Template:Prototype property How fast this crafting machine can craft. 1 means that for example a 1 second long recipe take 1 second to craft. 0.5 means it takes 2 seconds, and 2 means it takes 0.5 seconds.

Crafting speed has to be positive.

Template:Prototype property A list of recipe categories this crafting machine can use.

Example:

crafting_categories = {"crafting", "smelting"}

Template:Prototype property Defines how the crafting machine is powered.

When using an electric energy source and drain is not specified, it will be set to energy_usage ÷ 30 automatically.

Optional properties

Template:Prototype property Can have off_when_no_fluid_recipe key that has a bool value. off_when_no_fluid_recipe defaults to false. off_when_no_fluid_recipe is ignored by Prototype/Furnaces and considered to always be false.

If a crafting machine has fluid boxes and off_when_no_fluid_recipe is true, the crafting machine can only be rotated when a recipe consuming or producing fluid is set, or it has one of the other properties listed at the top of the page.

fluid_boxes =
    {
      {
        production_type = "input",
        pipe_picture = assembler2pipepictures(),
        pipe_covers = pipecoverspictures(),
        base_area = 10,
        base_level = -1,
        pipe_connections = {{ type="input", position = {0, -2} }},
        secondary_draw_orders = { north = -1 }
      },
      {
        production_type = "output",
        pipe_picture = assembler2pipepictures(),
        pipe_covers = pipecoverspictures(),
        base_area = 10,
        base_level = 1,
        pipe_connections = {{ type="output", position = {0, 2} }},
        secondary_draw_orders = { north = -1 }
      },
      off_when_no_fluid_recipe = true
    },

Template:Prototype property Sets the module effects that are allowed to be used on this machine.

Template:Prototype property Whether the "alt-mode icon" should be scaled to the size of the machine.

Template:Prototype property Whether the "alt-mode icon" should be drawn at all.

Template:Prototype property Controls whether the ingredients of an in-progress recipe are destroyed when mining the machine/changing the recipe. If set to true, the ingredients do not get destroyed. This affects only the ingredients of the recipe that is currently in progress, so those that visually have already been consumed while their resulting product has not yet been produced.

Template:Prototype property The animation played when crafting. When the crafting machine is idle, the animation will be paused.

When a crafting machine cannot be rotated, only the north rotation of the animation will be used.

Template:Prototype property Idle animation must have the same frame count as animation. It is used for drawing the machine in idle state, but the is animation frozen on a single frame when the machine is idle.
This is an animation and not just sprite to make it possible for idle state and working state to match their visuals when the machine switches from one state to another.

When a crafting machine cannot be rotated, only the north rotation of the idle animation will be used.

Template:Prototype property Only loaded if idle_animation is present.

Template:Prototype property Format:

default_recipe_tint = { primary = {r=1,g=1,b=1,a=1}, secondary = {r=1,g=1,b=1,a=1}, tertiary = {r=1,g=1,b=1,a=1}, quaternary = {r=1,g=1,b=1,a=1}}

Each key/value pair is optional and defaults to the above value.

Template:Prototype property Table with the following optional key/value pairs:

Only loaded if one of shift_animation_waypoint_stop_duration or shift_animation_transition_duration is not 0.

Template:Prototype property Only loaded if shift_animation_waypoints is present.

Template:Prototype property Only loaded if shift_animation_waypoints is present.

Template:Prototype property Table with the following optional key/value pairs:

  • idle - Color - Default: White
  • no_minable_resources - Color - Default: idle
  • full_output - Color - Default: idle
  • insufficient_input - Color - Default: idle
  • disabled - Color - Default: idle
  • no_power - Color - Default: No color
  • working - Color - Default: White
  • low_power - Color - Default: working

Template:Prototype property Shift of the "alt-mode icon" relative to the machine's center.

Template:Prototype property Whether the "alt-mode icon" should have a black background.

Template:Prototype property Whether the speed of the animation and working visualization should be based on the machine's speed (boosted or slowed by modules).

Template:Prototype property Productivity bonus that this machine always has.

Template:Prototype property The number of module slots in this machine, and their icon positions.

module_specification = {
  module_info_icon_shift = {
    0,
    0.8
  },
  module_slots = 2
},

Template:Prototype property