<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.factorio.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Honktown</id>
	<title>Official Factorio Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.factorio.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Honktown"/>
	<link rel="alternate" type="text/html" href="https://wiki.factorio.com/Special:Contributions/Honktown"/>
	<updated>2026-07-01T02:32:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Rich_text&amp;diff=216892</id>
		<title>Rich text</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Rich_text&amp;diff=216892"/>
		<updated>2026-01-07T01:22:33Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Tags */ remove period for consistency&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
Rich text formatting allows the use of tags within most of the game&#039;s textboxes to change the visual formatting of text or to embed interactable images/entities. Predefined text tags are employed for this purpose.&lt;br /&gt;
&lt;br /&gt;
== Tags ==&lt;br /&gt;
&lt;br /&gt;
Tags are useful for sharing blueprints, marking map locations in chat or adding icons to map markers and train stations.&lt;br /&gt;
Ctrl+alt clicking the map or ground will automatically insert a gps tag and post it into [[console|chat]].&lt;br /&gt;
&lt;br /&gt;
Shift clicking most things with the console open will insert a tag for that thing into chat. The chat and many other textboxes in the game have a button on the right edge that opens an icon selector. This can be used to easily insert rich text tags of recipes, items, fluids, virtual signals and entities into the textbox.&lt;br /&gt;
&lt;br /&gt;
When used in chat, the tag image will be followed by a text description, except for the img tag.&lt;br /&gt;
Used elsewhere only the image is shown.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot;| Syntax&lt;br /&gt;
! style=&amp;quot;width:15%&amp;quot;| Example Input&lt;br /&gt;
! style=&amp;quot;width:15%&amp;quot;| Example Result&lt;br /&gt;
! style=&amp;quot;width:50%&amp;quot;| Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [img=&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;/&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[img=&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;.&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[img=&amp;lt;i&amp;gt;sprite-prototype-name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [img=item.iron-plate]&amp;lt;br&amp;gt;&lt;br /&gt;
[img=quantity-time]&amp;lt;br&amp;gt;&lt;br /&gt;
[img=utility/played_green]&lt;br /&gt;
| [[File:Iron_plate.png|28px]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Time_icon.png|28px]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Played green.png|28px]]&lt;br /&gt;
| Embeds only a small inline game graphic. The period format must be used in game save names. This tag uses [https://lua-api.factorio.com/latest/concepts/SpritePath.html sprite paths]:&lt;br /&gt;
&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt; is any of: item, entity, technology, recipe, item-group, fluid, tile, virtual-signal, achievement, equipment, space-location, utility, or airborne-pollutant&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;: see below&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;sprite-prototype-name&amp;lt;/i&amp;gt; is the [[Data.raw#sprite|internal-name]] of a [[Prototype/Sprite|sprite prototype]].&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [item=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [item=iron-plate]&lt;br /&gt;
| [[File:Iron_plate.png|28px]] [Item: Iron plate]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal-name of the item&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [entity=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [entity=small-biter]&lt;br /&gt;
| [[File:Small_biter.png|28px]] [Entity: Small biter]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal-name of the entity&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [technology=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [technology=logistics]&lt;br /&gt;
| [[File:Logistics_(research).png|28px]] [Technology: Logistics]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal-name of the technology&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [recipe=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [recipe=basic-oil-processing]&lt;br /&gt;
| [[File:Basic_oil_processing.png|28px]] [Recipe: Basic oil processing]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal-name of the recipe, usually the item name&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [item-group=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [item-group=combat]&lt;br /&gt;
| [[File:Item-group_military.png|28px]] [Item Group: Combat]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is any of: logistics, production, intermediate-products, combat, fluids or signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [fluid=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [fluid=water]&lt;br /&gt;
| [[File:Water.png|28px]] [Fluid: Water]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal name of the fluid&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [tile=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [tile=grass-3]&lt;br /&gt;
| [[File:Grass_3.png|28px]] [Tile: Grass 3]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal name of the tile, usually the lowercase name with hyphens replacing spaces as written from the map editor&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [virtual-signal=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [virtual-signal=signal-A]&lt;br /&gt;
| [[File:Signal-A.png|28px]] [Virtual Signal: Signal A]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the word signal followed by either an uppercase letter, number, color, each, everything or anything&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [achievement=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [achievement=minions]&lt;br /&gt;
| [[File:Minions-achievement.png|28px]] [Achievement: Minions]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal-name of the achievement, usually the lowercase name with hyphens replacing spaces&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [gps=&amp;lt;i&amp;gt;x,y&amp;lt;/i&amp;gt;]&lt;br /&gt;
[gps=&amp;lt;i&amp;gt;x,y,surface&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [gps=0,0]&lt;br /&gt;
| [[File:Map.png|28px]] [Location: 0,0]&lt;br /&gt;
| Embeds a map location and marks the location on the map of other players.&lt;br /&gt;
&amp;lt;i&amp;gt;x&amp;lt;/i&amp;gt; is the x point coordinate&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;y&amp;lt;/i&amp;gt; is the y point coordinate&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;surface&amp;lt;/i&amp;gt; is the current surface. Is only added if the player Ctrl+alt clicks on a surface that is not the default surface. When the player is on another surface than &amp;lt;i&amp;gt;surface&amp;lt;/i&amp;gt;, clicking the tag does nothing. Mods must handle this case with [https://lua-api.factorio.com/latest/events.html#on_player_clicked_gps_tag on_player_clicked_gps_tag]&lt;br /&gt;
|-&lt;br /&gt;
| [special-item=&amp;lt;i&amp;gt;blueprint_string&amp;lt;/i&amp;gt;]&lt;br /&gt;
| &lt;br /&gt;
| [[File:Blueprint.png|28px]] [Blueprint]&lt;br /&gt;
| Embeds a blueprint. Players can get a blueprint item by clicking the icon.&lt;br /&gt;
&amp;lt;i&amp;gt;blueprint_string&amp;lt;/i&amp;gt; is the blueprint string of a blueprint, deconstruction planner or upgrade planners&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [armor=&amp;lt;i&amp;gt;player&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [armor=Player] &lt;br /&gt;
| [[File:Power_armor_MK2.png|28px]] [Armor: Player]&lt;br /&gt;
| Embeds the armor of a player. Allows other players to see the equipment installed.&lt;br /&gt;
&amp;lt;i&amp;gt;player&amp;lt;/i&amp;gt; is the name of the player&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [train=&amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [train=93] &lt;br /&gt;
| [[File:Locomotive.png|28px]] [Train: 2]&lt;br /&gt;
| Embeds a reference to a train. Clicking the icon will open the train GUI for that train.&lt;br /&gt;
&amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt; is the internal unit number of the train&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [train-stop=&amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [train-stop=100]&lt;br /&gt;
| [[File:Train_stop.png|28px]] [Train Stop: Trangar]&lt;br /&gt;
| Embeds a reference to a train stop. Clicking the icon will open the GUI for that train stop.&lt;br /&gt;
&amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt; is the internal unit number of the train stop&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [shortcut=&amp;lt;i&amp;gt;shortcut-name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [shortcut=give-spidertron-remote]&lt;br /&gt;
| [[File:Spidertron_remote.png|28px]] [Shortcut: Create spidertron remote]&lt;br /&gt;
| Embeds a reference to a shortcut from the [[Shortcut bar]]. Hovering over the rich text will show the shortcut&#039;s description. Clicking the rich text will act as if you clicked the shortcut.&lt;br /&gt;
&amp;lt;i&amp;gt;shortcut-name&amp;lt;/i&amp;gt; is the internal name of the shortcut.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [tip=&amp;lt;i&amp;gt;tip-name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [tip=spidertron-control]&lt;br /&gt;
| [[File:Tip.png|28px]] [Tip: Spidertron control]&lt;br /&gt;
| Embeds a reference to a tip from the &amp;quot;Tips and tricks&amp;quot; menu. Hovering over the icon will show the tip&#039;s text. Clicking the icon will open the &amp;quot;Tips and tricks&amp;quot; menu to that page.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [tooltip=&amp;lt;i&amp;gt;text,tooltip locale key&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [tooltip=Hover to see &amp;quot;Iron plate&amp;quot;,item-name.iron-plate]&lt;br /&gt;
| &amp;lt;span title=&amp;quot;Iron plate&amp;quot;&amp;gt; [[File:Custom-tag-icon.png|28px]] Hover to see &amp;quot;Iron plate&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
| Shows the given &amp;lt;i&amp;gt;text&amp;lt;/i&amp;gt; with a &amp;lt;i&amp;gt;tooltip&amp;lt;/i&amp;gt; that is specified with a [[Tutorial:Localisation#Localising_simple_strings|locale key]].&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[item=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;,quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[entity=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;,quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--[recipe=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;,quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[fluid=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;,quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[virtual-signal=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;,quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]--&amp;gt;&lt;br /&gt;
|[quality=normal]&amp;lt;br&amp;gt;&lt;br /&gt;
[item=iron-plate,quality=normal]&amp;lt;br&amp;gt;&lt;br /&gt;
[entity=small-biter,quality=uncommon]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--[recipe=basic-oil-processing,quality=rare]&amp;lt;br&amp;gt;&lt;br /&gt;
[fluid=water,quality=epic]&amp;lt;br&amp;gt;&lt;br /&gt;
[virtual-signal=signal-A,quality=legendary]--&amp;gt;&lt;br /&gt;
| [[File:Quality normal.png|28px]] [Quality: Normal]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Iron_plate.png|28px]] [Item: Iron plate]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Uncommon small biter.png|28px]] [Entity: Uncommon Small biter]&amp;lt;br&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
[[Quality]] can also be optionally specified on the following tags: item, entity, recipe, fluid, and virtual-signal&amp;lt;br&amp;gt;&lt;br /&gt;
It can also be added to the other tags that use &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, but they ignore it.&lt;br /&gt;
&lt;br /&gt;
The normal quality is the default quality and won&#039;t modify tags. Any other quality won&#039;t exist without [[Space Age]] and Quality&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt; is the internal-name of the quality&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [space-platform=&amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [space-platform=3]&lt;br /&gt;
| [[File:Space_platform_hub.png|28px]] [Space platform: My cool space platform] &lt;br /&gt;
| &amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt; is the internal id of a space-platform, starting with 1.&lt;br /&gt;
Hovering over the rich text will show a view of the space platform. Clicking the rich text will go to the platform in remote view.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [planet=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [planet=gleba]&lt;br /&gt;
| [[File:Gleba.png|28px]] [Planet: Gleba]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal name of a planet.&lt;br /&gt;
Available planets in Space Age are: nauvis, gleba, fulgora, vulcanus, and aquilo.&lt;br /&gt;
&lt;br /&gt;
[[Nauvis]] is part of the base game and will always be available.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [space-location=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [space-location=shattered-planet]&lt;br /&gt;
[space-location=gleba]&lt;br /&gt;
| [[File:Shattered planet.png|28px]] [Space location: Shattered Planet] &lt;br /&gt;
[[File:Gleba.png|28px]] [Planet: Gleba]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal name of a space-location in Space Age.&lt;br /&gt;
Available locations in Space Age are: nauvis, gleba, fulgora, vulcanus, aquilo, solar-system-edge, and shattered-planet.&lt;br /&gt;
&lt;br /&gt;
For the planet&#039;s listed in the section above &#039;planet&#039; will be used as the text prefix instead of &#039;space-location&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [space-age]&lt;br /&gt;
| [space-age]&lt;br /&gt;
| [[File:Space_age_icon.png|28px]]&lt;br /&gt;
| Embeds the Space Age icon.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Text modifiers ==&lt;br /&gt;
[[File:Fonts.png|right|thumbnail|100px|Different fonts displayed in-game. (Click to enlarge.)]]&lt;br /&gt;
&lt;br /&gt;
The color and font of text can be changed&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot;| Syntax&lt;br /&gt;
! style=&amp;quot;width:15%&amp;quot;| Example Input&lt;br /&gt;
! style=&amp;quot;width:15%&amp;quot;| Example Result&lt;br /&gt;
! style=&amp;quot;width:50%&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
| [color=&amp;lt;i&amp;gt;rgb&amp;lt;/i&amp;gt;]...[/color]&amp;lt;br&amp;gt;&lt;br /&gt;
[color=&amp;lt;i&amp;gt;#rrggbb&amp;lt;/i&amp;gt;]...[/color]&amp;lt;br&amp;gt;&lt;br /&gt;
[color=&amp;lt;i&amp;gt;#aarrggbb&amp;lt;/i&amp;gt;]...[/color]&amp;lt;br&amp;gt;&lt;br /&gt;
[color=&amp;lt;i&amp;gt;rgb&amp;lt;/i&amp;gt;]...[.color]&amp;lt;br&amp;gt;&lt;br /&gt;
[color=&amp;lt;i&amp;gt;#rrggbb&amp;lt;/i&amp;gt;]...[.color]&amp;lt;br&amp;gt;&lt;br /&gt;
[color=&amp;lt;i&amp;gt;#aarrggbb&amp;lt;/i&amp;gt;]...[.color]&lt;br /&gt;
| [color=red]Red[/color] text&amp;lt;br&amp;gt;&lt;br /&gt;
[color=1,0,0]Red[/color] text&amp;lt;br&amp;gt;&lt;br /&gt;
[color=255,0,0]Red[/color] text&amp;lt;br&amp;gt;&lt;br /&gt;
[color=#ff0000]Red[/color] text&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: #ff0000&amp;quot;&amp;gt;Red&amp;lt;/span&amp;gt; text&lt;br /&gt;
| &amp;lt;i&amp;gt;rgb&amp;lt;/i&amp;gt; is a comma separated RGB color ranging from 0 to 1 or 0 to 255, or a color name&lt;br /&gt;
Available colors: default, red, green, blue, orange, yellow, pink, purple, white, black, gray, brown, cyan, acid.&lt;br /&gt;
|-&lt;br /&gt;
| [font=&amp;lt;i&amp;gt;font-name&amp;lt;/i&amp;gt;]...[/font]&amp;lt;br&amp;gt;&lt;br /&gt;
[font=&amp;lt;i&amp;gt;font-name&amp;lt;/i&amp;gt;]...[.font]&lt;br /&gt;
| [font=default-bold]Bold text[/font]&lt;br /&gt;
| &amp;lt;b&amp;gt;Bold text&amp;lt;/b&amp;gt;&lt;br /&gt;
| &amp;lt;i&amp;gt;font-name&amp;lt;/i&amp;gt; is the name of the [[Data.raw#font|Factorio font]] to render&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Console]]&lt;br /&gt;
* [[Data.raw]] for the list of internal names of recipes, technologies, fluids, etc.&lt;br /&gt;
&lt;br /&gt;
{{C|GUI}}&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Rich_text&amp;diff=216891</id>
		<title>Rich text</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Rich_text&amp;diff=216891"/>
		<updated>2026-01-07T01:10:59Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Tags */  added airborne-pollutant as valid class for img= icon&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
Rich text formatting allows the use of tags within most of the game&#039;s textboxes to change the visual formatting of text or to embed interactable images/entities. Predefined text tags are employed for this purpose.&lt;br /&gt;
&lt;br /&gt;
== Tags ==&lt;br /&gt;
&lt;br /&gt;
Tags are useful for sharing blueprints, marking map locations in chat or adding icons to map markers and train stations.&lt;br /&gt;
Ctrl+alt clicking the map or ground will automatically insert a gps tag and post it into [[console|chat]].&lt;br /&gt;
&lt;br /&gt;
Shift clicking most things with the console open will insert a tag for that thing into chat. The chat and many other textboxes in the game have a button on the right edge that opens an icon selector. This can be used to easily insert rich text tags of recipes, items, fluids, virtual signals and entities into the textbox.&lt;br /&gt;
&lt;br /&gt;
When used in chat, the tag image will be followed by a text description, except for the img tag.&lt;br /&gt;
Used elsewhere only the image is shown.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot;| Syntax&lt;br /&gt;
! style=&amp;quot;width:15%&amp;quot;| Example Input&lt;br /&gt;
! style=&amp;quot;width:15%&amp;quot;| Example Result&lt;br /&gt;
! style=&amp;quot;width:50%&amp;quot;| Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [img=&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;/&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[img=&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;.&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[img=&amp;lt;i&amp;gt;sprite-prototype-name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [img=item.iron-plate]&amp;lt;br&amp;gt;&lt;br /&gt;
[img=quantity-time]&amp;lt;br&amp;gt;&lt;br /&gt;
[img=utility/played_green]&lt;br /&gt;
| [[File:Iron_plate.png|28px]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Time_icon.png|28px]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Played green.png|28px]]&lt;br /&gt;
| Embeds only a small inline game graphic. The period format must be used in game save names. This tag uses [https://lua-api.factorio.com/latest/concepts/SpritePath.html sprite paths]:&lt;br /&gt;
&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt; is any of: item, entity, technology, recipe, item-group, fluid, tile, virtual-signal, achievement, equipment, space-location, utility, or airborne-pollutant.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;: see below&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;sprite-prototype-name&amp;lt;/i&amp;gt; is the [[Data.raw#sprite|internal-name]] of a [[Prototype/Sprite|sprite prototype]].&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [item=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [item=iron-plate]&lt;br /&gt;
| [[File:Iron_plate.png|28px]] [Item: Iron plate]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal-name of the item&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [entity=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [entity=small-biter]&lt;br /&gt;
| [[File:Small_biter.png|28px]] [Entity: Small biter]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal-name of the entity&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [technology=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [technology=logistics]&lt;br /&gt;
| [[File:Logistics_(research).png|28px]] [Technology: Logistics]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal-name of the technology&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [recipe=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [recipe=basic-oil-processing]&lt;br /&gt;
| [[File:Basic_oil_processing.png|28px]] [Recipe: Basic oil processing]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal-name of the recipe, usually the item name&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [item-group=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [item-group=combat]&lt;br /&gt;
| [[File:Item-group_military.png|28px]] [Item Group: Combat]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is any of: logistics, production, intermediate-products, combat, fluids or signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [fluid=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [fluid=water]&lt;br /&gt;
| [[File:Water.png|28px]] [Fluid: Water]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal name of the fluid&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [tile=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [tile=grass-3]&lt;br /&gt;
| [[File:Grass_3.png|28px]] [Tile: Grass 3]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal name of the tile, usually the lowercase name with hyphens replacing spaces as written from the map editor&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [virtual-signal=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [virtual-signal=signal-A]&lt;br /&gt;
| [[File:Signal-A.png|28px]] [Virtual Signal: Signal A]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the word signal followed by either an uppercase letter, number, color, each, everything or anything&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [achievement=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [achievement=minions]&lt;br /&gt;
| [[File:Minions-achievement.png|28px]] [Achievement: Minions]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal-name of the achievement, usually the lowercase name with hyphens replacing spaces&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [gps=&amp;lt;i&amp;gt;x,y&amp;lt;/i&amp;gt;]&lt;br /&gt;
[gps=&amp;lt;i&amp;gt;x,y,surface&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [gps=0,0]&lt;br /&gt;
| [[File:Map.png|28px]] [Location: 0,0]&lt;br /&gt;
| Embeds a map location and marks the location on the map of other players.&lt;br /&gt;
&amp;lt;i&amp;gt;x&amp;lt;/i&amp;gt; is the x point coordinate&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;y&amp;lt;/i&amp;gt; is the y point coordinate&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;surface&amp;lt;/i&amp;gt; is the current surface. Is only added if the player Ctrl+alt clicks on a surface that is not the default surface. When the player is on another surface than &amp;lt;i&amp;gt;surface&amp;lt;/i&amp;gt;, clicking the tag does nothing. Mods must handle this case with [https://lua-api.factorio.com/latest/events.html#on_player_clicked_gps_tag on_player_clicked_gps_tag]&lt;br /&gt;
|-&lt;br /&gt;
| [special-item=&amp;lt;i&amp;gt;blueprint_string&amp;lt;/i&amp;gt;]&lt;br /&gt;
| &lt;br /&gt;
| [[File:Blueprint.png|28px]] [Blueprint]&lt;br /&gt;
| Embeds a blueprint. Players can get a blueprint item by clicking the icon.&lt;br /&gt;
&amp;lt;i&amp;gt;blueprint_string&amp;lt;/i&amp;gt; is the blueprint string of a blueprint, deconstruction planner or upgrade planners&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [armor=&amp;lt;i&amp;gt;player&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [armor=Player] &lt;br /&gt;
| [[File:Power_armor_MK2.png|28px]] [Armor: Player]&lt;br /&gt;
| Embeds the armor of a player. Allows other players to see the equipment installed.&lt;br /&gt;
&amp;lt;i&amp;gt;player&amp;lt;/i&amp;gt; is the name of the player&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [train=&amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [train=93] &lt;br /&gt;
| [[File:Locomotive.png|28px]] [Train: 2]&lt;br /&gt;
| Embeds a reference to a train. Clicking the icon will open the train GUI for that train.&lt;br /&gt;
&amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt; is the internal unit number of the train&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [train-stop=&amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [train-stop=100]&lt;br /&gt;
| [[File:Train_stop.png|28px]] [Train Stop: Trangar]&lt;br /&gt;
| Embeds a reference to a train stop. Clicking the icon will open the GUI for that train stop.&lt;br /&gt;
&amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt; is the internal unit number of the train stop&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [shortcut=&amp;lt;i&amp;gt;shortcut-name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [shortcut=give-spidertron-remote]&lt;br /&gt;
| [[File:Spidertron_remote.png|28px]] [Shortcut: Create spidertron remote]&lt;br /&gt;
| Embeds a reference to a shortcut from the [[Shortcut bar]]. Hovering over the rich text will show the shortcut&#039;s description. Clicking the rich text will act as if you clicked the shortcut.&lt;br /&gt;
&amp;lt;i&amp;gt;shortcut-name&amp;lt;/i&amp;gt; is the internal name of the shortcut.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [tip=&amp;lt;i&amp;gt;tip-name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [tip=spidertron-control]&lt;br /&gt;
| [[File:Tip.png|28px]] [Tip: Spidertron control]&lt;br /&gt;
| Embeds a reference to a tip from the &amp;quot;Tips and tricks&amp;quot; menu. Hovering over the icon will show the tip&#039;s text. Clicking the icon will open the &amp;quot;Tips and tricks&amp;quot; menu to that page.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [tooltip=&amp;lt;i&amp;gt;text,tooltip locale key&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [tooltip=Hover to see &amp;quot;Iron plate&amp;quot;,item-name.iron-plate]&lt;br /&gt;
| &amp;lt;span title=&amp;quot;Iron plate&amp;quot;&amp;gt; [[File:Custom-tag-icon.png|28px]] Hover to see &amp;quot;Iron plate&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
| Shows the given &amp;lt;i&amp;gt;text&amp;lt;/i&amp;gt; with a &amp;lt;i&amp;gt;tooltip&amp;lt;/i&amp;gt; that is specified with a [[Tutorial:Localisation#Localising_simple_strings|locale key]].&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[item=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;,quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[entity=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;,quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--[recipe=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;,quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[fluid=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;,quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]&amp;lt;br&amp;gt;&lt;br /&gt;
[virtual-signal=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;,quality=&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt;]--&amp;gt;&lt;br /&gt;
|[quality=normal]&amp;lt;br&amp;gt;&lt;br /&gt;
[item=iron-plate,quality=normal]&amp;lt;br&amp;gt;&lt;br /&gt;
[entity=small-biter,quality=uncommon]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--[recipe=basic-oil-processing,quality=rare]&amp;lt;br&amp;gt;&lt;br /&gt;
[fluid=water,quality=epic]&amp;lt;br&amp;gt;&lt;br /&gt;
[virtual-signal=signal-A,quality=legendary]--&amp;gt;&lt;br /&gt;
| [[File:Quality normal.png|28px]] [Quality: Normal]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Iron_plate.png|28px]] [Item: Iron plate]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Uncommon small biter.png|28px]] [Entity: Uncommon Small biter]&amp;lt;br&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
[[Quality]] can also be optionally specified on the following tags: item, entity, recipe, fluid, and virtual-signal&amp;lt;br&amp;gt;&lt;br /&gt;
It can also be added to the other tags that use &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, but they ignore it.&lt;br /&gt;
&lt;br /&gt;
The normal quality is the default quality and won&#039;t modify tags. Any other quality won&#039;t exist without [[Space Age]] and Quality&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;tier&amp;lt;/i&amp;gt; is the internal-name of the quality&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [space-platform=&amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [space-platform=3]&lt;br /&gt;
| [[File:Space_platform_hub.png|28px]] [Space platform: My cool space platform] &lt;br /&gt;
| &amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt; is the internal id of a space-platform, starting with 1.&lt;br /&gt;
Hovering over the rich text will show a view of the space platform. Clicking the rich text will go to the platform in remote view.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [planet=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [planet=gleba]&lt;br /&gt;
| [[File:Gleba.png|28px]] [Planet: Gleba]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal name of a planet.&lt;br /&gt;
Available planets in Space Age are: nauvis, gleba, fulgora, vulcanus, and aquilo.&lt;br /&gt;
&lt;br /&gt;
[[Nauvis]] is part of the base game and will always be available.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [space-location=&amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;]&lt;br /&gt;
| [space-location=shattered-planet]&lt;br /&gt;
[space-location=gleba]&lt;br /&gt;
| [[File:Shattered planet.png|28px]] [Space location: Shattered Planet] &lt;br /&gt;
[[File:Gleba.png|28px]] [Planet: Gleba]&lt;br /&gt;
| &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; is the internal name of a space-location in Space Age.&lt;br /&gt;
Available locations in Space Age are: nauvis, gleba, fulgora, vulcanus, aquilo, solar-system-edge, and shattered-planet.&lt;br /&gt;
&lt;br /&gt;
For the planet&#039;s listed in the section above &#039;planet&#039; will be used as the text prefix instead of &#039;space-location&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [space-age]&lt;br /&gt;
| [space-age]&lt;br /&gt;
| [[File:Space_age_icon.png|28px]]&lt;br /&gt;
| Embeds the Space Age icon.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Text modifiers ==&lt;br /&gt;
[[File:Fonts.png|right|thumbnail|100px|Different fonts displayed in-game. (Click to enlarge.)]]&lt;br /&gt;
&lt;br /&gt;
The color and font of text can be changed&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:20%&amp;quot;| Syntax&lt;br /&gt;
! style=&amp;quot;width:15%&amp;quot;| Example Input&lt;br /&gt;
! style=&amp;quot;width:15%&amp;quot;| Example Result&lt;br /&gt;
! style=&amp;quot;width:50%&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
| [color=&amp;lt;i&amp;gt;rgb&amp;lt;/i&amp;gt;]...[/color]&amp;lt;br&amp;gt;&lt;br /&gt;
[color=&amp;lt;i&amp;gt;#rrggbb&amp;lt;/i&amp;gt;]...[/color]&amp;lt;br&amp;gt;&lt;br /&gt;
[color=&amp;lt;i&amp;gt;#aarrggbb&amp;lt;/i&amp;gt;]...[/color]&amp;lt;br&amp;gt;&lt;br /&gt;
[color=&amp;lt;i&amp;gt;rgb&amp;lt;/i&amp;gt;]...[.color]&amp;lt;br&amp;gt;&lt;br /&gt;
[color=&amp;lt;i&amp;gt;#rrggbb&amp;lt;/i&amp;gt;]...[.color]&amp;lt;br&amp;gt;&lt;br /&gt;
[color=&amp;lt;i&amp;gt;#aarrggbb&amp;lt;/i&amp;gt;]...[.color]&lt;br /&gt;
| [color=red]Red[/color] text&amp;lt;br&amp;gt;&lt;br /&gt;
[color=1,0,0]Red[/color] text&amp;lt;br&amp;gt;&lt;br /&gt;
[color=255,0,0]Red[/color] text&amp;lt;br&amp;gt;&lt;br /&gt;
[color=#ff0000]Red[/color] text&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: #ff0000&amp;quot;&amp;gt;Red&amp;lt;/span&amp;gt; text&lt;br /&gt;
| &amp;lt;i&amp;gt;rgb&amp;lt;/i&amp;gt; is a comma separated RGB color ranging from 0 to 1 or 0 to 255, or a color name&lt;br /&gt;
Available colors: default, red, green, blue, orange, yellow, pink, purple, white, black, gray, brown, cyan, acid.&lt;br /&gt;
|-&lt;br /&gt;
| [font=&amp;lt;i&amp;gt;font-name&amp;lt;/i&amp;gt;]...[/font]&amp;lt;br&amp;gt;&lt;br /&gt;
[font=&amp;lt;i&amp;gt;font-name&amp;lt;/i&amp;gt;]...[.font]&lt;br /&gt;
| [font=default-bold]Bold text[/font]&lt;br /&gt;
| &amp;lt;b&amp;gt;Bold text&amp;lt;/b&amp;gt;&lt;br /&gt;
| &amp;lt;i&amp;gt;font-name&amp;lt;/i&amp;gt; is the name of the [[Data.raw#font|Factorio font]] to render&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Console]]&lt;br /&gt;
* [[Data.raw]] for the list of internal names of recipes, technologies, fluids, etc.&lt;br /&gt;
&lt;br /&gt;
{{C|GUI}}&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Mod_settings&amp;diff=213961</id>
		<title>Tutorial:Mod settings</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Mod_settings&amp;diff=213961"/>
		<updated>2025-05-14T01:44:57Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Reading settings */  Slight wording to clarify startup settings are also in runtime + what runtime-global is seen as&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
This tutorial aims to explain how to create and use mod settings. Basic knowledge of modding is assumed, so you should have at least understood [[Tutorial:Modding tutorial/Gangsir|Gangsir&#039;s modding tutorial]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Each mod can specify settings that users can change. The values of these settings can be accessed from inside the data stage or the control stage depending on their [[#The_setting_type_property|setting_type]] and allow to conditionally create or modify prototypes and to add configuration options to control scripts. They allow modders to easily create a graphical interface for their configuration options, instead of using on text files that have to be edited manually by users.&lt;br /&gt;
&lt;br /&gt;
== Location ==&lt;br /&gt;
&lt;br /&gt;
Mod settings are defined in the [https://lua-api.factorio.com/latest/Data-Lifecycle.html settings stage]. This stage is loaded before the data stage. There are three files in which settings can be defined:&lt;br /&gt;
* settings.lua&lt;br /&gt;
* settings-updates.lua&lt;br /&gt;
* settings-final-fixes.lua&lt;br /&gt;
&lt;br /&gt;
First the settings.lua file is called for each mod, in the order of their dependencies and then in the [[:Wikipedia:natural sort order|natural sort order]]. After settings.lua has been called for all mods, the settings-updates.lua file is called for each mod &amp;lt;sup&amp;gt;(in the same order)&amp;lt;/sup&amp;gt; and finally the settings-final-fixes.lua file is called for each mod &amp;lt;sup&amp;gt;(in the same order)&amp;lt;/sup&amp;gt;. These 3 different phases of the settings stage allow to change settings of other mods without needing to rely on dependencies to load last. The settings are all defined in the same stage and their user defined values are not available, therefore mods cannot conditionally create settings depending on the values of other mod settings. Since the settings stage gets loaded first, there is also no prototype data or [http://lua-api.factorio.com/latest/LuaRemote.html remote interface] available.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;mod-settings.dat&amp;quot; file stored in the [[Application_directory#User_Data_directory|mods folder]] for the game contains the local players settings between game sessions similar to the player-data.json file.&lt;br /&gt;
&lt;br /&gt;
== Creation ==&lt;br /&gt;
&lt;br /&gt;
Mod settings are defined and modified by using the data table during the settings stage. This works [[Tutorial:Modding_tutorial/Gangsir#Prototype_creation|the same way as other prototypes]]. An example would be:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;bool-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-test-setting&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = true&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the setting has multiple properties. Each setting supports the following standard prototype properties:&lt;br /&gt;
* name - [https://lua-api.factorio.com/latest/types/string.html string] - Mandatory.&lt;br /&gt;
* type - [https://lua-api.factorio.com/latest/types/string.html string] - Mandatory.&lt;br /&gt;
* localised_name - [https://lua-api.factorio.com/latest/types/LocalisedString.html LocalisedString] - Optional.&lt;br /&gt;
* localised_description - [https://lua-api.factorio.com/latest/types/LocalisedString.html LocalisedString] - Optional.&lt;br /&gt;
* [https://lua-api.factorio.com/latest/types/Order.html order] - [https://lua-api.factorio.com/latest/types/string.html string] - Optional.&lt;br /&gt;
&lt;br /&gt;
In addition to the standard properties, mod settings also contain:&lt;br /&gt;
&lt;br /&gt;
* hidden - [https://lua-api.factorio.com/latest/types/boolean.html boolean] - Optional.&lt;br /&gt;
* setting_type - [https://lua-api.factorio.com/latest/types/string.html string] - Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== The name property ===&lt;br /&gt;
&lt;br /&gt;
The name of the settings prototype should be unique to avoid mod conflicts since the mod settings are global across all mods. Because of that it is recommened to prefix mod settings with your mod name, &amp;quot;my-mod&amp;quot; in this example.&lt;br /&gt;
&lt;br /&gt;
=== The type property ===&lt;br /&gt;
&lt;br /&gt;
There are four types of mod settings:&lt;br /&gt;
&lt;br /&gt;
* bool-setting - a true/false checkbox&lt;br /&gt;
* int-setting - a signed 64 bit integer textfield (or selection dropdown)&lt;br /&gt;
* double-setting - a double precision floating point textfield (or selection dropdown)&lt;br /&gt;
* string-setting - a string textfield (or selection dropdown)&lt;br /&gt;
* color-setting - a color picker (sliders), with whole number textfields. Includes alpha.&lt;br /&gt;
&lt;br /&gt;
Depending on the type, the prototype also allows or requires additional properties, these are listed below.&lt;br /&gt;
&lt;br /&gt;
==== bool-setting ====&lt;br /&gt;
* default_value - [https://lua-api.factorio.com/latest/types/boolean.html boolean] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting, in this case whether the checkbox is checked or not.&lt;br /&gt;
* forced_value - [https://lua-api.factorio.com/latest/types/boolean.html boolean] - Optional.&lt;br /&gt;
** Only loaded if &amp;lt;code&amp;gt;hidden = true&amp;lt;/code&amp;gt;. This forces the setting to be of this value. This can be useful for mod compatiblity.&amp;lt;sup&amp;gt;[https://forums.factorio.com/viewtopic.php?p=531322#p531322]&lt;br /&gt;
&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== int-setting ====&lt;br /&gt;
* default_value - [https://lua-api.factorio.com/latest/types/int64.html int64] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* minimum_value - [https://lua-api.factorio.com/latest/types/int64.html int64] - Optional.&lt;br /&gt;
** Defines the lowest possible number.&lt;br /&gt;
* maximum_value - [https://lua-api.factorio.com/latest/types/int64.html int64] - Optional.&lt;br /&gt;
** Defines the highest possible number.&lt;br /&gt;
* allowed_values - array of [https://lua-api.factorio.com/latest/types/int64.html int64] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a texfield.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== double-setting ====&lt;br /&gt;
* default_value - [https://lua-api.factorio.com/latest/types/double.html double] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* minimum_value - [https://lua-api.factorio.com/latest/types/double.html double] - Optional.&lt;br /&gt;
** Defines the lowest possible number.&lt;br /&gt;
* maximum_value - [https://lua-api.factorio.com/latest/types/double.html double] - Optional.&lt;br /&gt;
** Defines the highest possible number.&lt;br /&gt;
* allowed_values - array of [https://lua-api.factorio.com/latest/types/double.html double] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a textfield.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== string-setting ====&lt;br /&gt;
* default_value - [https://lua-api.factorio.com/latest/types/string.html string] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* allow_blank - [https://lua-api.factorio.com/latest/types/boolean.html boolean] - Optional. - Default: false&lt;br /&gt;
** Defines whether it&#039;s possible for the user to set the textfield to empty and apply the setting.&lt;br /&gt;
* auto_trim - [https://lua-api.factorio.com/latest/types/boolean.html boolean] - Optional. - Default: false&lt;br /&gt;
** Whether values that are input by the user should have whitespace removed from both ends of the string.&lt;br /&gt;
* allowed_values - array of [https://lua-api.factorio.com/latest/types/string.html string] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined strings, creates a dropdown instead of a textfield. The strings in the dropdown can be localized (translated) and can have a tooltip, see below.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== color-setting ====&lt;br /&gt;
* default_value - [https://lua-api.factorio.com/latest/types/Color.html Color] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
&lt;br /&gt;
=== The order property ===&lt;br /&gt;
&lt;br /&gt;
The order property can be used to change how the mod settings are ordered in the settings gui. Mod settings are sorted&lt;br /&gt;
* first by mod&lt;br /&gt;
* then by the setting &amp;quot;order&amp;quot; string&lt;br /&gt;
* then finally by the setting name.&lt;br /&gt;
&lt;br /&gt;
For more info on how to use the order string, see [https://lua-api.factorio.com/latest/types/Order.html Order].&lt;br /&gt;
&lt;br /&gt;
=== The hidden property ===&lt;br /&gt;
&lt;br /&gt;
The hidden property can be used to hide mod settings from GUIs, so that they cannot be seen or changed by players. However, other mods can still access hidden settings.&amp;lt;sup&amp;gt;[https://forums.factorio.com/83316]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The setting_type property ===&lt;br /&gt;
[[File:Mod_settings_gui.png|right|300px|thumb|The mod settings gui. Can be reached from the main menu → Settings → Mod settings.]]&lt;br /&gt;
There are the overall kinds of settings:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;startup&#039;&#039;&#039;: This kind of setting is available in the prototype stage, and can not be changed runtime. They have to be  set to the same values for all players on a server.&lt;br /&gt;
* &#039;&#039;&#039;runtime-global&#039;&#039;&#039;: This kind of setting is global to an entire save game and can be changed runtime. On servers, only admins can change these settings.&lt;br /&gt;
* &#039;&#039;&#039;runtime-per-user&#039;&#039;&#039;: This kind of setting is only available runtime in the control.lua stage and each player has their own instance of this setting. When a player joins a server their local setting of &amp;quot;keep mod settings per save&amp;quot; determines if the local settings they have set are synced to the loaded save or if the save&#039;s settings are used.&lt;br /&gt;
&lt;br /&gt;
This &amp;quot;setting_type&amp;quot; also determines in which tab the setting is showed in the mod settings menu.&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
The locale for mod settings works like any other locale in the game. The names of the groups for the setting name and description (tooltip) are &amp;quot;mod-setting-name&amp;quot; and &amp;quot;mod-setting-description&amp;quot;. The dropdown items of a string setting can be localized in the &amp;quot;string-mod-setting&amp;quot; group, but the game falls back to just showing the name of the dropdown item if no localization is found. An example for mod setting localization that would be set within &amp;quot;locale/en/locale.cfg&amp;quot;, is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mod-setting-name]&lt;br /&gt;
my-mod-string-test-setting=Localized test setting name&lt;br /&gt;
&lt;br /&gt;
[mod-setting-description]&lt;br /&gt;
my-mod-string-test-setting=Localized test setting description&lt;br /&gt;
&lt;br /&gt;
[string-mod-setting]&lt;br /&gt;
#&amp;lt;setting-name&amp;gt;-&amp;lt;dropdown-item-name&amp;gt;=&amp;lt;translated dropdown item&amp;gt;&lt;br /&gt;
my-mod-string-test-setting-item-1=Item 1 localized string&lt;br /&gt;
&lt;br /&gt;
[string-mod-setting-description]&lt;br /&gt;
#&amp;lt;setting-name&amp;gt;-&amp;lt;dropdown-item-name&amp;gt;=&amp;lt;tooltip of dropdown item&amp;gt;&lt;br /&gt;
my-mod-string-test-setting-item-1=Item 1 localized tooltip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
=== Reading settings ===&lt;br /&gt;
When accessing any mod setting, you will have to specifically access the &#039;&#039;value&#039;&#039; of the setting. The data type of the value depends on the type of the setting. For string settings that use a selection of allowed values, the value of the setting is one of the original string values defined in the prototype, the localization is ignored. See also: [http://lua-api.factorio.com/latest/Concepts.html#ModSetting ModSetting concept].&lt;br /&gt;
&lt;br /&gt;
In the prototype stage you can access settings of the setting_type &amp;quot;startup&amp;quot; by indexing &amp;lt;code&amp;gt;settings.startup&amp;lt;/code&amp;gt; with the name of the setting. Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;int-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-stone-wall-stack-size&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;startup&amp;quot;,&lt;br /&gt;
        minimum_value = 1,&lt;br /&gt;
        default_value = 100&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in data.lua:&lt;br /&gt;
data.raw.item[&amp;quot;stone-wall&amp;quot;].stack_size = settings.startup[&amp;quot;my-mod-stone-wall-stack-size&amp;quot;].value&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;plainlinks&amp;quot;&amp;gt;&lt;br /&gt;
In the control stage, the same start-up settings are available. More settings become available: &amp;quot;runtime-global&amp;quot; (the &#039;&#039;current&#039;&#039; settings, under the Map tab in Mod Settings) can be accessed using &amp;lt;code&amp;gt;settings.global[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt; (see [https://lua-api.factorio.com/latest/LuaSettings.html LuaSettings]). Settings of the setting_type &amp;quot;runtime-per-user&amp;quot; are accessed using &amp;lt;code&amp;gt;settings.get_player_settings([https://lua-api.factorio.com/latest/Concepts.html#PlayerIdentification &amp;amp;lt;PlayerIdentification&amp;amp;gt;])[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;game.players[[https://lua-api.factorio.com/latest/Concepts.html#PlayerIdentification &amp;amp;lt;PlayerIdentification&amp;amp;gt;]].mod_settings[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;string-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-always-difficult&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = &amp;quot;yes&amp;quot;,&lt;br /&gt;
        allowed_values = {&amp;quot;yes&amp;quot;, &amp;quot;no&amp;quot;}&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;bool-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-kill-player-on-entity-built&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-per-user&amp;quot;,&lt;br /&gt;
        default_value = false&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in control.lua:&lt;br /&gt;
script.on_init(function()&lt;br /&gt;
    if settings.global[&amp;quot;my-mod-always-difficult&amp;quot;].value == &amp;quot;yes&amp;quot; then&lt;br /&gt;
        game.difficulty_settings.recipe_difficulty = 1&lt;br /&gt;
        game.difficulty_settings.technology_difficulty = 1&lt;br /&gt;
        game.difficulty_settings.technology_price_multiplier = 4&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
script.on_event(defines.events.on_built_entity, function(event)&lt;br /&gt;
    local setting_value = settings.get_player_settings(event.player_index)[&amp;quot;my-mod-kill-player-on-entity-built&amp;quot;].value&lt;br /&gt;
    if setting_value then&lt;br /&gt;
        game.get_player(event.player_index).die()&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Writing to your own settings ===&lt;br /&gt;
It is possible for mods to write to their own runtime (global or per player) mod settings. This is done by writing a new [https://lua-api.factorio.com/latest/Concepts.html#ModSetting ModSetting] table to the setting.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;string-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-always-difficult&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = &amp;quot;yes&amp;quot;,&lt;br /&gt;
        allowed_values = {&amp;quot;yes&amp;quot;, &amp;quot;no&amp;quot;}&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in control.lua:&lt;br /&gt;
script.on_event(defines.events.on_rocket_launched, function()&lt;br /&gt;
    settings.global[&amp;quot;my-mod-always-difficult&amp;quot;] = {value = &amp;quot;yes&amp;quot;}&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Changing another mod&#039;s settings ===&lt;br /&gt;
After creating a setting in the settings stage, it is stored in data.raw until the end of the stage, so it can be altered from another mod.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings-updates.lua:&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].order = &amp;quot;abc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the intent is to force the setting to be of a certain value that cannot be modified by players, the properties [[#The_hidden_property|hidden]], allowed_values and forced_value can be used. Modifying existing settings of other mods can be useful for mod packs or other mod compatibility goals.[https://forums.factorio.com/viewtopic.php?p=531322#p531322]&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings-updates.lua:&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].hidden = true&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].allowed_values = {&amp;quot;no&amp;quot;}&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].default_value = &amp;quot;no&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tips ===&lt;br /&gt;
* Do not conditionally &#039;require(...)&#039; things depending on mod settings: This breaks the CRC checks and people will get errors trying to use your mod in multiplayer. &#039;require(...)&#039; everything and then conditionally add the values to data.raw using the settings.&lt;br /&gt;
* You should cache the settings table inside the event you use it in. Accessing it is relatively expensive (about as expensive as accessing game.*prototypes[...]), so when accessing it mutliple times within the same event, you should set a local variable to it (within the event) to improve performance.&lt;br /&gt;
** If you want to cache startup/and runtime settings outside of events, you will have to makes sure that the local variable of settings of the setting_type &amp;quot;runtime-global&amp;quot; are updated in the &amp;lt;code&amp;gt;on_runtime_mod_setting_changed&amp;lt;/code&amp;gt; event.&lt;br /&gt;
* If you want to detect whether a certain mod is installed in the settings stage, you can use &amp;lt;code&amp;gt;if mods[&amp;quot;another-mods-name&amp;quot;] then&amp;lt;/code&amp;gt;, just like in the data stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?p=207275 Forum post documenting mod settings]&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?p=305644#p305644 per_user is not a valid property and has no effects!]&lt;br /&gt;
* [http://lua-api.factorio.com/latest/LuaSettings.html Lua api documentation on the settings table]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding]]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Mod_structure&amp;diff=195073</id>
		<title>Tutorial:Mod structure</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Mod_structure&amp;diff=195073"/>
		<updated>2023-11-06T06:58:25Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* dependencies */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}Mods are expected to have a certain structure in order to be loaded by the game. This page aims to explain that file structure and what each file is used for.&lt;br /&gt;
&lt;br /&gt;
== Mod folder and file structure ==&lt;br /&gt;
&lt;br /&gt;
The mod must either be in a folder, or in a folder inside a zip file. The mod folder (no zip file) must either be named in the pattern of &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt; or just &amp;lt;code&amp;gt;{mod-name}&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;test-mod-thing&amp;lt;/code&amp;gt;. The mod zip must be named in the pattern of &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;test-mod-thing_0.0.1&amp;lt;/code&amp;gt;. When using a zip file for the mod, the folder inside the zip file does not have any naming restrictions; only the zip file itself must be named with the &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt; pattern. The mod name and its version number are defined in the [[#info.json|info.json]] file.&lt;br /&gt;
&lt;br /&gt;
=== Files ===&lt;br /&gt;
Inside the mod folder, the game automatically reads the following files during load:&lt;br /&gt;
* info.json — The only mandatory file. The [[#info.json|info.json]] identifies the mod, defines its version and other general properties.&lt;br /&gt;
* changelog.txt — Version history of the mod, to be shown in the mod browser. The changelog file must follow the strict [[Tutorial:Mod changelog format|formatting requirements]].&lt;br /&gt;
* thumbnail.png — Thumbnail to be shown on the mod portal and in the mod browser in-game. Ideally a 144x144px image file.&lt;br /&gt;
* settings.lua — This and the next two files are used to set up mod [[Tutorial:Mod settings|configuration options]].&lt;br /&gt;
* settings-updates.lua&lt;br /&gt;
* settings-final-fixes.lua&lt;br /&gt;
* data.lua — This and the next two files are used to define [https://lua-api.factorio.com/latest/index-prototype.html prototypes].&lt;br /&gt;
* data-updates.lua — The load order of the three data*.lua files is explained on [https://lua-api.factorio.com/latest/auxiliary/data-lifecycle.html Data lifecycle].&lt;br /&gt;
* data-final-fixes.lua&lt;br /&gt;
* control.lua — This file is used for runtime scripting. Runtime scripting is documented on [https://lua-api.factorio.com/latest/index-runtime.html lua-api.factorio.com].&lt;br /&gt;
&lt;br /&gt;
=== Subfolders ===&lt;br /&gt;
Furthermore, the following folders inside the mod folder are recognized by the game:&lt;br /&gt;
* locale — Can contain up to one subfolder per language, identified with the language code, for example &amp;lt;code&amp;gt;en&amp;lt;/code&amp;gt; for English. The subfolder then has to contain at least one *.cfg file which defines the [[Tutorial:Localisation|translations]] for that language.&lt;br /&gt;
* scenarios — Custom [[scenario system|scenarios]] can be placed in subfolders of this folder.&lt;br /&gt;
* campaigns — Custom campaigns can be placed in subfolders of this folder.&lt;br /&gt;
* tutorials — Custom [[Prototype/Tutorial|tutorials]] can be placed in subfolders of this folder.&lt;br /&gt;
* migrations — [https://lua-api.factorio.com/latest/auxiliary/migrations.html Migration files] are placed in this folder. They are a way to handle prototype changes and mod data structure changes between mod versions or game versions.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
Here is an example directory structure for a mod titled &amp;lt;code&amp;gt;my-armor-mod&amp;lt;/code&amp;gt; with a version number of &amp;lt;code&amp;gt;0.3.6&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
my-armor-mod_0.3.6.zip&lt;br /&gt;
|- aFolderName/&lt;br /&gt;
  |- control.lua&lt;br /&gt;
  |- data.lua&lt;br /&gt;
  |- info.json&lt;br /&gt;
  |- thumbnail.png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== info.json ==&lt;br /&gt;
&lt;br /&gt;
The info.json file identifies the mod and defines its version. If the game encounters a problem when parsing the file, the error message can be found in the [[log file]]. A minimal info.json file can look like this:&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;test-mod-thing&amp;quot;,&lt;br /&gt;
      &amp;quot;version&amp;quot;: &amp;quot;0.0.1&amp;quot;,&lt;br /&gt;
      &amp;quot;title&amp;quot;: &amp;quot;My best test mod&amp;quot;,&lt;br /&gt;
      &amp;quot;author&amp;quot;: &amp;quot;A very great tester&amp;quot;,&lt;br /&gt;
      &amp;quot;factorio_version&amp;quot;: &amp;quot;1.1&amp;quot;,&lt;br /&gt;
      &amp;quot;dependencies&amp;quot;: [&amp;quot;? optional-mod&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The info.json file supports the following fields:&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory field. The internal name of mod. The game accepts anything as a mod name, however the mod portal restricts mod names to only consist of alphanumeric characters, dashes and underscores. Note that the mod folder or mod zip file name has to contain the mod name, where the restrictions of the file system apply.&lt;br /&gt;
&lt;br /&gt;
The game accepts mod names with a maximum length of 100 characters. The mod portal only accepts mods with names that are longer than 3 characters and shorter than 50 characters.&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory field. Defines the version of the mod in the format &amp;lt;code&amp;gt;&amp;quot;number.number.number&amp;quot;&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;&amp;quot;Major.Middle.Minor&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;0.6.4&amp;quot;&amp;lt;/code&amp;gt;. Each number can range from 0 to 65535.&lt;br /&gt;
&lt;br /&gt;
=== title === &lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory field. The display name of the mod, so it is not recommended to use someUgly_pRoGrAmMeR-name here. Can be overwritten with a locale entry in the &amp;lt;code&amp;gt;mod-name&amp;lt;/code&amp;gt; category, using the internal mod name as the key.&lt;br /&gt;
&lt;br /&gt;
The game will reject a title field that is longer than 100 characters. However, this can be worked around by using the locale entry. The mod portal does not restrict mod title length.&lt;br /&gt;
&lt;br /&gt;
=== author === &lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory field. The author of the mod. This field does not have restrictions, it can also be a list of authors etc. The mod portal ignores this field, it will simply display the uploader&#039;s name as the author.&lt;br /&gt;
&lt;br /&gt;
=== contact === &lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Optional field. How the mod author can be contacted, for example an email address.&lt;br /&gt;
&lt;br /&gt;
=== homepage === &lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Optional field. Where the mod can be found on the internet. Note that the in-game mod browser shows the mod portal link additionally to this field. Please don&#039;t put &amp;quot;None&amp;quot; here, it makes the field on the mod portal website look ugly. Just leave the field empty if the mod doesn&#039;t have a website/forum thread/discord.&lt;br /&gt;
&lt;br /&gt;
=== description === &lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Optional field. A short description of what your mod does. This is all that people get to see in-game. Can be overwritten with a locale entry in the &amp;lt;code&amp;gt;mod-description&amp;lt;/code&amp;gt; category, using the internal mod name as the key.&lt;br /&gt;
&lt;br /&gt;
=== factorio_version ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;0.12&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Optional field in the format &amp;lt;code&amp;gt;&amp;quot;major.minor&amp;quot;&amp;lt;/code&amp;gt;. The Factorio version that this mod supports. This can only be one Factorio version, not multiple. However, it includes all &amp;lt;code&amp;gt;.sub&amp;lt;/code&amp;gt; versions. While the field is optional, usually mods are developed for versions higher than the default 0.12, so the field has to be added anyway.&lt;br /&gt;
&lt;br /&gt;
Adding a sub part, e.g. &amp;quot;0.18.&#039;&#039;&#039;27&#039;&#039;&#039;&amp;quot; will make the mod portal reject the mod and the game act weirdly. That means this shouldn&#039;t be done; use only the major and minor components &amp;lt;code&amp;gt;&amp;quot;major.minor&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;1.0&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Mods with the factorio_version &amp;quot;0.18&amp;quot; can also be loaded in 1.0 and the mod portal will return them when queried for factorio_version 1.0 mods.&lt;br /&gt;
&lt;br /&gt;
=== dependencies ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: array of [[#Dependency]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: [&amp;quot;base&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
Optional field. Mods that this mod depends on or is incompatible with. If this mod depends on another, the other mod will load first, see [https://lua-api.factorio.com/latest/auxiliary/data-lifecycle.html Data lifecycle]. An empty array allows to work around the default and have no dependencies at all.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;quot;dependencies&amp;quot;: [&amp;quot;mod-a&amp;quot;, &amp;quot;? mod-c &amp;gt; 0.4.3&amp;quot;, &amp;quot;! mod-g&amp;quot;]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;h4&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot; id=&amp;quot;Dependency&amp;quot;&amp;gt;Dependency&amp;lt;/span&amp;gt;&amp;lt;/h4&amp;gt;&lt;br /&gt;
: Each dependency is a string that consists of up to three parts: &amp;lt;code&amp;gt;&amp;quot;&amp;lt;prefix&amp;gt; internal-mod-name &amp;lt;equality-operator version&amp;gt;&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;? some-mod-everyone-loves &amp;gt;= 4.2.0&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:The equality operator (&amp;lt;code&amp;gt;&amp;lt;, &amp;lt;=, =, &amp;gt;= or &amp;gt;&amp;lt;/code&amp;gt;) combined with the version allows to define dependencies that require certain mod versions, but it is not required. Incompatibility does not support versions; if incompatibility is used, version is ignored.&lt;br /&gt;
&lt;br /&gt;
:The possible prefixes are:&lt;br /&gt;
:* &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; for incompatibility&lt;br /&gt;
:* &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt; for an optional dependency. A false match on version marks the mod as having unsatisfied requirements. (A red label)&lt;br /&gt;
:* &amp;lt;code&amp;gt;(?)&amp;lt;/code&amp;gt; for a hidden optional dependency&lt;br /&gt;
:* &amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt; for a dependency that does not affect load order&lt;br /&gt;
:* no prefix for a hard requirement for the other mod.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Tutorial:Modding tutorial|Modding tutorial overview]]&lt;br /&gt;
* [https://lua-api.factorio.com/latest/index-prototype.html Prototype documentation]&lt;br /&gt;
* [https://lua-api.factorio.com/latest/index-runtime.html Runtime API documentation]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Mod_structure&amp;diff=195072</id>
		<title>Tutorial:Mod structure</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Mod_structure&amp;diff=195072"/>
		<updated>2023-11-06T06:54:59Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* dependencies */ detail on false match for optional dependency with version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}Mods are expected to have a certain structure in order to be loaded by the game. This page aims to explain that file structure and what each file is used for.&lt;br /&gt;
&lt;br /&gt;
== Mod folder and file structure ==&lt;br /&gt;
&lt;br /&gt;
The mod must either be in a folder, or in a folder inside a zip file. The mod folder (no zip file) must either be named in the pattern of &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt; or just &amp;lt;code&amp;gt;{mod-name}&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;test-mod-thing&amp;lt;/code&amp;gt;. The mod zip must be named in the pattern of &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;test-mod-thing_0.0.1&amp;lt;/code&amp;gt;. When using a zip file for the mod, the folder inside the zip file does not have any naming restrictions; only the zip file itself must be named with the &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt; pattern. The mod name and its version number are defined in the [[#info.json|info.json]] file.&lt;br /&gt;
&lt;br /&gt;
=== Files ===&lt;br /&gt;
Inside the mod folder, the game automatically reads the following files during load:&lt;br /&gt;
* info.json — The only mandatory file. The [[#info.json|info.json]] identifies the mod, defines its version and other general properties.&lt;br /&gt;
* changelog.txt — Version history of the mod, to be shown in the mod browser. The changelog file must follow the strict [[Tutorial:Mod changelog format|formatting requirements]].&lt;br /&gt;
* thumbnail.png — Thumbnail to be shown on the mod portal and in the mod browser in-game. Ideally a 144x144px image file.&lt;br /&gt;
* settings.lua — This and the next two files are used to set up mod [[Tutorial:Mod settings|configuration options]].&lt;br /&gt;
* settings-updates.lua&lt;br /&gt;
* settings-final-fixes.lua&lt;br /&gt;
* data.lua — This and the next two files are used to define [https://lua-api.factorio.com/latest/index-prototype.html prototypes].&lt;br /&gt;
* data-updates.lua — The load order of the three data*.lua files is explained on [https://lua-api.factorio.com/latest/auxiliary/data-lifecycle.html Data lifecycle].&lt;br /&gt;
* data-final-fixes.lua&lt;br /&gt;
* control.lua — This file is used for runtime scripting. Runtime scripting is documented on [https://lua-api.factorio.com/latest/index-runtime.html lua-api.factorio.com].&lt;br /&gt;
&lt;br /&gt;
=== Subfolders ===&lt;br /&gt;
Furthermore, the following folders inside the mod folder are recognized by the game:&lt;br /&gt;
* locale — Can contain up to one subfolder per language, identified with the language code, for example &amp;lt;code&amp;gt;en&amp;lt;/code&amp;gt; for English. The subfolder then has to contain at least one *.cfg file which defines the [[Tutorial:Localisation|translations]] for that language.&lt;br /&gt;
* scenarios — Custom [[scenario system|scenarios]] can be placed in subfolders of this folder.&lt;br /&gt;
* campaigns — Custom campaigns can be placed in subfolders of this folder.&lt;br /&gt;
* tutorials — Custom [[Prototype/Tutorial|tutorials]] can be placed in subfolders of this folder.&lt;br /&gt;
* migrations — [https://lua-api.factorio.com/latest/auxiliary/migrations.html Migration files] are placed in this folder. They are a way to handle prototype changes and mod data structure changes between mod versions or game versions.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
Here is an example directory structure for a mod titled &amp;lt;code&amp;gt;my-armor-mod&amp;lt;/code&amp;gt; with a version number of &amp;lt;code&amp;gt;0.3.6&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
my-armor-mod_0.3.6.zip&lt;br /&gt;
|- aFolderName/&lt;br /&gt;
  |- control.lua&lt;br /&gt;
  |- data.lua&lt;br /&gt;
  |- info.json&lt;br /&gt;
  |- thumbnail.png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== info.json ==&lt;br /&gt;
&lt;br /&gt;
The info.json file identifies the mod and defines its version. If the game encounters a problem when parsing the file, the error message can be found in the [[log file]]. A minimal info.json file can look like this:&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;test-mod-thing&amp;quot;,&lt;br /&gt;
      &amp;quot;version&amp;quot;: &amp;quot;0.0.1&amp;quot;,&lt;br /&gt;
      &amp;quot;title&amp;quot;: &amp;quot;My best test mod&amp;quot;,&lt;br /&gt;
      &amp;quot;author&amp;quot;: &amp;quot;A very great tester&amp;quot;,&lt;br /&gt;
      &amp;quot;factorio_version&amp;quot;: &amp;quot;1.1&amp;quot;,&lt;br /&gt;
      &amp;quot;dependencies&amp;quot;: [&amp;quot;? optional-mod&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The info.json file supports the following fields:&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory field. The internal name of mod. The game accepts anything as a mod name, however the mod portal restricts mod names to only consist of alphanumeric characters, dashes and underscores. Note that the mod folder or mod zip file name has to contain the mod name, where the restrictions of the file system apply.&lt;br /&gt;
&lt;br /&gt;
The game accepts mod names with a maximum length of 100 characters. The mod portal only accepts mods with names that are longer than 3 characters and shorter than 50 characters.&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory field. Defines the version of the mod in the format &amp;lt;code&amp;gt;&amp;quot;number.number.number&amp;quot;&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;&amp;quot;Major.Middle.Minor&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;0.6.4&amp;quot;&amp;lt;/code&amp;gt;. Each number can range from 0 to 65535.&lt;br /&gt;
&lt;br /&gt;
=== title === &lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory field. The display name of the mod, so it is not recommended to use someUgly_pRoGrAmMeR-name here. Can be overwritten with a locale entry in the &amp;lt;code&amp;gt;mod-name&amp;lt;/code&amp;gt; category, using the internal mod name as the key.&lt;br /&gt;
&lt;br /&gt;
The game will reject a title field that is longer than 100 characters. However, this can be worked around by using the locale entry. The mod portal does not restrict mod title length.&lt;br /&gt;
&lt;br /&gt;
=== author === &lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory field. The author of the mod. This field does not have restrictions, it can also be a list of authors etc. The mod portal ignores this field, it will simply display the uploader&#039;s name as the author.&lt;br /&gt;
&lt;br /&gt;
=== contact === &lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Optional field. How the mod author can be contacted, for example an email address.&lt;br /&gt;
&lt;br /&gt;
=== homepage === &lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Optional field. Where the mod can be found on the internet. Note that the in-game mod browser shows the mod portal link additionally to this field. Please don&#039;t put &amp;quot;None&amp;quot; here, it makes the field on the mod portal website look ugly. Just leave the field empty if the mod doesn&#039;t have a website/forum thread/discord.&lt;br /&gt;
&lt;br /&gt;
=== description === &lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Optional field. A short description of what your mod does. This is all that people get to see in-game. Can be overwritten with a locale entry in the &amp;lt;code&amp;gt;mod-description&amp;lt;/code&amp;gt; category, using the internal mod name as the key.&lt;br /&gt;
&lt;br /&gt;
=== factorio_version ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;0.12&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Optional field in the format &amp;lt;code&amp;gt;&amp;quot;major.minor&amp;quot;&amp;lt;/code&amp;gt;. The Factorio version that this mod supports. This can only be one Factorio version, not multiple. However, it includes all &amp;lt;code&amp;gt;.sub&amp;lt;/code&amp;gt; versions. While the field is optional, usually mods are developed for versions higher than the default 0.12, so the field has to be added anyway.&lt;br /&gt;
&lt;br /&gt;
Adding a sub part, e.g. &amp;quot;0.18.&#039;&#039;&#039;27&#039;&#039;&#039;&amp;quot; will make the mod portal reject the mod and the game act weirdly. That means this shouldn&#039;t be done; use only the major and minor components &amp;lt;code&amp;gt;&amp;quot;major.minor&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;1.0&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Mods with the factorio_version &amp;quot;0.18&amp;quot; can also be loaded in 1.0 and the mod portal will return them when queried for factorio_version 1.0 mods.&lt;br /&gt;
&lt;br /&gt;
=== dependencies ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: array of [[#Dependency]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: [&amp;quot;base&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
Optional field. Mods that this mod depends on or is incompatible with. If this mod depends on another, the other mod will load first, see [https://lua-api.factorio.com/latest/auxiliary/data-lifecycle.html Data lifecycle]. An empty array allows to work around the default and have no dependencies at all.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;quot;dependencies&amp;quot;: [&amp;quot;mod-a&amp;quot;, &amp;quot;? mod-c &amp;gt; 0.4.3&amp;quot;, &amp;quot;! mod-g&amp;quot;]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;h4&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot; id=&amp;quot;Dependency&amp;quot;&amp;gt;Dependency&amp;lt;/span&amp;gt;&amp;lt;/h4&amp;gt;&lt;br /&gt;
: Each dependency is a string that consists of up to three parts: &amp;lt;code&amp;gt;&amp;quot;&amp;lt;prefix&amp;gt; internal-mod-name &amp;lt;equality-operator version&amp;gt;&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;? some-mod-everyone-loves &amp;gt;= 4.2.0&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:The equality operator (&amp;lt;code&amp;gt;&amp;lt;, &amp;lt;=, =, &amp;gt;= or &amp;gt;&amp;lt;/code&amp;gt;) combined with the version allows to define dependencies that require certain mod versions, but it is not required. Incompatibility does not support versions; if incompatibility is used, version is ignored.&lt;br /&gt;
&lt;br /&gt;
:The possible prefixes are:&lt;br /&gt;
:* &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; for incompatibility&lt;br /&gt;
:* &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt; for an optional dependency. A false match on version disables the mod with the optional and version dependency. (incompatibility)&lt;br /&gt;
:* &amp;lt;code&amp;gt;(?)&amp;lt;/code&amp;gt; for a hidden optional dependency&lt;br /&gt;
:* &amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt; for a dependency that does not affect load order&lt;br /&gt;
:* no prefix for a hard requirement for the other mod.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Tutorial:Modding tutorial|Modding tutorial overview]]&lt;br /&gt;
* [https://lua-api.factorio.com/latest/index-prototype.html Prototype documentation]&lt;br /&gt;
* [https://lua-api.factorio.com/latest/index-runtime.html Runtime API documentation]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/MapGenPreset&amp;diff=192141</id>
		<title>Types/MapGenPreset</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/MapGenPreset&amp;diff=192141"/>
		<updated>2023-08-15T23:52:24Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* default */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basics ==&lt;br /&gt;
A map gen preset. Used in [[Prototype/MapGenPresets]].&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
&lt;br /&gt;
=== order ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Order]]&lt;br /&gt;
&lt;br /&gt;
Specifies the ordering in the [[map generator]] gui.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
&lt;br /&gt;
=== default ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Whether this is the default preset. If set to true, this preset may not have any other properties besides this and order.&lt;br /&gt;
&lt;br /&gt;
If no MapGenPreset has &amp;lt;code&amp;gt;default = true&amp;lt;/code&amp;gt;, the preset selector will have a blank preset label, having default settings. The &amp;quot;blank&amp;quot; preset goes away when another preset is selected.&lt;br /&gt;
&lt;br /&gt;
=== basic_settings ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]]&lt;br /&gt;
&lt;br /&gt;
This is a table with the below key/value pairs. All key/value pairs are optional. If not set they will just use the default values.&lt;br /&gt;
&lt;br /&gt;
* terrain_segmentation - [[Types/MapGenSize]]&lt;br /&gt;
:: This is the inverse of &amp;quot;water scale&amp;quot; in the map generator GUI. So a water scale that shows as 50% in the GUI is a value of &amp;lt;code&amp;gt;1/0.5 = 2&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;terrain_segmentation&amp;lt;/code&amp;gt;.&lt;br /&gt;
* water - [[Types/MapGenSize]]&lt;br /&gt;
:: Shown as water coverage in the map generator GUI.&lt;br /&gt;
* default_enable_all_autoplace_controls - [[Types/bool]] - Default: true&lt;br /&gt;
:: Whether undefined autoplace_controls should fall back to the default controls or not.&lt;br /&gt;
* autoplace_controls - [[Types/table]]&lt;br /&gt;
:: Table of [[Data.raw#autoplace-control]] name keys mapped to table values. Each table can have the following fields:&lt;br /&gt;
::* frequency - [[Types/MapGenSize]]&lt;br /&gt;
::* size - [[Types/MapGenSize]]&lt;br /&gt;
::* richness - [[Types/MapGenSize]]&lt;br /&gt;
::Example:&lt;br /&gt;
::&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;autoplace_controls =&lt;br /&gt;
  {&lt;br /&gt;
    [&amp;quot;iron-ore&amp;quot;] = { richness = 2, size = 0.5, frequency=2},&lt;br /&gt;
    [&amp;quot;enemy-base&amp;quot;] = { size = 1},&lt;br /&gt;
    [&amp;quot;trees&amp;quot;] = { richness = 4}&lt;br /&gt;
  }&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* autoplace_settings - [[Types/table]] of [https://lua-api.factorio.com/latest/Concepts.html#AutoplaceSettings AutoplaceSettings]&lt;br /&gt;
:: Each setting in this table maps the string type to the settings for that type. Valid types are &amp;quot;entity&amp;quot;, &amp;quot;tile&amp;quot; and &amp;quot;decorative&amp;quot;.&lt;br /&gt;
* property_expression_names - [[Types/table]]&lt;br /&gt;
:: Map of property name (e.g. &amp;quot;elevation&amp;quot;) to name of [[Prototype/NamedNoiseExpression|noise expression]] that will provide it. Entries may be omitted. A notable usage is changing autoplace behavior of an entity based on the preset, which cannot be read from a noise expression.&lt;br /&gt;
* starting_points - [[Types/table]] of [[Types/Position]]&lt;br /&gt;
:: Array of the positions of the starting areas.&lt;br /&gt;
* seed - [[Types/uint32]]&lt;br /&gt;
:: Read by the game, but not used or set in the GUI.&lt;br /&gt;
* width - [[Types/uint32]]&lt;br /&gt;
:: Amount of tiles from left to right. Silently limited to 2,000,000, +/- 1 million tiles from the center.&lt;br /&gt;
* height - [[Types/uint32]]&lt;br /&gt;
:: Amount of tiles from top to bottom. Silently limited to 2,000,000, +/- 1 million tiles from the center.&lt;br /&gt;
* starting_area - [[Types/MapGenSize]]&lt;br /&gt;
:: Size of the starting area. The starting area only effects enemy placement, and has no effect on resources.&lt;br /&gt;
* peaceful_mode - [[Types/bool]]&lt;br /&gt;
* cliff_settings - [https://lua-api.factorio.com/latest/Concepts.html#CliffPlacementSettings CliffPlacementSettings]&lt;br /&gt;
&lt;br /&gt;
=== advanced_settings ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]]&lt;br /&gt;
&lt;br /&gt;
This is a table with the below key/value pairs. All key/value pairs are optional, if not set they will just use the existing values.&lt;br /&gt;
* pollution - [[Types/table]]&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property name !! Type !! Comment&lt;br /&gt;
|-&lt;br /&gt;
| enabled || [[Types/bool]]&lt;br /&gt;
|-&lt;br /&gt;
| diffusion_ratio || [[Types/double]] || Must be &amp;lt;= 0.25.&lt;br /&gt;
|-&lt;br /&gt;
| ageing || [[Types/double]] || Also known as dissipation rate. Must be &amp;gt;= 0.5. &lt;br /&gt;
|-&lt;br /&gt;
| enemy_attack_pollution_consumption_modifier ||  [[Types/double]] &lt;br /&gt;
|-&lt;br /&gt;
| min_pollution_to_damage_trees || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
| pollution_restored_per_tree_damage || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
* enemy_evolution - [[Types/table]]&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property name !! Type&lt;br /&gt;
|- &lt;br /&gt;
| enabled || [[Types/bool]]&lt;br /&gt;
|- &lt;br /&gt;
| time_factor || [[Types/double]]&lt;br /&gt;
|- &lt;br /&gt;
| destroy_factor || [[Types/double]]&lt;br /&gt;
|- &lt;br /&gt;
| pollution_factor || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
* enemy_expansion - [[Types/table]]&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property name !! Type !! Comment&lt;br /&gt;
|-                                            &lt;br /&gt;
| enabled || [[Types/bool]]&lt;br /&gt;
|-&lt;br /&gt;
| max_expansion_distance || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
| settler_group_min_size || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
| settler_group_max_size || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
| min_expansion_cooldown || [[Types/double]] || In ticks.&lt;br /&gt;
|-&lt;br /&gt;
| max_expansion_cooldown || [[Types/double]] || In ticks.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* difficulty_settings - [[Types/table]]&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property name !! Type !! Comment&lt;br /&gt;
|-&lt;br /&gt;
| recipe_difficulty || [https://lua-api.factorio.com/latest/defines.html#defines.difficulty_settings defines.difficulty_settings.recipe_difficulty]&lt;br /&gt;
|-&lt;br /&gt;
| technology_difficulty || [https://lua-api.factorio.com/latest/defines.html#defines.difficulty_settings defines.difficulty_settings.technology_difficulty]&lt;br /&gt;
|-&lt;br /&gt;
| technology_price_multiplier || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
| research_queue_setting || [[Types/string]] || Either &amp;quot;after-victory&amp;quot;, &amp;quot;always&amp;quot; or &amp;quot;never&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/MapGenPreset&amp;diff=192140</id>
		<title>Types/MapGenPreset</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/MapGenPreset&amp;diff=192140"/>
		<updated>2023-08-15T23:51:35Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* default */ when there is not any default&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basics ==&lt;br /&gt;
A map gen preset. Used in [[Prototype/MapGenPresets]].&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
&lt;br /&gt;
=== order ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Order]]&lt;br /&gt;
&lt;br /&gt;
Specifies the ordering in the [[map generator]] gui.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
&lt;br /&gt;
=== default ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Whether this is the default preset. If set to true, this preset may not have any other properties besides this and order.&lt;br /&gt;
&lt;br /&gt;
If no MapGenPreset has &amp;lt;code&amp;gt;default = true&amp;lt;/code&amp;gt;, the preset selector will have a blank preset label, having default settings, which goes away when another preset is selected.&lt;br /&gt;
&lt;br /&gt;
=== basic_settings ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]]&lt;br /&gt;
&lt;br /&gt;
This is a table with the below key/value pairs. All key/value pairs are optional. If not set they will just use the default values.&lt;br /&gt;
&lt;br /&gt;
* terrain_segmentation - [[Types/MapGenSize]]&lt;br /&gt;
:: This is the inverse of &amp;quot;water scale&amp;quot; in the map generator GUI. So a water scale that shows as 50% in the GUI is a value of &amp;lt;code&amp;gt;1/0.5 = 2&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;terrain_segmentation&amp;lt;/code&amp;gt;.&lt;br /&gt;
* water - [[Types/MapGenSize]]&lt;br /&gt;
:: Shown as water coverage in the map generator GUI.&lt;br /&gt;
* default_enable_all_autoplace_controls - [[Types/bool]] - Default: true&lt;br /&gt;
:: Whether undefined autoplace_controls should fall back to the default controls or not.&lt;br /&gt;
* autoplace_controls - [[Types/table]]&lt;br /&gt;
:: Table of [[Data.raw#autoplace-control]] name keys mapped to table values. Each table can have the following fields:&lt;br /&gt;
::* frequency - [[Types/MapGenSize]]&lt;br /&gt;
::* size - [[Types/MapGenSize]]&lt;br /&gt;
::* richness - [[Types/MapGenSize]]&lt;br /&gt;
::Example:&lt;br /&gt;
::&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;autoplace_controls =&lt;br /&gt;
  {&lt;br /&gt;
    [&amp;quot;iron-ore&amp;quot;] = { richness = 2, size = 0.5, frequency=2},&lt;br /&gt;
    [&amp;quot;enemy-base&amp;quot;] = { size = 1},&lt;br /&gt;
    [&amp;quot;trees&amp;quot;] = { richness = 4}&lt;br /&gt;
  }&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* autoplace_settings - [[Types/table]] of [https://lua-api.factorio.com/latest/Concepts.html#AutoplaceSettings AutoplaceSettings]&lt;br /&gt;
:: Each setting in this table maps the string type to the settings for that type. Valid types are &amp;quot;entity&amp;quot;, &amp;quot;tile&amp;quot; and &amp;quot;decorative&amp;quot;.&lt;br /&gt;
* property_expression_names - [[Types/table]]&lt;br /&gt;
:: Map of property name (e.g. &amp;quot;elevation&amp;quot;) to name of [[Prototype/NamedNoiseExpression|noise expression]] that will provide it. Entries may be omitted. A notable usage is changing autoplace behavior of an entity based on the preset, which cannot be read from a noise expression.&lt;br /&gt;
* starting_points - [[Types/table]] of [[Types/Position]]&lt;br /&gt;
:: Array of the positions of the starting areas.&lt;br /&gt;
* seed - [[Types/uint32]]&lt;br /&gt;
:: Read by the game, but not used or set in the GUI.&lt;br /&gt;
* width - [[Types/uint32]]&lt;br /&gt;
:: Amount of tiles from left to right. Silently limited to 2,000,000, +/- 1 million tiles from the center.&lt;br /&gt;
* height - [[Types/uint32]]&lt;br /&gt;
:: Amount of tiles from top to bottom. Silently limited to 2,000,000, +/- 1 million tiles from the center.&lt;br /&gt;
* starting_area - [[Types/MapGenSize]]&lt;br /&gt;
:: Size of the starting area. The starting area only effects enemy placement, and has no effect on resources.&lt;br /&gt;
* peaceful_mode - [[Types/bool]]&lt;br /&gt;
* cliff_settings - [https://lua-api.factorio.com/latest/Concepts.html#CliffPlacementSettings CliffPlacementSettings]&lt;br /&gt;
&lt;br /&gt;
=== advanced_settings ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]]&lt;br /&gt;
&lt;br /&gt;
This is a table with the below key/value pairs. All key/value pairs are optional, if not set they will just use the existing values.&lt;br /&gt;
* pollution - [[Types/table]]&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property name !! Type !! Comment&lt;br /&gt;
|-&lt;br /&gt;
| enabled || [[Types/bool]]&lt;br /&gt;
|-&lt;br /&gt;
| diffusion_ratio || [[Types/double]] || Must be &amp;lt;= 0.25.&lt;br /&gt;
|-&lt;br /&gt;
| ageing || [[Types/double]] || Also known as dissipation rate. Must be &amp;gt;= 0.5. &lt;br /&gt;
|-&lt;br /&gt;
| enemy_attack_pollution_consumption_modifier ||  [[Types/double]] &lt;br /&gt;
|-&lt;br /&gt;
| min_pollution_to_damage_trees || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
| pollution_restored_per_tree_damage || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
* enemy_evolution - [[Types/table]]&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property name !! Type&lt;br /&gt;
|- &lt;br /&gt;
| enabled || [[Types/bool]]&lt;br /&gt;
|- &lt;br /&gt;
| time_factor || [[Types/double]]&lt;br /&gt;
|- &lt;br /&gt;
| destroy_factor || [[Types/double]]&lt;br /&gt;
|- &lt;br /&gt;
| pollution_factor || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
* enemy_expansion - [[Types/table]]&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property name !! Type !! Comment&lt;br /&gt;
|-                                            &lt;br /&gt;
| enabled || [[Types/bool]]&lt;br /&gt;
|-&lt;br /&gt;
| max_expansion_distance || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
| settler_group_min_size || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
| settler_group_max_size || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
| min_expansion_cooldown || [[Types/double]] || In ticks.&lt;br /&gt;
|-&lt;br /&gt;
| max_expansion_cooldown || [[Types/double]] || In ticks.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* difficulty_settings - [[Types/table]]&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property name !! Type !! Comment&lt;br /&gt;
|-&lt;br /&gt;
| recipe_difficulty || [https://lua-api.factorio.com/latest/defines.html#defines.difficulty_settings defines.difficulty_settings.recipe_difficulty]&lt;br /&gt;
|-&lt;br /&gt;
| technology_difficulty || [https://lua-api.factorio.com/latest/defines.html#defines.difficulty_settings defines.difficulty_settings.technology_difficulty]&lt;br /&gt;
|-&lt;br /&gt;
| technology_price_multiplier || [[Types/double]]&lt;br /&gt;
|-&lt;br /&gt;
| research_queue_setting || [[Types/string]] || Either &amp;quot;after-victory&amp;quot;, &amp;quot;always&amp;quot; or &amp;quot;never&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Prototype/ResourceEntity&amp;diff=191380</id>
		<title>Prototype/ResourceEntity</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Prototype/ResourceEntity&amp;diff=191380"/>
		<updated>2023-05-20T17:03:30Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Optional properties */ description of randomize_visual_position&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Prototype parent|Prototype/Entity}}&lt;br /&gt;
A mineable/gatherable entity. Its [[Types/CollisionMask|collision_mask]] must contain &amp;quot;resource-layer&amp;quot; if it should be minable with a [[Prototype/MiningDrill]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype TOC|resource}}&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
This prototype inherits all the properties from [[Prototype/Entity]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|stages|[[Types/AnimationVariations|AnimationVariations]]}}&lt;br /&gt;
Entity&#039;s graphics, using a graphic sheet, with variation and depletion. At least one stage must be defined.&lt;br /&gt;
&lt;br /&gt;
When using [[Types/AnimationVariations#sheet]], frame_count is the amount of frames per row in the spritesheet. variation_count is the amount of rows in the spritesheet. Each row in the spritesheet is one stage of the animation.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|stage_counts|[[Types/table|table]] of [[Types/uint32|uint32]]}}&lt;br /&gt;
Number of stages the animation has.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|infinite|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
If the ore is infinitely minable, or if it will eventually run out of resource.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|highlight|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
If the resource should be highlighted when holding a mining drill that can mine it (holding a pumpjack highlights crude-oil in the base game).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|randomize_visual_position|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
If there is a slight offset to graphics of the resource. Used to make patches a little less uniform in appearance.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|map_grid|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Whether the resource should have a grid pattern on the map instead of a solid map color.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|minimum|[[Types/uint32|uint32]]|0|optional=true}}&lt;br /&gt;
Must be not 0 when &amp;lt;code&amp;gt;infinite = true&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|normal|[[Types/uint32|uint32]]|1|optional=true}}&lt;br /&gt;
Must be not 0 when &amp;lt;code&amp;gt;infinite = true&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|infinite_depletion_amount|[[Types/uint32|uint32]]|1|optional=true}}&lt;br /&gt;
&#039;&#039;Every time an infinite-type resource &amp;quot;ticks&amp;quot; lower it&#039;s lowered by that amount.&#039;&#039; -- [https://forums.factorio.com/viewtopic.php?t=47093&amp;amp;p=271243#p271115 Rseding91]&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|resource_patch_search_radius|[[Types/uint32|uint32]]|3|optional=true}}&lt;br /&gt;
When hovering over this resource in the map view: How far to search for other resource patches of this type to display as one (summing amount, white outline).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|category|[[Types/string|string]]|&amp;quot;basic-solid&amp;quot;|optional=true}}&lt;br /&gt;
The category for the resource. Available categories in vanilla can be found here: [[Data.raw#resource-category]]&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|walking_sound|[[Types/Sound|Sound]]|optional=true}}&lt;br /&gt;
Sound played when the player walks over this resource.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|stages_effect|[[Types/AnimationVariations|AnimationVariations]]|optional=true}}&lt;br /&gt;
An effect that can be overlayed above the normal ore graphics. Used in the base game to make [[uranium ore]] glow.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|effect_animation_period|[[Types/float|float]]|0.0|optional=true}}&lt;br /&gt;
How long it takes &amp;lt;code&amp;gt;stages_effect&amp;lt;/code&amp;gt; to go from &amp;lt;code&amp;gt;min_effect_alpha&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;max_effect_alpha&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|effect_animation_period_deviation|[[Types/float|float]]|0.0|optional=true}}&lt;br /&gt;
How much &amp;lt;code&amp;gt;effect_animation_period&amp;lt;/code&amp;gt; can deviate from its original value. Used to make the stages effect alpha change look less uniform.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|effect_darkness_multiplier|[[Types/float|float]]|1.0|optional=true}}&lt;br /&gt;
How much the surface darkness should affect the alpha of &amp;lt;code&amp;gt;stages_effect&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|min_effect_alpha|[[Types/float|float]]|0.0|optional=true}}&lt;br /&gt;
Minimal alpha value of &amp;lt;code&amp;gt;stages_effect&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|max_effect_alpha|[[Types/float|float]]|1.0|optional=true}}&lt;br /&gt;
Maximal alpha value of &amp;lt;code&amp;gt;stages_effect&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|tree_removal_probability|[[Types/double|double]]|0|optional=true}}&lt;br /&gt;
Must be positive.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|tree_removal_max_distance|[[Types/double|double]]|0|optional=true}}&lt;br /&gt;
Must be positive when &amp;lt;code&amp;gt;tree_removal_probability&amp;lt;/code&amp;gt; is set.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|mining_visualisation_tint|[[Types/Color|Color]]|unset|optional=true}}&lt;br /&gt;
Defaults to the resources map color if left unset and map color is set, otherwise defaults to white if left unset.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{&lt;br /&gt;
    type = &amp;quot;resource&amp;quot;,&lt;br /&gt;
    name = &amp;quot;crude-oil&amp;quot;,&lt;br /&gt;
    icon = &amp;quot;__base__/graphics/icons/crude-oil.png&amp;quot;,&lt;br /&gt;
    icon_size = 32,&lt;br /&gt;
    flags = {&amp;quot;placeable-neutral&amp;quot;},&lt;br /&gt;
    category = &amp;quot;basic-fluid&amp;quot;,&lt;br /&gt;
    order=&amp;quot;a-b-a&amp;quot;,&lt;br /&gt;
    infinite = true,&lt;br /&gt;
    highlight = true,&lt;br /&gt;
    minimum = 60000,&lt;br /&gt;
    normal = 300000,&lt;br /&gt;
    infinite_depletion_amount = 10,&lt;br /&gt;
    resource_patch_search_radius = 12,&lt;br /&gt;
    tree_removal_probability = 0.7,&lt;br /&gt;
    tree_removal_max_distance = 32 * 32,&lt;br /&gt;
    minable =&lt;br /&gt;
    {&lt;br /&gt;
      mining_time = 1,&lt;br /&gt;
      results =&lt;br /&gt;
      {&lt;br /&gt;
        {&lt;br /&gt;
          type = &amp;quot;fluid&amp;quot;,&lt;br /&gt;
          name = &amp;quot;crude-oil&amp;quot;,&lt;br /&gt;
          amount_min = 10,&lt;br /&gt;
          amount_max = 10,&lt;br /&gt;
          probability = 1&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    },&lt;br /&gt;
    collision_box = {{ -1.4, -1.4}, {1.4, 1.4}},&lt;br /&gt;
    selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},&lt;br /&gt;
    autoplace = resource_autoplace.resource_autoplace_settings{&lt;br /&gt;
      name = &amp;quot;crude-oil&amp;quot;,&lt;br /&gt;
      order = &amp;quot;c&amp;quot;, -- Other resources are &amp;quot;b&amp;quot;; oil won&#039;t get placed if something else is already there.&lt;br /&gt;
      base_density = 8.2,&lt;br /&gt;
      base_spots_per_km2 = 1.8,&lt;br /&gt;
      random_probability = 1/48,&lt;br /&gt;
      random_spot_size_minimum = 1,&lt;br /&gt;
      random_spot_size_maximum = 1, -- don&#039;t randomize spot size&lt;br /&gt;
      additional_richness = 220000, -- this increases the total everywhere, so base_density needs to be decreased to compensate&lt;br /&gt;
      has_starting_area_placement = false,&lt;br /&gt;
      resource_index = resource_autoplace.resource_indexes[&amp;quot;crude-oil&amp;quot;],&lt;br /&gt;
      regular_rq_factor_multiplier = 1&lt;br /&gt;
    },&lt;br /&gt;
    stage_counts = {0},&lt;br /&gt;
    stages =&lt;br /&gt;
    {&lt;br /&gt;
      sheet =&lt;br /&gt;
      {&lt;br /&gt;
        filename = &amp;quot;__base__/graphics/entity/crude-oil/crude-oil.png&amp;quot;,&lt;br /&gt;
        priority = &amp;quot;extra-high&amp;quot;,&lt;br /&gt;
        width = 75,&lt;br /&gt;
        height = 61,&lt;br /&gt;
        frame_count = 4,&lt;br /&gt;
        variation_count = 1&lt;br /&gt;
      }&lt;br /&gt;
    },&lt;br /&gt;
    map_color = {r=0.78, g=0.2, b=0.77},&lt;br /&gt;
    map_grid = false&lt;br /&gt;
  }&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Modding_tutorial/Gangsir&amp;diff=191222</id>
		<title>Tutorial:Modding tutorial/Gangsir</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Modding_tutorial/Gangsir&amp;diff=191222"/>
		<updated>2023-04-07T00:50:22Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* The info.json file */ description phrasing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
This is a modding tutorial for Factorio version 1.1. In this tutorial, the author will explain how Factorio works behind the scenes, how to modify Factorio, where to find documentation, and explain concepts.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Before we start the tutorial, a few things to note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
Code tinted green like this should be included into the mod this tutorial is going to create; If the reader follows along with it. The best way to do this is to copy and paste, to ensure faithful reproduction.&lt;br /&gt;
Whenever code is added to the mod, a Lua comment with the file name will be at the beginning of the green box. Place the code in the box into that file. Eg:&lt;br /&gt;
--control.lua&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
Code tinted purple like this should not be included into the mod, it&#039;s just for educational/example purposes, and to boost understanding.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial was updated to version 1.1, so any &#039;&#039;viewers in the future should take note that some minor changes may have been made&#039;&#039;, and should look at the changelogs up to the current version.&lt;br /&gt;
&lt;br /&gt;
== Terminology used in modding ==&lt;br /&gt;
&lt;br /&gt;
Before we start the tutorial, a few terms and definitions should be laid out, to ensure the reader understands.&lt;br /&gt;
&lt;br /&gt;
; Mod : A script or series of scripts that allow modifications to the game through the API.&lt;br /&gt;
; Entity : An entity in Factorio is anything in the game that is not a concept, event, or tile. Examples of entities include the character, an assembling machine, a biter, etc. This can be &#039;machines&#039; or free-moving objects like the character.&lt;br /&gt;
; Character : The actual entity that the player manipulates the world through.&lt;br /&gt;
; Player : All the data that defines a player, such as username, online time or the current zoom level.&lt;br /&gt;
; Prototype : A prototype describes an instance of an entity, item or recipe etc, a bit like a template. It defines stats, like what an entity actually is, an item&#039;s stack size, a recipe&#039;s ingredients etc. A prototype is used to create an instance of an entity/item/etc, and many functionally identical entities/items/etc will use the same prototype.&lt;br /&gt;
; Surface : A surface is a bit like a dimension. It is composed of terrain, such as grass, sand, and water, and all the entities on the surface. By default, there is only one surface in Factorio, referred to internally as &amp;quot;nauvis&amp;quot;, or &amp;lt;code style=&amp;quot;background-color:#DDA0DD; color:black&amp;quot;&amp;gt;game.surfaces[1]&amp;lt;/code&amp;gt;, but mods may create additional surfaces through the API.&lt;br /&gt;
; Event : An event is a recurring...event, that is triggered internally by the game. There are several events that mods may connect functions to, such as &amp;lt;code style=&amp;quot;background-color:#DDA0DD; color:black&amp;quot;&amp;gt;on_entity_died&amp;lt;/code&amp;gt;, etc. More on this in the control scripting section.&lt;br /&gt;
; Item : Items are what is moved around in inventories, by inserters and on belts, etc. Each item in-game is an instance of the respective item prototype.&lt;br /&gt;
&lt;br /&gt;
More terminology may be declared and defined later in this tutorial.&lt;br /&gt;
&lt;br /&gt;
== Before beginning to mod ==&lt;br /&gt;
&lt;br /&gt;
Before we can start modding Factorio, we must understand what Factorio is. You may be tempted to answer in lieu of the [[Factorio:About|about page]], but that is what a player would say. Since we are trying to become a modder, we need a more detailed explanation. Factorio is a game that is coded in the language C++, with an API provided by Wube (the developers of Factorio) to mod Factorio in the programming language Lua (version 5.2.1). This API allows adding scripts to the Factorio init process, to modify it without the source code of the base game being exposed, or modifying memory. This may be different than other games that offer modding, but this is a more professional and proper way of supporting modding.&lt;br /&gt;
&lt;br /&gt;
To aid in the use of this API, the devs have kindly provided fairly comprehensive documentation of scripting at their [https://lua-api.factorio.com/latest/ API site] and documentation all around prototypes on [[Prototype definitions|this wiki]]. Get used to using these sites, as they will become frequent visits you will make while you develop mods. The scripting API site contains information on [https://lua-api.factorio.com/latest/Classes.html Factorio&#039;s classes] and information on [https://lua-api.factorio.com/latest/events.html events] that you can hook into. [[Prototype definitions]] contains and links to information all around prototypes, listing their inheritance structure and their properties. You will need to check these sites often, so the author recommends bookmarking them. In addition to these sites, there is also many resources to be found created by the community, such as this tutorial.&lt;br /&gt;
&lt;br /&gt;
=== Setup ===&lt;br /&gt;
&lt;br /&gt;
The best way to develop a mod is to develop it in a place where it can be easily tested. When the tutorial gets to making the mod, this will be explained further. Additionally, using an editor that allows ease of typing and Lua language support is recommended. Emacs, Vim, Sublime Text, VSCode, and Notepad++ are all viable candidates.&lt;br /&gt;
&lt;br /&gt;
== How Factorio loads mods ==&lt;br /&gt;
&lt;br /&gt;
=== Load order ===&lt;br /&gt;
Within stages, mods are loaded by dependency, then by alphabetical order. This is &#039;&#039;very important&#039;&#039; to understand, as it can cause you problems if you neglect it and try to add inter-mod support to your mod.&lt;br /&gt;
&lt;br /&gt;
Factorio has three kinds of dependencies. There are required dependencies, and optional dependencies. The third kind, restrictive dependencies, does not affect mod order and instead prevents the game from loading if the other mod is found. Required dependencies are loaded first, always. The game will fail to initialize if one of these is not present. Optional dependencies are loaded first if present, but do not have to be present. This is useful for enabling bonus features if mods are used together. Required dependencies should be used for mod libraries, and similar infrastructure.&lt;br /&gt;
&lt;br /&gt;
=== The settings stage ===&lt;br /&gt;
The very first mod stage that is loaded when Factorio initializes is the settings stage. This stage is used to define all mod settings that are later shown in the in-game mod settings GUI, and has no other functions or possibilities. When running through this stage, the game looks through all mods for a file called &amp;lt;code&amp;gt;settings.lua&amp;lt;/code&amp;gt;. After settings.lua has been executed for all mods, each mod&#039;s &amp;lt;code&amp;gt;settings-updates.lua&amp;lt;/code&amp;gt; is executed, and finally each mod&#039;s &amp;lt;code&amp;gt;settings-final-fixes.lua&amp;lt;/code&amp;gt; is called. These 3 different phases of the settings stage allow to change settings of other mods without needing to rely on dependencies to load last. All other files to be loaded will need to be required. All the files run here should contain nothing but setting definitions and code to produce setting definitions.&lt;br /&gt;
&lt;br /&gt;
The settings stage does not have access to prototype or runtime data because it is loaded before those stages. The settings are expected to have a certain format, and all additional code will be discarded once the stage is over.&lt;br /&gt;
&lt;br /&gt;
Mod settings are not covered in this tutorial, see [[Tutorial:Mod settings]] for further info on them.&lt;br /&gt;
&lt;br /&gt;
=== The data stage ===&lt;br /&gt;
&lt;br /&gt;
This is the most restricted part of the Factorio init, there&#039;s not much you can do here other than declare prototypes for technologies, entities, items and more. Things like manipulating files, affecting the world, etc, are blocked/unavailable. In fact, any functions or changes made will be discarded, as the lua session is terminated. You also cannot mess with the data table, it will error or be ignored. When using &amp;lt;code&amp;gt;data:extend({})&amp;lt;/code&amp;gt;, it expects a specific format, more on this later.&lt;br /&gt;
&lt;br /&gt;
When running through this stage, the game looks through all mods for a file called &amp;lt;code&amp;gt;data.lua&amp;lt;/code&amp;gt;. After data.lua has been executed for all mods, each mod&#039;s &amp;lt;code&amp;gt;data-updates.lua&amp;lt;/code&amp;gt; is executed, and finally each mod&#039;s &amp;lt;code&amp;gt;data-final-fixes.lua&amp;lt;/code&amp;gt; is called. These 3 different phases of the data stage allow to change data of other mods without needing to rely on dependencies to load last. For example, the base mod creates barrelling recipes for all (then present) fluids in data-updates.lua. This means that if you add a fluid in data.lua, the base mod&#039;s data-updates.lua will add barreling recipes for it, regardless of whether your mod depends on base. Of course this also means that if you add a fluid in data-final-fixes.lua, it is created after the barrelling code runs in data-updates.lua, so no barrelling recipe gets created, even when desired. Because of this and similar mod interactions, it is recommended to create prototypes as early as possible. So, don&#039;t use data-final-fixes.lua to exclude a fluid from barreling, instead create it in data.lua and utilize &amp;quot;auto_barrel = false&amp;quot; on the fluid.&lt;br /&gt;
&lt;br /&gt;
All other files to be loaded will need to be required. All the files run here should contain nothing but prototype definitions and code to produce prototype definitions. More on requiring files later.&lt;br /&gt;
&lt;br /&gt;
All prototypes are documented here on the wiki: [[Prototype definitions]].&lt;br /&gt;
&lt;br /&gt;
=== Migrations ===&lt;br /&gt;
&lt;br /&gt;
[https://lua-api.factorio.com/latest/Migrations.html Migrations] are scripts that are used to &amp;quot;fix&amp;quot; a save after a mod updates. Whenever prototype names change within a mod, migrations must be setup to replace all the old instances of the prototyped entity in the world. This must be done for all updated entities, or the old entities will be removed from the world, which is an unprofessional fallback that makes users dislike you. While this tutorial will not discuss migrations, there are many resources on migrations to be found around the community, and the API site.&lt;br /&gt;
&lt;br /&gt;
To avoid having to write migrations, avoid changing prototype names and technology unlocks. Prototypes names cannot be dynamically changed and technology unlocks of already researched technologies do not apply automatically, making migrations necessary. Try to avoid these changes after shipping the mod out to the public. Try to come up with a finalized version of prototype names that you can base the mod around. Of course, migrations are unnecessary if the user simply starts a new world with each mod update, but do not expect the community to do this.&lt;br /&gt;
&lt;br /&gt;
=== Runtime stage ===&lt;br /&gt;
&lt;br /&gt;
Within most mods is a file called &amp;lt;code&amp;gt;control.lua&amp;lt;/code&amp;gt;. This file contains scripting that makes the mod do things during the game, rather than just adding entities to the game. During this stage, each mod&#039;s control.lua is run, in it&#039;s own lua instance (this means no inter-communication without special setup) which it will own for the rest of the play session. During the play session, access to all tables provided by the game can be done inside of event handlers. (More on those below.) Because the control.lua is run every time a save file is created or loaded you don&#039;t need to restart the game to see changes made to the control.lua file. Simply restarting or reloading a save will re-run this stage. &#039;&#039;&#039;There are a few other caveats to this stage, reading the [https://lua-api.factorio.com/latest/Data-Lifecycle.html data life cycle] page on the API site provides the best overview.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The control stage documented is documented on [https://lua-api.factorio.com/latest lua-api.factorio.com].&lt;br /&gt;
&lt;br /&gt;
== The major components to any Factorio mod ==&lt;br /&gt;
&lt;br /&gt;
Within the average mod, there are several components that make the mod function.&lt;br /&gt;
&lt;br /&gt;
Mods that define new entities will need to declare these entities in &amp;lt;code&amp;gt;data.lua&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;data-updates.lua&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;data-final-fixes.lua&amp;lt;/code&amp;gt;, or another file &amp;lt;code&amp;gt;require&amp;lt;/code&amp;gt;d by one of these three.&lt;br /&gt;
&lt;br /&gt;
Mods with in-game effects will also need a &amp;lt;code&amp;gt;control.lua&amp;lt;/code&amp;gt; file, to add scripting.&lt;br /&gt;
&lt;br /&gt;
Mods with configurable user settings will use &amp;lt;code&amp;gt;settings.lua&amp;lt;/code&amp;gt; to describe those settings.&lt;br /&gt;
&lt;br /&gt;
Mods that define any game element with a readable name may also provide a &amp;lt;code&amp;gt;locale&amp;lt;/code&amp;gt; directory and subdirectories with names/descriptions in one or more languages.&lt;br /&gt;
&lt;br /&gt;
The mod that we&#039;ll make in this tutorial will include both data.lua prototypes and control.lua scripting, to give you a feel for both.&lt;br /&gt;
&lt;br /&gt;
== The tutorial mod ==&lt;br /&gt;
&lt;br /&gt;
And now for the moment you&#039;ve been waiting for. Let&#039;s start making your first mod. You&#039;ll need:&lt;br /&gt;
&lt;br /&gt;
* A recent install of Factorio&lt;br /&gt;
* A text editor, such as Emacs, Vim, Sublime text, etc&lt;br /&gt;
* An understanding of the tutorial above&lt;br /&gt;
* An understanding of Lua as a programming language. Enough to know the syntax and how it works. If you have prior programming experience, it should not be difficult to pick up.&lt;br /&gt;
&lt;br /&gt;
Once you have all of these things, we can begin.&lt;br /&gt;
&lt;br /&gt;
For this mod, we&#039;re going to make a set of armor that leaves behind damaging fire behind you as you walk. It will be fully resistant to fire, but weaker towards physical damage than heavy armor, making it an armor for hit and run attacks.&lt;br /&gt;
&lt;br /&gt;
=== Creation of the directory structure ===&lt;br /&gt;
&lt;br /&gt;
The game expects mod to be laid out [[Tutorial:Mod structure|in a certain way]]. To start out, create a folder in your [[Application directory|user data directory]]/mods folder. This folder must have a specific name, &amp;lt;code&amp;gt;fire-armor&amp;lt;/code&amp;gt;. When you&#039;re finished, the mod directory should look like this:&lt;br /&gt;
&lt;br /&gt;
* (user data directory, sometimes called .factorio)&lt;br /&gt;
** mods&lt;br /&gt;
*** fire-armor&lt;br /&gt;
&lt;br /&gt;
Then, inside fire-armor, create two files, &amp;lt;code&amp;gt;info.json&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;data.lua&amp;lt;/code&amp;gt;. The directory should now look like:&lt;br /&gt;
&lt;br /&gt;
* (user data directory, sometimes called .factorio)&lt;br /&gt;
** mods&lt;br /&gt;
*** fire-armor&lt;br /&gt;
**** data.lua&lt;br /&gt;
**** info.json&lt;br /&gt;
&lt;br /&gt;
=== The info.json file ===&lt;br /&gt;
&lt;br /&gt;
Then, inside [[Tutorial:Mod_structure#info.json|info.json]], copy and paste the following into it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;name&amp;quot;: &amp;quot;fire-armor&amp;quot;,&lt;br /&gt;
  &amp;quot;version&amp;quot;: &amp;quot;0.1.0&amp;quot;,&lt;br /&gt;
  &amp;quot;title&amp;quot;: &amp;quot;Fire Armor&amp;quot;,&lt;br /&gt;
  &amp;quot;author&amp;quot;: &amp;quot;You&amp;quot;,&lt;br /&gt;
  &amp;quot;factorio_version&amp;quot;: &amp;quot;1.1&amp;quot;,&lt;br /&gt;
  &amp;quot;dependencies&amp;quot;: [&amp;quot;base &amp;gt;= 1.1&amp;quot;],&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;This mod adds in fire armor that leaves behind damaging fire as you walk around.&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To explain each field:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Item&lt;br /&gt;
! Explanation&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| This is the internal name of your mod, it is used to identify your mod in code.&lt;br /&gt;
|-&lt;br /&gt;
| version&lt;br /&gt;
| This is the version of your mod. This can be anything you want, provided it&#039;s a of the format &amp;quot;number.number.number&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| title&lt;br /&gt;
| The pretty title of your mod, this will be displayed on the mods screen and when you submit it to the mod portal.&lt;br /&gt;
|-&lt;br /&gt;
| author&lt;br /&gt;
| Your name! You can change this in the example above.&lt;br /&gt;
|-&lt;br /&gt;
| factorio_version&lt;br /&gt;
| This tells the game what version the mod is for, this must match the version you&#039;re developing the mod for, 1.1 in this case.&lt;br /&gt;
|-&lt;br /&gt;
| dependencies&lt;br /&gt;
| Any dependencies of your mod.&lt;br /&gt;
|-&lt;br /&gt;
| description&lt;br /&gt;
| A short description of your mod, which appears in game. The mod portal is better for a long description.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
And that&#039;s all for info.json! Next, in the data.lua file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
--data.lua&lt;br /&gt;
&lt;br /&gt;
require(&amp;quot;item&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It&#039;s a pretty simple file, all we&#039;re doing here is just telling the game to execute the file called item.lua, which we&#039;re about to create. Create a file in fire-armor called &amp;lt;code&amp;gt;item.lua&amp;lt;/code&amp;gt;. Notice how our earlier require used the file name in it?&lt;br /&gt;
&lt;br /&gt;
We are creating this file just for our own organisation inside the mod, so there are no naming or other requirements from the game&#039;s side. As long as we tell the game to load the file with &amp;quot;require&amp;quot;, the file name or its exact location inside the mod does not matter.&lt;br /&gt;
&lt;br /&gt;
=== Prototype creation ===&lt;br /&gt;
&lt;br /&gt;
Now, there are two ways to create prototypes in Factorio. There&#039;s the short way, and the long way. The long way requires to create a complete prototype definition based on [[prototype definitions|the documentation]], and the short way just uses a lua function to copy and modify an already existing definition. For the sake of this tutorial, we&#039;ll do it the short way.&lt;br /&gt;
&lt;br /&gt;
In item.lua, copy and paste the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
--item.lua&lt;br /&gt;
&lt;br /&gt;
local fireArmor = table.deepcopy(data.raw[&amp;quot;armor&amp;quot;][&amp;quot;heavy-armor&amp;quot;]) -- copy the table that defines the heavy armor item into the fireArmor variable&lt;br /&gt;
&lt;br /&gt;
fireArmor.name = &amp;quot;fire-armor&amp;quot;&lt;br /&gt;
fireArmor.icons = {&lt;br /&gt;
  {&lt;br /&gt;
    icon = fireArmor.icon,&lt;br /&gt;
    tint = {r=1,g=0,b=0,a=0.3}&lt;br /&gt;
  },&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fireArmor.resistances = {&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;physical&amp;quot;,&lt;br /&gt;
    decrease = 6,&lt;br /&gt;
    percent = 10&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;explosion&amp;quot;,&lt;br /&gt;
    decrease = 10,&lt;br /&gt;
    percent = 30&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;acid&amp;quot;,&lt;br /&gt;
    decrease = 5,&lt;br /&gt;
    percent = 30&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;fire&amp;quot;,&lt;br /&gt;
    decrease = 0,&lt;br /&gt;
    percent = 100&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local recipe = table.deepcopy(data.raw[&amp;quot;recipe&amp;quot;][&amp;quot;heavy-armor&amp;quot;])&lt;br /&gt;
recipe.enabled = true&lt;br /&gt;
recipe.name = &amp;quot;fire-armor&amp;quot;&lt;br /&gt;
recipe.ingredients = {{&amp;quot;copper-plate&amp;quot;,200},{&amp;quot;steel-plate&amp;quot;,50}}&lt;br /&gt;
recipe.result = &amp;quot;fire-armor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
data:extend{fireArmor,recipe}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What we&#039;ve just done here is we&#039;ve copied the definition of heavy armor, then changed it&#039;s properties, and injected it into the Factorio init with data:extend. The first line of code is probably the most interesting. &amp;lt;code&amp;gt;table.deepcopy&amp;lt;/code&amp;gt; copies a table fully into another table. We do this from data.raw. The &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; part is a table, which will be used by the game to setup the Factorio universe. In fact, it contains the function &amp;lt;code&amp;gt;extend(self, prototypes)&amp;lt;/code&amp;gt; and a table called &amp;lt;code&amp;gt;raw&amp;lt;/code&amp;gt;. The former is a customary way to add new stuff to the latter. It is actually data.raw that holds the prototypes for the game. (You can view the implementation in the file [https://github.com/wube/factorio-data/blob/master/core/lualib/dataloader.lua /factorio/data/core/lualib/dataloader.lua]). It is important to note that data.raw only exists during the data loading stage of the game. During the control stage, when the game is running and being played, you cannot read this data; instead you read processed values through the API from the various types like LuaEntityPrototype.&lt;br /&gt;
&lt;br /&gt;
In addition to defining the item prototype, we also define a recipe for it. This is necessary if you want to be able to craft the thing. We also set it to enabled so it doesn&#039;t need a technology to unlock.&lt;br /&gt;
&lt;br /&gt;
=== More on data.raw ===&lt;br /&gt;
&lt;br /&gt;
When Factorio initializes, all prototypes are put into a table called data.raw. This table holds all prototype types, and within those types, individual prototypes identified by name: &amp;lt;code&amp;gt;local prototype = data.raw[&amp;quot;prototype-type&amp;quot;][&amp;quot;internal-name&amp;quot;]&amp;lt;/code&amp;gt;. You saw earlier how we deepcopied from the definition of heavy armor, and modified some fields. In fact, let&#039;s go over each part of the deepcopy line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
local fireArmor = table.deepcopy(data.raw[&amp;quot;armor&amp;quot;][&amp;quot;heavy-armor&amp;quot;])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We assign a variable called fireArmor that holds our copy of the heavy armor definition. Notice how in data.raw, there is a type table that holds all armors, and the specific armor we&#039;re looking for is called heavy-armor. We can find [[heavy armor]]&#039;s prototype type and internal name in the infobox of its page on this wiki and just copy it from there.&amp;lt;br&amp;gt;&lt;br /&gt;
Alternatively, we can find the items prototype type and internal name by opening the game, inserting the item into our inventory and then pressing {{Keybinding|shift|ctrl|F}} while hovering over the item. This will open the prototype explorer GUI, which has rows showing the name and type of the item.&lt;br /&gt;
&lt;br /&gt;
As another example, the [[player|character]]&#039;s prototype would be, according to the infobox on the page:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
data.raw[&amp;quot;character&amp;quot;][&amp;quot;character&amp;quot;]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the character is &#039;&#039;the&#039;&#039; character, his type matches his name. You could define a new type of character with a mod. You can see all the available prototype fields of the charater in the documenation: [[Prototype/Character]].&lt;br /&gt;
&lt;br /&gt;
You may be thinking at this point, &amp;quot;Can I modify Factorio&#039;s existing prototypes without making new ones?&amp;quot; Well, the answer is yes! You would simply access the data.raw table during init, in data-final-fixes.lua if you want to run after all other mods, and change a property. For example, make the iron chest instead have 1000 health:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
data.raw[&amp;quot;container&amp;quot;][&amp;quot;iron-chest&amp;quot;].max_health = 1000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reason why this code is in data-final-fixes.lua is because that is the last file run, after all mod files have been run. This prevents (to a degree) your changes from being messed with by other mods. Of course, it is still possible to have incompatibilities. You should note any that you know of in your mod&#039;s description. Again, the [https://lua-api.factorio.com/latest/Data-Lifecycle.html dev&#039;s documentation] on this should be looked at.&lt;br /&gt;
&lt;br /&gt;
This can also be applied to other mods, not just Factorio&#039;s base. You could mod a mod, as long as you add the mod (that you modified with your mod) to your dependencies so it gets loaded first.&lt;br /&gt;
&lt;br /&gt;
=== The control scripting ===&lt;br /&gt;
&lt;br /&gt;
And now, to finalize the mod, we have to make it be more than just simple armor. Let&#039;s think about what we want the armor to do. We want the armor to create fire on the ground as we walk with the armor on. The event we&#039;re going to use is called [https://lua-api.factorio.com/latest/events.html#on_player_changed_position on_player_changed_position], since we want the fire to be created when the player moves.&lt;br /&gt;
&lt;br /&gt;
In our mod folder, create a file called &amp;lt;code&amp;gt;control.lua&amp;lt;/code&amp;gt;. The game will automatically execute this file, so requiring it is not necessary.&lt;br /&gt;
&lt;br /&gt;
Inside control.lua, copy and paste the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black;&amp;quot;&amp;gt;&lt;br /&gt;
--control.lua&lt;br /&gt;
&lt;br /&gt;
script.on_event(defines.events.on_player_changed_position,&lt;br /&gt;
  function(event)&lt;br /&gt;
    local player = game.get_player(event.player_index) -- get the player that moved            &lt;br /&gt;
    -- if they&#039;re wearing our armor&lt;br /&gt;
    if player.character and player.get_inventory(defines.inventory.character_armor).get_item_count(&amp;quot;fire-armor&amp;quot;) &amp;gt;= 1 then&lt;br /&gt;
       -- create the fire where they&#039;re standing&lt;br /&gt;
       player.surface.create_entity{name=&amp;quot;fire-flame&amp;quot;, position=player.position, force=&amp;quot;neutral&amp;quot;} &lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used lua comments in the code above to explain each step. It&#039;s fairly easy to understand, and it shows how you would get the current armor that the player character is wearing, with defines.inventory.character_armor, which is an inventory constant. You can read the list of defines [https://lua-api.factorio.com/latest/defines.html#defines.inventory here].&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve already tried loading up Factorio and trying the mod so far (which you can at this point without it crashing), you may have noticed that the item name of the armor says &amp;quot;Unknown key&amp;quot;. This means that Factorio has the internal name, but it doesn&#039;t know what it should look like to the user. So, we need to create a locale for our mod.&lt;br /&gt;
&lt;br /&gt;
In the mod folder, create a folder called &amp;lt;code&amp;gt;locale&amp;lt;/code&amp;gt;, then create another folder inside that called &amp;lt;code&amp;gt;en&amp;lt;/code&amp;gt;, then a file called &amp;lt;code&amp;gt;any_name_can_be_here.cfg&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you know another language, you can also translate your mod by making other language code files inside locale, such as de for German.&lt;br /&gt;
&lt;br /&gt;
Inside the .cfg file, paste the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[item-name]&lt;br /&gt;
fire-armor=Fire armor&lt;br /&gt;
&lt;br /&gt;
[item-description]&lt;br /&gt;
fire-armor=An armor that seems to catch the ground itself on fire when you take a step. It&#039;s warm to the touch.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice how this is not a lua file. Locale is handled with C config files, so the format is different.&lt;br /&gt;
&lt;br /&gt;
== The finished tutorial mod ==&lt;br /&gt;
&lt;br /&gt;
Well, the mod is finished. Since this mod is only a tutorial, there isn&#039;t much balance to it.&lt;br /&gt;
&lt;br /&gt;
If you want to share a mod with other users, it needs to be a zip file. For that, simply zip the &amp;lt;code&amp;gt;fire-armor&amp;lt;/code&amp;gt; folder and then rename the archive to &amp;lt;code&amp;gt;fire-armor_0.1.0&amp;lt;/code&amp;gt; so that it follows the expected mod zip name pattern of &amp;lt;code&amp;gt;mod-name_version&amp;lt;/code&amp;gt;. Keep in mind to not submit this tutorial mod to the mod portal as your own, since it&#039;s from the Wiki.&lt;br /&gt;
&lt;br /&gt;
However, you&#039;re free to take this mod and modify it for your own use, changing recipes, adding technologies, whatever.&lt;br /&gt;
&lt;br /&gt;
== Resolving common errors in modding ==&lt;br /&gt;
&lt;br /&gt;
As you continue to write mods from scratch instead of from a tutorial, you may encounter the infamous error. There are several types of errors that you can encounter in modding Factorio, and knowing how to deal with these errors will allow you to continue working.&lt;br /&gt;
&lt;br /&gt;
=== Syntax errors ===&lt;br /&gt;
&lt;br /&gt;
The lua programming language expects things to be laid out a certain way. If you miss a bracket, = sign, or dot, you will encounter a syntax error. As an example, see the error below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
Failed to load mods: __fire-armor__/data.lua:1:__fire-armor__/prototypes/item.lua:36: syntax error near &#039;true&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of version 0.15, you&#039;ll see an error like the one above whenever you make a syntax error within the prototype definitions. The game will offer to restart, disable the troubling mod, disable all mods, or exit. Let&#039;s dissect the error, shall we?&lt;br /&gt;
&lt;br /&gt;
Right away, we see the reason why Factorio didn&#039;t start normally. &amp;quot;Failed to load mods:&amp;quot;. So, we know that it&#039;s a mod that messed up, and by extension, we know it&#039;s our mod. Whenever the Lua engine of Factorio has a syntax error, it will print a mini stack-trace that follows through all requires, listing the call order. First, we see that the problem was indirectly caused by line 1 of data.lua. There&#039;s no problem there, so it must be the next entry, line 36 of prototypes/item.lua. After stating where it is line-wise, it will attempt to give you an estimate of where in the line the problem is. Don&#039;t trust this estimate, only roughly trust the line number, plus or minus a few lines.&lt;br /&gt;
&lt;br /&gt;
Going to line 36 of item.lua, we find:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
recipe.enabled true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hmm, that doesn&#039;t look right. Can you see what&#039;s missing? We left off an = between enabled and true. Thus, syntax error. Fixing these can be difficult for new programmers, who don&#039;t know what to look for.&lt;br /&gt;
&lt;br /&gt;
=== Illogical actions, indexing nil ===&lt;br /&gt;
&lt;br /&gt;
In lua, &amp;quot;nothing&amp;quot; is defined as the keyword nil. This is similar to null in other programming languages. Whenever the programmer tries to access something in a table that is nil, they will get an error like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
Error while running event fire-armor::on_player_changed_position (ID 82)&lt;br /&gt;
__fire-armor__/control.lua:3: attempt to index field &#039;?&#039; (a nil value)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;attempt to index field ...&amp;quot; error is often caused by the modder making an assumption that didn&#039;t work out. These types of errors will always be identifiable by their signature line, &amp;quot;attempt to index field&amp;quot;. If we look at line 3 of control.lua (where the error is), we see:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
game.print(game.players[23])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What assumption has the modder made here? Well, there&#039;s actually two problems with this line. The first thing is that the modder has assumed that &amp;lt;code&amp;gt;game.players[23]&amp;lt;/code&amp;gt; is a valid player, which isn&#039;t the case; this is why we get the &amp;quot;index field &#039;?&#039;&amp;quot; bit. The game doesn&#039;t know what the field is that we tried to index, because it hasn&#039;t been created yet. These errors are difficult to debug unless you know the ins and outs of the modding API well.&lt;br /&gt;
&lt;br /&gt;
The second issue is a lot more subtle, and won&#039;t work. The modder is attempting to print a userdata table. [https://lua-api.factorio.com/latest/LuaPlayer.html A player] is a table of several values. Trying to print it simply print &amp;quot;LuaPlayer&amp;quot; instead of providing useful data.&lt;br /&gt;
&lt;br /&gt;
=== Error while running event ===&lt;br /&gt;
&lt;br /&gt;
Another common type of error in Factorio is the &amp;quot;Error while running event&amp;quot; error. This type of error only happens in control.lua scripting, and it happens when something goes wrong in an event function, such as a syntax error. &#039;&#039;&#039;Note that syntax errors in control.lua do not stop the game from starting, but may trigger after a save is loaded&#039;&#039;&#039;. There are a great deal of errors under this broad category, here&#039;s an example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
Error while running event fire-armor::on_player_changed_position (ID 82)&lt;br /&gt;
Unknown entity name: fire-flam&lt;br /&gt;
stack traceback:&lt;br /&gt;
__fire-armor__/control.lua:7: in function &amp;lt;__fire-armor__/control.lua:2&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you saw with the prototypes syntax error, Factorio gives a small traceback and the error name itself. In this case, we&#039;ve attempted to spawn an entity called &amp;quot;fire-flam&amp;quot; on line 7 of control.lua, inside of an on_player_changed_position event hook. Fire-flam isn&#039;t a real entity type, so we crashed.&lt;br /&gt;
&lt;br /&gt;
These types of errors can range from being a simple fix (like the one above, add the missing e), or can be very difficult.&lt;br /&gt;
&lt;br /&gt;
=== Internal errors ===&lt;br /&gt;
&lt;br /&gt;
The most rare form of error and the worst form is the internal error. This is an error with the C++ code of the game, and there&#039;s nothing you can do but report it to the devs. Mods occasionally cause these, and almost all of them are considered bugs, as mods &#039;&#039;should not&#039;&#039; be able to cause these, if that makes sense. They often get thrown into the logs.&lt;br /&gt;
&lt;br /&gt;
An example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
696.148 Error FlowStatistics.cpp:236: FlowStatistics attempted to save value larger than uint16 as uint16. Exiting to prevent save corruption.&lt;br /&gt;
Logger::writeStacktrace skipped.&lt;br /&gt;
696.148 Error CrashHandler.cpp:190: Map tick at moment of crash: 432029&lt;br /&gt;
696.148 Error Util.cpp:97: Unexpected error occurred. If you&#039;re running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.&lt;br /&gt;
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiplayer and desyncs ==&lt;br /&gt;
&lt;br /&gt;
The reader may be wondering at this point how Factorio handles multiplayer with mods. It&#039;s fairly simple, but is still worth considering.&lt;br /&gt;
&lt;br /&gt;
Factorio is [https://en.wikipedia.org/wiki/Deterministic_algorithm deterministic], which means that when you provide a constant input, you get a constant output, with no variance. Every client and the server all reach the same points at the same time in simulation, so they all agree on what happened. When this differs, the players experience a &#039;&#039;desync&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; Desync : Misalignment with server and clients. Client 1 expected A, but got B. All other clients got A. Thus, Client 1 will desync. Desync can also happen when all clients have information (for example a variable) but a client that recently joined the game doesn&#039;t. That client will be desynced.&lt;br /&gt;
: &#039;&#039;See also: [[Desynchronization]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Desyncs happen a lot to new devs of Factorio mods, because they are unaware that a particular piece of code they used causes desyncs. As a general rule, there are a few things that should never be done.&lt;br /&gt;
&lt;br /&gt;
=== Use local variables that are not final outside of event hooks ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
local globalLocal = 1&lt;br /&gt;
script.on_event(defines.events.on_player_built_item, function()&lt;br /&gt;
    globalLocal = math.random()&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the modder places a local variable outside of an event hook that gets changed during runtime, desyncs will happen when that variable is utilised to modify the game state (i.e. manipulate an entity, print text to players). If making a &amp;quot;global&amp;quot; variable is necessary, place the variable in the [https://lua-api.factorio.com/latest/Global.html global] table instead. The game syncs this table between all clients, so they can all be aware of and reach the same conclusion as each other.&lt;br /&gt;
&lt;br /&gt;
=== Selective requiring ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
if setting1 then&lt;br /&gt;
   require(&amp;quot;settingOne.lua&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Selective requiring, aka requiring different lua files based on settings can cause connection rejections as the checksum of the mods will not match, as they load different data. All clients&#039; mods must require the same series of files.&lt;br /&gt;
&lt;br /&gt;
=== Conditional event subscribing ===&lt;br /&gt;
&lt;br /&gt;
Mods in factorio may subscribe to events in order to be notified when they happen. This allows mods to react to events when they occur. Typically, event subscription is done at the top level of a lua file. &lt;br /&gt;
&lt;br /&gt;
Doing event subscription inside of a conditional, function, or other event is dangerous, as doing it incorrectly will lead to desyncs. Basically, since both the server and client need to reach the same conclusion after running code, conditional subscription can lead to certain clients or the server being subscribed to an event when the others are not, causing desyncs. &lt;br /&gt;
&lt;br /&gt;
=== Improper use of on_load ===&lt;br /&gt;
&lt;br /&gt;
Another way to cause desyncs is to make improper actions inside of an on_load call, which some players new to modding might try to do. According to the [https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.on_load documentation], the on_load functionality is meant for 3 purposes &#039;&#039;&#039;only&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
* Re-register conditional event handlers&lt;br /&gt;
* Re-setup meta tables&lt;br /&gt;
* Create local references to tables stored in the global table&lt;br /&gt;
&lt;br /&gt;
Doing anything else will cause desyncs. The game will catch most attempts, crashing instead and terminating the mod.&lt;br /&gt;
&lt;br /&gt;
=== Comparison by reference ===&lt;br /&gt;
&lt;br /&gt;
Be cautious of comparing tables by reference. In multiplayer syncing, tables deserialized from the server state will be new objects, not equal by reference to any table initialized by client code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
if a == b then&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
if a ~= b then&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are tables in the above conditionals, there will for example be different results between server and client if &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; is created locally and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; is downloaded from the server.&lt;br /&gt;
&lt;br /&gt;
Note that LuaObjects provided by the game have their equality operator overwritten to prevent this behaviour, so code such as &amp;lt;code&amp;gt;LuaEntityA ~= LuaEntityB&amp;lt;/code&amp;gt; will not desync.&lt;br /&gt;
However, this does not apply when LuaObjects are used as keys in tables:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
if table[LuaObject] then&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will desync in the same way as described for the plain tables &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; above. For entities it is recommended to use [https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.unit_number LuaEntity.unit_number] as the table key instead of the whole entity.&lt;br /&gt;
&lt;br /&gt;
== Extended learning ==&lt;br /&gt;
&lt;br /&gt;
One of the best ways to learn how to mod beyond this is to look at other mods. The [[Tutorial:Inspecting a live mod]] is a good starting point for touring a particularly well-commented mod. As all mods can be opened and inspected, looking at the mods of experienced modders can help significantly when making your own mod.&lt;br /&gt;
&lt;br /&gt;
=== Keeping your mod working ===&lt;br /&gt;
&lt;br /&gt;
As Factorio evolves, things will change. Previously, you probably ignored the modding part of the changelog, you now need to read it and see if any changes affect your mod(s). If so, you&#039;ll need to fix them. If there&#039;s something wrong with your mod, the game will fail to init and explain why.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Modding]]&lt;br /&gt;
* [[Modding FAQ]]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Modding_tutorial/Gangsir&amp;diff=191221</id>
		<title>Tutorial:Modding tutorial/Gangsir</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Modding_tutorial/Gangsir&amp;diff=191221"/>
		<updated>2023-04-07T00:47:05Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* The info.json file */ description &amp;quot;length&amp;quot; was nondescript&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
This is a modding tutorial for Factorio version 1.1. In this tutorial, the author will explain how Factorio works behind the scenes, how to modify Factorio, where to find documentation, and explain concepts.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Before we start the tutorial, a few things to note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
Code tinted green like this should be included into the mod this tutorial is going to create; If the reader follows along with it. The best way to do this is to copy and paste, to ensure faithful reproduction.&lt;br /&gt;
Whenever code is added to the mod, a Lua comment with the file name will be at the beginning of the green box. Place the code in the box into that file. Eg:&lt;br /&gt;
--control.lua&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
Code tinted purple like this should not be included into the mod, it&#039;s just for educational/example purposes, and to boost understanding.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial was updated to version 1.1, so any &#039;&#039;viewers in the future should take note that some minor changes may have been made&#039;&#039;, and should look at the changelogs up to the current version.&lt;br /&gt;
&lt;br /&gt;
== Terminology used in modding ==&lt;br /&gt;
&lt;br /&gt;
Before we start the tutorial, a few terms and definitions should be laid out, to ensure the reader understands.&lt;br /&gt;
&lt;br /&gt;
; Mod : A script or series of scripts that allow modifications to the game through the API.&lt;br /&gt;
; Entity : An entity in Factorio is anything in the game that is not a concept, event, or tile. Examples of entities include the character, an assembling machine, a biter, etc. This can be &#039;machines&#039; or free-moving objects like the character.&lt;br /&gt;
; Character : The actual entity that the player manipulates the world through.&lt;br /&gt;
; Player : All the data that defines a player, such as username, online time or the current zoom level.&lt;br /&gt;
; Prototype : A prototype describes an instance of an entity, item or recipe etc, a bit like a template. It defines stats, like what an entity actually is, an item&#039;s stack size, a recipe&#039;s ingredients etc. A prototype is used to create an instance of an entity/item/etc, and many functionally identical entities/items/etc will use the same prototype.&lt;br /&gt;
; Surface : A surface is a bit like a dimension. It is composed of terrain, such as grass, sand, and water, and all the entities on the surface. By default, there is only one surface in Factorio, referred to internally as &amp;quot;nauvis&amp;quot;, or &amp;lt;code style=&amp;quot;background-color:#DDA0DD; color:black&amp;quot;&amp;gt;game.surfaces[1]&amp;lt;/code&amp;gt;, but mods may create additional surfaces through the API.&lt;br /&gt;
; Event : An event is a recurring...event, that is triggered internally by the game. There are several events that mods may connect functions to, such as &amp;lt;code style=&amp;quot;background-color:#DDA0DD; color:black&amp;quot;&amp;gt;on_entity_died&amp;lt;/code&amp;gt;, etc. More on this in the control scripting section.&lt;br /&gt;
; Item : Items are what is moved around in inventories, by inserters and on belts, etc. Each item in-game is an instance of the respective item prototype.&lt;br /&gt;
&lt;br /&gt;
More terminology may be declared and defined later in this tutorial.&lt;br /&gt;
&lt;br /&gt;
== Before beginning to mod ==&lt;br /&gt;
&lt;br /&gt;
Before we can start modding Factorio, we must understand what Factorio is. You may be tempted to answer in lieu of the [[Factorio:About|about page]], but that is what a player would say. Since we are trying to become a modder, we need a more detailed explanation. Factorio is a game that is coded in the language C++, with an API provided by Wube (the developers of Factorio) to mod Factorio in the programming language Lua (version 5.2.1). This API allows adding scripts to the Factorio init process, to modify it without the source code of the base game being exposed, or modifying memory. This may be different than other games that offer modding, but this is a more professional and proper way of supporting modding.&lt;br /&gt;
&lt;br /&gt;
To aid in the use of this API, the devs have kindly provided fairly comprehensive documentation of scripting at their [https://lua-api.factorio.com/latest/ API site] and documentation all around prototypes on [[Prototype definitions|this wiki]]. Get used to using these sites, as they will become frequent visits you will make while you develop mods. The scripting API site contains information on [https://lua-api.factorio.com/latest/Classes.html Factorio&#039;s classes] and information on [https://lua-api.factorio.com/latest/events.html events] that you can hook into. [[Prototype definitions]] contains and links to information all around prototypes, listing their inheritance structure and their properties. You will need to check these sites often, so the author recommends bookmarking them. In addition to these sites, there is also many resources to be found created by the community, such as this tutorial.&lt;br /&gt;
&lt;br /&gt;
=== Setup ===&lt;br /&gt;
&lt;br /&gt;
The best way to develop a mod is to develop it in a place where it can be easily tested. When the tutorial gets to making the mod, this will be explained further. Additionally, using an editor that allows ease of typing and Lua language support is recommended. Emacs, Vim, Sublime Text, VSCode, and Notepad++ are all viable candidates.&lt;br /&gt;
&lt;br /&gt;
== How Factorio loads mods ==&lt;br /&gt;
&lt;br /&gt;
=== Load order ===&lt;br /&gt;
Within stages, mods are loaded by dependency, then by alphabetical order. This is &#039;&#039;very important&#039;&#039; to understand, as it can cause you problems if you neglect it and try to add inter-mod support to your mod.&lt;br /&gt;
&lt;br /&gt;
Factorio has three kinds of dependencies. There are required dependencies, and optional dependencies. The third kind, restrictive dependencies, does not affect mod order and instead prevents the game from loading if the other mod is found. Required dependencies are loaded first, always. The game will fail to initialize if one of these is not present. Optional dependencies are loaded first if present, but do not have to be present. This is useful for enabling bonus features if mods are used together. Required dependencies should be used for mod libraries, and similar infrastructure.&lt;br /&gt;
&lt;br /&gt;
=== The settings stage ===&lt;br /&gt;
The very first mod stage that is loaded when Factorio initializes is the settings stage. This stage is used to define all mod settings that are later shown in the in-game mod settings GUI, and has no other functions or possibilities. When running through this stage, the game looks through all mods for a file called &amp;lt;code&amp;gt;settings.lua&amp;lt;/code&amp;gt;. After settings.lua has been executed for all mods, each mod&#039;s &amp;lt;code&amp;gt;settings-updates.lua&amp;lt;/code&amp;gt; is executed, and finally each mod&#039;s &amp;lt;code&amp;gt;settings-final-fixes.lua&amp;lt;/code&amp;gt; is called. These 3 different phases of the settings stage allow to change settings of other mods without needing to rely on dependencies to load last. All other files to be loaded will need to be required. All the files run here should contain nothing but setting definitions and code to produce setting definitions.&lt;br /&gt;
&lt;br /&gt;
The settings stage does not have access to prototype or runtime data because it is loaded before those stages. The settings are expected to have a certain format, and all additional code will be discarded once the stage is over.&lt;br /&gt;
&lt;br /&gt;
Mod settings are not covered in this tutorial, see [[Tutorial:Mod settings]] for further info on them.&lt;br /&gt;
&lt;br /&gt;
=== The data stage ===&lt;br /&gt;
&lt;br /&gt;
This is the most restricted part of the Factorio init, there&#039;s not much you can do here other than declare prototypes for technologies, entities, items and more. Things like manipulating files, affecting the world, etc, are blocked/unavailable. In fact, any functions or changes made will be discarded, as the lua session is terminated. You also cannot mess with the data table, it will error or be ignored. When using &amp;lt;code&amp;gt;data:extend({})&amp;lt;/code&amp;gt;, it expects a specific format, more on this later.&lt;br /&gt;
&lt;br /&gt;
When running through this stage, the game looks through all mods for a file called &amp;lt;code&amp;gt;data.lua&amp;lt;/code&amp;gt;. After data.lua has been executed for all mods, each mod&#039;s &amp;lt;code&amp;gt;data-updates.lua&amp;lt;/code&amp;gt; is executed, and finally each mod&#039;s &amp;lt;code&amp;gt;data-final-fixes.lua&amp;lt;/code&amp;gt; is called. These 3 different phases of the data stage allow to change data of other mods without needing to rely on dependencies to load last. For example, the base mod creates barrelling recipes for all (then present) fluids in data-updates.lua. This means that if you add a fluid in data.lua, the base mod&#039;s data-updates.lua will add barreling recipes for it, regardless of whether your mod depends on base. Of course this also means that if you add a fluid in data-final-fixes.lua, it is created after the barrelling code runs in data-updates.lua, so no barrelling recipe gets created, even when desired. Because of this and similar mod interactions, it is recommended to create prototypes as early as possible. So, don&#039;t use data-final-fixes.lua to exclude a fluid from barreling, instead create it in data.lua and utilize &amp;quot;auto_barrel = false&amp;quot; on the fluid.&lt;br /&gt;
&lt;br /&gt;
All other files to be loaded will need to be required. All the files run here should contain nothing but prototype definitions and code to produce prototype definitions. More on requiring files later.&lt;br /&gt;
&lt;br /&gt;
All prototypes are documented here on the wiki: [[Prototype definitions]].&lt;br /&gt;
&lt;br /&gt;
=== Migrations ===&lt;br /&gt;
&lt;br /&gt;
[https://lua-api.factorio.com/latest/Migrations.html Migrations] are scripts that are used to &amp;quot;fix&amp;quot; a save after a mod updates. Whenever prototype names change within a mod, migrations must be setup to replace all the old instances of the prototyped entity in the world. This must be done for all updated entities, or the old entities will be removed from the world, which is an unprofessional fallback that makes users dislike you. While this tutorial will not discuss migrations, there are many resources on migrations to be found around the community, and the API site.&lt;br /&gt;
&lt;br /&gt;
To avoid having to write migrations, avoid changing prototype names and technology unlocks. Prototypes names cannot be dynamically changed and technology unlocks of already researched technologies do not apply automatically, making migrations necessary. Try to avoid these changes after shipping the mod out to the public. Try to come up with a finalized version of prototype names that you can base the mod around. Of course, migrations are unnecessary if the user simply starts a new world with each mod update, but do not expect the community to do this.&lt;br /&gt;
&lt;br /&gt;
=== Runtime stage ===&lt;br /&gt;
&lt;br /&gt;
Within most mods is a file called &amp;lt;code&amp;gt;control.lua&amp;lt;/code&amp;gt;. This file contains scripting that makes the mod do things during the game, rather than just adding entities to the game. During this stage, each mod&#039;s control.lua is run, in it&#039;s own lua instance (this means no inter-communication without special setup) which it will own for the rest of the play session. During the play session, access to all tables provided by the game can be done inside of event handlers. (More on those below.) Because the control.lua is run every time a save file is created or loaded you don&#039;t need to restart the game to see changes made to the control.lua file. Simply restarting or reloading a save will re-run this stage. &#039;&#039;&#039;There are a few other caveats to this stage, reading the [https://lua-api.factorio.com/latest/Data-Lifecycle.html data life cycle] page on the API site provides the best overview.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The control stage documented is documented on [https://lua-api.factorio.com/latest lua-api.factorio.com].&lt;br /&gt;
&lt;br /&gt;
== The major components to any Factorio mod ==&lt;br /&gt;
&lt;br /&gt;
Within the average mod, there are several components that make the mod function.&lt;br /&gt;
&lt;br /&gt;
Mods that define new entities will need to declare these entities in &amp;lt;code&amp;gt;data.lua&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;data-updates.lua&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;data-final-fixes.lua&amp;lt;/code&amp;gt;, or another file &amp;lt;code&amp;gt;require&amp;lt;/code&amp;gt;d by one of these three.&lt;br /&gt;
&lt;br /&gt;
Mods with in-game effects will also need a &amp;lt;code&amp;gt;control.lua&amp;lt;/code&amp;gt; file, to add scripting.&lt;br /&gt;
&lt;br /&gt;
Mods with configurable user settings will use &amp;lt;code&amp;gt;settings.lua&amp;lt;/code&amp;gt; to describe those settings.&lt;br /&gt;
&lt;br /&gt;
Mods that define any game element with a readable name may also provide a &amp;lt;code&amp;gt;locale&amp;lt;/code&amp;gt; directory and subdirectories with names/descriptions in one or more languages.&lt;br /&gt;
&lt;br /&gt;
The mod that we&#039;ll make in this tutorial will include both data.lua prototypes and control.lua scripting, to give you a feel for both.&lt;br /&gt;
&lt;br /&gt;
== The tutorial mod ==&lt;br /&gt;
&lt;br /&gt;
And now for the moment you&#039;ve been waiting for. Let&#039;s start making your first mod. You&#039;ll need:&lt;br /&gt;
&lt;br /&gt;
* A recent install of Factorio&lt;br /&gt;
* A text editor, such as Emacs, Vim, Sublime text, etc&lt;br /&gt;
* An understanding of the tutorial above&lt;br /&gt;
* An understanding of Lua as a programming language. Enough to know the syntax and how it works. If you have prior programming experience, it should not be difficult to pick up.&lt;br /&gt;
&lt;br /&gt;
Once you have all of these things, we can begin.&lt;br /&gt;
&lt;br /&gt;
For this mod, we&#039;re going to make a set of armor that leaves behind damaging fire behind you as you walk. It will be fully resistant to fire, but weaker towards physical damage than heavy armor, making it an armor for hit and run attacks.&lt;br /&gt;
&lt;br /&gt;
=== Creation of the directory structure ===&lt;br /&gt;
&lt;br /&gt;
The game expects mod to be laid out [[Tutorial:Mod structure|in a certain way]]. To start out, create a folder in your [[Application directory|user data directory]]/mods folder. This folder must have a specific name, &amp;lt;code&amp;gt;fire-armor&amp;lt;/code&amp;gt;. When you&#039;re finished, the mod directory should look like this:&lt;br /&gt;
&lt;br /&gt;
* (user data directory, sometimes called .factorio)&lt;br /&gt;
** mods&lt;br /&gt;
*** fire-armor&lt;br /&gt;
&lt;br /&gt;
Then, inside fire-armor, create two files, &amp;lt;code&amp;gt;info.json&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;data.lua&amp;lt;/code&amp;gt;. The directory should now look like:&lt;br /&gt;
&lt;br /&gt;
* (user data directory, sometimes called .factorio)&lt;br /&gt;
** mods&lt;br /&gt;
*** fire-armor&lt;br /&gt;
**** data.lua&lt;br /&gt;
**** info.json&lt;br /&gt;
&lt;br /&gt;
=== The info.json file ===&lt;br /&gt;
&lt;br /&gt;
Then, inside [[Tutorial:Mod_structure#info.json|info.json]], copy and paste the following into it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;name&amp;quot;: &amp;quot;fire-armor&amp;quot;,&lt;br /&gt;
  &amp;quot;version&amp;quot;: &amp;quot;0.1.0&amp;quot;,&lt;br /&gt;
  &amp;quot;title&amp;quot;: &amp;quot;Fire Armor&amp;quot;,&lt;br /&gt;
  &amp;quot;author&amp;quot;: &amp;quot;You&amp;quot;,&lt;br /&gt;
  &amp;quot;factorio_version&amp;quot;: &amp;quot;1.1&amp;quot;,&lt;br /&gt;
  &amp;quot;dependencies&amp;quot;: [&amp;quot;base &amp;gt;= 1.1&amp;quot;],&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;This mod adds in fire armor that leaves behind damaging fire as you walk around.&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To explain each field:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Item&lt;br /&gt;
! Explanation&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| This is the internal name of your mod, it is used to identify your mod in code.&lt;br /&gt;
|-&lt;br /&gt;
| version&lt;br /&gt;
| This is the version of your mod. This can be anything you want, provided it&#039;s a of the format &amp;quot;number.number.number&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| title&lt;br /&gt;
| The pretty title of your mod, this will be displayed on the mods screen and when you submit it to the mod portal.&lt;br /&gt;
|-&lt;br /&gt;
| author&lt;br /&gt;
| Your name! You can change this in the example above.&lt;br /&gt;
|-&lt;br /&gt;
| factorio_version&lt;br /&gt;
| This tells the game what version the mod is for, this must match the version you&#039;re developing the mod for, 1.1 in this case.&lt;br /&gt;
|-&lt;br /&gt;
| dependencies&lt;br /&gt;
| Any dependencies of your mod.&lt;br /&gt;
|-&lt;br /&gt;
| description&lt;br /&gt;
| A short description of your mod, which appears in game. A longer description is better kept to the mod portal.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
And that&#039;s all for info.json! Next, in the data.lua file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
--data.lua&lt;br /&gt;
&lt;br /&gt;
require(&amp;quot;item&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It&#039;s a pretty simple file, all we&#039;re doing here is just telling the game to execute the file called item.lua, which we&#039;re about to create. Create a file in fire-armor called &amp;lt;code&amp;gt;item.lua&amp;lt;/code&amp;gt;. Notice how our earlier require used the file name in it?&lt;br /&gt;
&lt;br /&gt;
We are creating this file just for our own organisation inside the mod, so there are no naming or other requirements from the game&#039;s side. As long as we tell the game to load the file with &amp;quot;require&amp;quot;, the file name or its exact location inside the mod does not matter.&lt;br /&gt;
&lt;br /&gt;
=== Prototype creation ===&lt;br /&gt;
&lt;br /&gt;
Now, there are two ways to create prototypes in Factorio. There&#039;s the short way, and the long way. The long way requires to create a complete prototype definition based on [[prototype definitions|the documentation]], and the short way just uses a lua function to copy and modify an already existing definition. For the sake of this tutorial, we&#039;ll do it the short way.&lt;br /&gt;
&lt;br /&gt;
In item.lua, copy and paste the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
--item.lua&lt;br /&gt;
&lt;br /&gt;
local fireArmor = table.deepcopy(data.raw[&amp;quot;armor&amp;quot;][&amp;quot;heavy-armor&amp;quot;]) -- copy the table that defines the heavy armor item into the fireArmor variable&lt;br /&gt;
&lt;br /&gt;
fireArmor.name = &amp;quot;fire-armor&amp;quot;&lt;br /&gt;
fireArmor.icons = {&lt;br /&gt;
  {&lt;br /&gt;
    icon = fireArmor.icon,&lt;br /&gt;
    tint = {r=1,g=0,b=0,a=0.3}&lt;br /&gt;
  },&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fireArmor.resistances = {&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;physical&amp;quot;,&lt;br /&gt;
    decrease = 6,&lt;br /&gt;
    percent = 10&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;explosion&amp;quot;,&lt;br /&gt;
    decrease = 10,&lt;br /&gt;
    percent = 30&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;acid&amp;quot;,&lt;br /&gt;
    decrease = 5,&lt;br /&gt;
    percent = 30&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;fire&amp;quot;,&lt;br /&gt;
    decrease = 0,&lt;br /&gt;
    percent = 100&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local recipe = table.deepcopy(data.raw[&amp;quot;recipe&amp;quot;][&amp;quot;heavy-armor&amp;quot;])&lt;br /&gt;
recipe.enabled = true&lt;br /&gt;
recipe.name = &amp;quot;fire-armor&amp;quot;&lt;br /&gt;
recipe.ingredients = {{&amp;quot;copper-plate&amp;quot;,200},{&amp;quot;steel-plate&amp;quot;,50}}&lt;br /&gt;
recipe.result = &amp;quot;fire-armor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
data:extend{fireArmor,recipe}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What we&#039;ve just done here is we&#039;ve copied the definition of heavy armor, then changed it&#039;s properties, and injected it into the Factorio init with data:extend. The first line of code is probably the most interesting. &amp;lt;code&amp;gt;table.deepcopy&amp;lt;/code&amp;gt; copies a table fully into another table. We do this from data.raw. The &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; part is a table, which will be used by the game to setup the Factorio universe. In fact, it contains the function &amp;lt;code&amp;gt;extend(self, prototypes)&amp;lt;/code&amp;gt; and a table called &amp;lt;code&amp;gt;raw&amp;lt;/code&amp;gt;. The former is a customary way to add new stuff to the latter. It is actually data.raw that holds the prototypes for the game. (You can view the implementation in the file [https://github.com/wube/factorio-data/blob/master/core/lualib/dataloader.lua /factorio/data/core/lualib/dataloader.lua]). It is important to note that data.raw only exists during the data loading stage of the game. During the control stage, when the game is running and being played, you cannot read this data; instead you read processed values through the API from the various types like LuaEntityPrototype.&lt;br /&gt;
&lt;br /&gt;
In addition to defining the item prototype, we also define a recipe for it. This is necessary if you want to be able to craft the thing. We also set it to enabled so it doesn&#039;t need a technology to unlock.&lt;br /&gt;
&lt;br /&gt;
=== More on data.raw ===&lt;br /&gt;
&lt;br /&gt;
When Factorio initializes, all prototypes are put into a table called data.raw. This table holds all prototype types, and within those types, individual prototypes identified by name: &amp;lt;code&amp;gt;local prototype = data.raw[&amp;quot;prototype-type&amp;quot;][&amp;quot;internal-name&amp;quot;]&amp;lt;/code&amp;gt;. You saw earlier how we deepcopied from the definition of heavy armor, and modified some fields. In fact, let&#039;s go over each part of the deepcopy line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
local fireArmor = table.deepcopy(data.raw[&amp;quot;armor&amp;quot;][&amp;quot;heavy-armor&amp;quot;])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We assign a variable called fireArmor that holds our copy of the heavy armor definition. Notice how in data.raw, there is a type table that holds all armors, and the specific armor we&#039;re looking for is called heavy-armor. We can find [[heavy armor]]&#039;s prototype type and internal name in the infobox of its page on this wiki and just copy it from there.&amp;lt;br&amp;gt;&lt;br /&gt;
Alternatively, we can find the items prototype type and internal name by opening the game, inserting the item into our inventory and then pressing {{Keybinding|shift|ctrl|F}} while hovering over the item. This will open the prototype explorer GUI, which has rows showing the name and type of the item.&lt;br /&gt;
&lt;br /&gt;
As another example, the [[player|character]]&#039;s prototype would be, according to the infobox on the page:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
data.raw[&amp;quot;character&amp;quot;][&amp;quot;character&amp;quot;]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the character is &#039;&#039;the&#039;&#039; character, his type matches his name. You could define a new type of character with a mod. You can see all the available prototype fields of the charater in the documenation: [[Prototype/Character]].&lt;br /&gt;
&lt;br /&gt;
You may be thinking at this point, &amp;quot;Can I modify Factorio&#039;s existing prototypes without making new ones?&amp;quot; Well, the answer is yes! You would simply access the data.raw table during init, in data-final-fixes.lua if you want to run after all other mods, and change a property. For example, make the iron chest instead have 1000 health:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
data.raw[&amp;quot;container&amp;quot;][&amp;quot;iron-chest&amp;quot;].max_health = 1000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reason why this code is in data-final-fixes.lua is because that is the last file run, after all mod files have been run. This prevents (to a degree) your changes from being messed with by other mods. Of course, it is still possible to have incompatibilities. You should note any that you know of in your mod&#039;s description. Again, the [https://lua-api.factorio.com/latest/Data-Lifecycle.html dev&#039;s documentation] on this should be looked at.&lt;br /&gt;
&lt;br /&gt;
This can also be applied to other mods, not just Factorio&#039;s base. You could mod a mod, as long as you add the mod (that you modified with your mod) to your dependencies so it gets loaded first.&lt;br /&gt;
&lt;br /&gt;
=== The control scripting ===&lt;br /&gt;
&lt;br /&gt;
And now, to finalize the mod, we have to make it be more than just simple armor. Let&#039;s think about what we want the armor to do. We want the armor to create fire on the ground as we walk with the armor on. The event we&#039;re going to use is called [https://lua-api.factorio.com/latest/events.html#on_player_changed_position on_player_changed_position], since we want the fire to be created when the player moves.&lt;br /&gt;
&lt;br /&gt;
In our mod folder, create a file called &amp;lt;code&amp;gt;control.lua&amp;lt;/code&amp;gt;. The game will automatically execute this file, so requiring it is not necessary.&lt;br /&gt;
&lt;br /&gt;
Inside control.lua, copy and paste the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black;&amp;quot;&amp;gt;&lt;br /&gt;
--control.lua&lt;br /&gt;
&lt;br /&gt;
script.on_event(defines.events.on_player_changed_position,&lt;br /&gt;
  function(event)&lt;br /&gt;
    local player = game.get_player(event.player_index) -- get the player that moved            &lt;br /&gt;
    -- if they&#039;re wearing our armor&lt;br /&gt;
    if player.character and player.get_inventory(defines.inventory.character_armor).get_item_count(&amp;quot;fire-armor&amp;quot;) &amp;gt;= 1 then&lt;br /&gt;
       -- create the fire where they&#039;re standing&lt;br /&gt;
       player.surface.create_entity{name=&amp;quot;fire-flame&amp;quot;, position=player.position, force=&amp;quot;neutral&amp;quot;} &lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used lua comments in the code above to explain each step. It&#039;s fairly easy to understand, and it shows how you would get the current armor that the player character is wearing, with defines.inventory.character_armor, which is an inventory constant. You can read the list of defines [https://lua-api.factorio.com/latest/defines.html#defines.inventory here].&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve already tried loading up Factorio and trying the mod so far (which you can at this point without it crashing), you may have noticed that the item name of the armor says &amp;quot;Unknown key&amp;quot;. This means that Factorio has the internal name, but it doesn&#039;t know what it should look like to the user. So, we need to create a locale for our mod.&lt;br /&gt;
&lt;br /&gt;
In the mod folder, create a folder called &amp;lt;code&amp;gt;locale&amp;lt;/code&amp;gt;, then create another folder inside that called &amp;lt;code&amp;gt;en&amp;lt;/code&amp;gt;, then a file called &amp;lt;code&amp;gt;any_name_can_be_here.cfg&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you know another language, you can also translate your mod by making other language code files inside locale, such as de for German.&lt;br /&gt;
&lt;br /&gt;
Inside the .cfg file, paste the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#AAFFAA!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[item-name]&lt;br /&gt;
fire-armor=Fire armor&lt;br /&gt;
&lt;br /&gt;
[item-description]&lt;br /&gt;
fire-armor=An armor that seems to catch the ground itself on fire when you take a step. It&#039;s warm to the touch.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice how this is not a lua file. Locale is handled with C config files, so the format is different.&lt;br /&gt;
&lt;br /&gt;
== The finished tutorial mod ==&lt;br /&gt;
&lt;br /&gt;
Well, the mod is finished. Since this mod is only a tutorial, there isn&#039;t much balance to it.&lt;br /&gt;
&lt;br /&gt;
If you want to share a mod with other users, it needs to be a zip file. For that, simply zip the &amp;lt;code&amp;gt;fire-armor&amp;lt;/code&amp;gt; folder and then rename the archive to &amp;lt;code&amp;gt;fire-armor_0.1.0&amp;lt;/code&amp;gt; so that it follows the expected mod zip name pattern of &amp;lt;code&amp;gt;mod-name_version&amp;lt;/code&amp;gt;. Keep in mind to not submit this tutorial mod to the mod portal as your own, since it&#039;s from the Wiki.&lt;br /&gt;
&lt;br /&gt;
However, you&#039;re free to take this mod and modify it for your own use, changing recipes, adding technologies, whatever.&lt;br /&gt;
&lt;br /&gt;
== Resolving common errors in modding ==&lt;br /&gt;
&lt;br /&gt;
As you continue to write mods from scratch instead of from a tutorial, you may encounter the infamous error. There are several types of errors that you can encounter in modding Factorio, and knowing how to deal with these errors will allow you to continue working.&lt;br /&gt;
&lt;br /&gt;
=== Syntax errors ===&lt;br /&gt;
&lt;br /&gt;
The lua programming language expects things to be laid out a certain way. If you miss a bracket, = sign, or dot, you will encounter a syntax error. As an example, see the error below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
Failed to load mods: __fire-armor__/data.lua:1:__fire-armor__/prototypes/item.lua:36: syntax error near &#039;true&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of version 0.15, you&#039;ll see an error like the one above whenever you make a syntax error within the prototype definitions. The game will offer to restart, disable the troubling mod, disable all mods, or exit. Let&#039;s dissect the error, shall we?&lt;br /&gt;
&lt;br /&gt;
Right away, we see the reason why Factorio didn&#039;t start normally. &amp;quot;Failed to load mods:&amp;quot;. So, we know that it&#039;s a mod that messed up, and by extension, we know it&#039;s our mod. Whenever the Lua engine of Factorio has a syntax error, it will print a mini stack-trace that follows through all requires, listing the call order. First, we see that the problem was indirectly caused by line 1 of data.lua. There&#039;s no problem there, so it must be the next entry, line 36 of prototypes/item.lua. After stating where it is line-wise, it will attempt to give you an estimate of where in the line the problem is. Don&#039;t trust this estimate, only roughly trust the line number, plus or minus a few lines.&lt;br /&gt;
&lt;br /&gt;
Going to line 36 of item.lua, we find:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
recipe.enabled true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hmm, that doesn&#039;t look right. Can you see what&#039;s missing? We left off an = between enabled and true. Thus, syntax error. Fixing these can be difficult for new programmers, who don&#039;t know what to look for.&lt;br /&gt;
&lt;br /&gt;
=== Illogical actions, indexing nil ===&lt;br /&gt;
&lt;br /&gt;
In lua, &amp;quot;nothing&amp;quot; is defined as the keyword nil. This is similar to null in other programming languages. Whenever the programmer tries to access something in a table that is nil, they will get an error like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
Error while running event fire-armor::on_player_changed_position (ID 82)&lt;br /&gt;
__fire-armor__/control.lua:3: attempt to index field &#039;?&#039; (a nil value)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;attempt to index field ...&amp;quot; error is often caused by the modder making an assumption that didn&#039;t work out. These types of errors will always be identifiable by their signature line, &amp;quot;attempt to index field&amp;quot;. If we look at line 3 of control.lua (where the error is), we see:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
game.print(game.players[23])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What assumption has the modder made here? Well, there&#039;s actually two problems with this line. The first thing is that the modder has assumed that &amp;lt;code&amp;gt;game.players[23]&amp;lt;/code&amp;gt; is a valid player, which isn&#039;t the case; this is why we get the &amp;quot;index field &#039;?&#039;&amp;quot; bit. The game doesn&#039;t know what the field is that we tried to index, because it hasn&#039;t been created yet. These errors are difficult to debug unless you know the ins and outs of the modding API well.&lt;br /&gt;
&lt;br /&gt;
The second issue is a lot more subtle, and won&#039;t work. The modder is attempting to print a userdata table. [https://lua-api.factorio.com/latest/LuaPlayer.html A player] is a table of several values. Trying to print it simply print &amp;quot;LuaPlayer&amp;quot; instead of providing useful data.&lt;br /&gt;
&lt;br /&gt;
=== Error while running event ===&lt;br /&gt;
&lt;br /&gt;
Another common type of error in Factorio is the &amp;quot;Error while running event&amp;quot; error. This type of error only happens in control.lua scripting, and it happens when something goes wrong in an event function, such as a syntax error. &#039;&#039;&#039;Note that syntax errors in control.lua do not stop the game from starting, but may trigger after a save is loaded&#039;&#039;&#039;. There are a great deal of errors under this broad category, here&#039;s an example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
Error while running event fire-armor::on_player_changed_position (ID 82)&lt;br /&gt;
Unknown entity name: fire-flam&lt;br /&gt;
stack traceback:&lt;br /&gt;
__fire-armor__/control.lua:7: in function &amp;lt;__fire-armor__/control.lua:2&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you saw with the prototypes syntax error, Factorio gives a small traceback and the error name itself. In this case, we&#039;ve attempted to spawn an entity called &amp;quot;fire-flam&amp;quot; on line 7 of control.lua, inside of an on_player_changed_position event hook. Fire-flam isn&#039;t a real entity type, so we crashed.&lt;br /&gt;
&lt;br /&gt;
These types of errors can range from being a simple fix (like the one above, add the missing e), or can be very difficult.&lt;br /&gt;
&lt;br /&gt;
=== Internal errors ===&lt;br /&gt;
&lt;br /&gt;
The most rare form of error and the worst form is the internal error. This is an error with the C++ code of the game, and there&#039;s nothing you can do but report it to the devs. Mods occasionally cause these, and almost all of them are considered bugs, as mods &#039;&#039;should not&#039;&#039; be able to cause these, if that makes sense. They often get thrown into the logs.&lt;br /&gt;
&lt;br /&gt;
An example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
696.148 Error FlowStatistics.cpp:236: FlowStatistics attempted to save value larger than uint16 as uint16. Exiting to prevent save corruption.&lt;br /&gt;
Logger::writeStacktrace skipped.&lt;br /&gt;
696.148 Error CrashHandler.cpp:190: Map tick at moment of crash: 432029&lt;br /&gt;
696.148 Error Util.cpp:97: Unexpected error occurred. If you&#039;re running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.&lt;br /&gt;
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiplayer and desyncs ==&lt;br /&gt;
&lt;br /&gt;
The reader may be wondering at this point how Factorio handles multiplayer with mods. It&#039;s fairly simple, but is still worth considering.&lt;br /&gt;
&lt;br /&gt;
Factorio is [https://en.wikipedia.org/wiki/Deterministic_algorithm deterministic], which means that when you provide a constant input, you get a constant output, with no variance. Every client and the server all reach the same points at the same time in simulation, so they all agree on what happened. When this differs, the players experience a &#039;&#039;desync&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
; Desync : Misalignment with server and clients. Client 1 expected A, but got B. All other clients got A. Thus, Client 1 will desync. Desync can also happen when all clients have information (for example a variable) but a client that recently joined the game doesn&#039;t. That client will be desynced.&lt;br /&gt;
: &#039;&#039;See also: [[Desynchronization]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Desyncs happen a lot to new devs of Factorio mods, because they are unaware that a particular piece of code they used causes desyncs. As a general rule, there are a few things that should never be done.&lt;br /&gt;
&lt;br /&gt;
=== Use local variables that are not final outside of event hooks ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
local globalLocal = 1&lt;br /&gt;
script.on_event(defines.events.on_player_built_item, function()&lt;br /&gt;
    globalLocal = math.random()&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the modder places a local variable outside of an event hook that gets changed during runtime, desyncs will happen when that variable is utilised to modify the game state (i.e. manipulate an entity, print text to players). If making a &amp;quot;global&amp;quot; variable is necessary, place the variable in the [https://lua-api.factorio.com/latest/Global.html global] table instead. The game syncs this table between all clients, so they can all be aware of and reach the same conclusion as each other.&lt;br /&gt;
&lt;br /&gt;
=== Selective requiring ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
if setting1 then&lt;br /&gt;
   require(&amp;quot;settingOne.lua&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Selective requiring, aka requiring different lua files based on settings can cause connection rejections as the checksum of the mods will not match, as they load different data. All clients&#039; mods must require the same series of files.&lt;br /&gt;
&lt;br /&gt;
=== Conditional event subscribing ===&lt;br /&gt;
&lt;br /&gt;
Mods in factorio may subscribe to events in order to be notified when they happen. This allows mods to react to events when they occur. Typically, event subscription is done at the top level of a lua file. &lt;br /&gt;
&lt;br /&gt;
Doing event subscription inside of a conditional, function, or other event is dangerous, as doing it incorrectly will lead to desyncs. Basically, since both the server and client need to reach the same conclusion after running code, conditional subscription can lead to certain clients or the server being subscribed to an event when the others are not, causing desyncs. &lt;br /&gt;
&lt;br /&gt;
=== Improper use of on_load ===&lt;br /&gt;
&lt;br /&gt;
Another way to cause desyncs is to make improper actions inside of an on_load call, which some players new to modding might try to do. According to the [https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.on_load documentation], the on_load functionality is meant for 3 purposes &#039;&#039;&#039;only&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
* Re-register conditional event handlers&lt;br /&gt;
* Re-setup meta tables&lt;br /&gt;
* Create local references to tables stored in the global table&lt;br /&gt;
&lt;br /&gt;
Doing anything else will cause desyncs. The game will catch most attempts, crashing instead and terminating the mod.&lt;br /&gt;
&lt;br /&gt;
=== Comparison by reference ===&lt;br /&gt;
&lt;br /&gt;
Be cautious of comparing tables by reference. In multiplayer syncing, tables deserialized from the server state will be new objects, not equal by reference to any table initialized by client code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
if a == b then&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
if a ~= b then&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are tables in the above conditionals, there will for example be different results between server and client if &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; is created locally and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; is downloaded from the server.&lt;br /&gt;
&lt;br /&gt;
Note that LuaObjects provided by the game have their equality operator overwritten to prevent this behaviour, so code such as &amp;lt;code&amp;gt;LuaEntityA ~= LuaEntityB&amp;lt;/code&amp;gt; will not desync.&lt;br /&gt;
However, this does not apply when LuaObjects are used as keys in tables:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:#DDA0DD!important; color:black&amp;quot;&amp;gt;&lt;br /&gt;
if table[LuaObject] then&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will desync in the same way as described for the plain tables &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; above. For entities it is recommended to use [https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.unit_number LuaEntity.unit_number] as the table key instead of the whole entity.&lt;br /&gt;
&lt;br /&gt;
== Extended learning ==&lt;br /&gt;
&lt;br /&gt;
One of the best ways to learn how to mod beyond this is to look at other mods. The [[Tutorial:Inspecting a live mod]] is a good starting point for touring a particularly well-commented mod. As all mods can be opened and inspected, looking at the mods of experienced modders can help significantly when making your own mod.&lt;br /&gt;
&lt;br /&gt;
=== Keeping your mod working ===&lt;br /&gt;
&lt;br /&gt;
As Factorio evolves, things will change. Previously, you probably ignored the modding part of the changelog, you now need to read it and see if any changes affect your mod(s). If so, you&#039;ll need to fix them. If there&#039;s something wrong with your mod, the game will fail to init and explain why.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Modding]]&lt;br /&gt;
* [[Modding FAQ]]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Prototype/Recipe&amp;diff=191220</id>
		<title>Prototype/Recipe</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Prototype/Recipe&amp;diff=191220"/>
		<updated>2023-04-06T09:02:59Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* General properties */ reword icon(s)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Prototype parent|PrototypeBase}}&lt;br /&gt;
A recipe. It can be a crafting recipe, a smelting recipe, or a custom type of recipe (see [[Prototype/RecipeCategory]]).&lt;br /&gt;
&lt;br /&gt;
{{Prototype TOC|recipe}}&lt;br /&gt;
&lt;br /&gt;
== General properties ==&lt;br /&gt;
Inherits all properties from [[PrototypeBase]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|category|[[Types/string|string]]|&amp;quot;crafting&amp;quot;|optional=true}}&lt;br /&gt;
Optional. Name of a [[Prototype/RecipeCategory]]. The category of the recipe is used to control which machines can craft the recipe. The built-in categories can be found [[Data.raw#recipe-category|here]].&lt;br /&gt;
&lt;br /&gt;
The recipe category &amp;quot;crafting&amp;quot; cannot contain recipes with fluid ingredients or products.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|subgroup|[[Types/string|string]]||optional=true}}&lt;br /&gt;
Optional. Name of a [[Prototype/ItemSubGroup]]. The subgroup of this recipe. If not specified, defaults to the subgroup of the product if there is only 1, or main_product if multiple products exist. If multiple products exist and no main_product is specified, or if there is no product, the subgroup is required.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|icons, icon,  icon_size (IconSpecification)|[[Types/IconSpecification|IconSpecification]]|optional=true}}&lt;br /&gt;
If given, this determines the recipe&#039;s icon. Mandatory for a recipe with more than 1 product and no main_product, or, no product.&lt;br /&gt;
&lt;br /&gt;
Otherwise, the icon of main_product or the only product is used.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|crafting_machine_tint|[[Types/table|table]] of [[Types/Color|Color]]|optional=true}}&lt;br /&gt;
Optional. Used by crafting machine &amp;lt;code&amp;gt;[[Prototype/CraftingMachine#working_visualisations|working_visualisations]]&amp;lt;/code&amp;gt; to tint certain layers with the recipe color. [[Types/WorkingVisualisation#apply_recipe_tint|apply_recipe_tint]] on the working visualisation determines which of the 4 colors is used for that layer (if any).&lt;br /&gt;
&lt;br /&gt;
Format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;crafting_machine_tint = { primary = {r=0,g=0,b=0,a=0}, secondary = {r=0,g=0,b=0,a=0}, tertiary = {r=0,g=0,b=0,a=0}, quaternary = {r=0,g=0,b=0,a=0}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each key/value pair is optional and defaults to the above value.&lt;br /&gt;
&lt;br /&gt;
== Recipe data ==&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
Anchor and property for the TOC at the top --&amp;gt;&amp;lt;span id=&amp;quot;normal&amp;quot;&amp;gt;{{#subobject:normal&lt;br /&gt;
 |Prototype property name=normal&lt;br /&gt;
 |Prototype property type=[[Prototype/Recipe#Recipe_data|Recipe data]] or [[Types/bool|bool]]&lt;br /&gt;
 |Prototype property optional=true&lt;br /&gt;
 |Prototype property pagename={{FULLPAGENAME}}&lt;br /&gt;
}}&amp;lt;/span&amp;gt;&amp;lt;!-- &lt;br /&gt;
Anchor and property for the TOC at the top --&amp;gt;&amp;lt;span id=&amp;quot;expensive&amp;quot;&amp;gt;{{#subobject:expensive&lt;br /&gt;
 |Prototype property name=expensive&lt;br /&gt;
 |Prototype property type=[[Prototype/Recipe#Recipe_data|Recipe data]] or [[Types/bool|bool]]&lt;br /&gt;
 |Prototype property optional=true&lt;br /&gt;
 |Prototype property pagename={{FULLPAGENAME}}&lt;br /&gt;
}}&amp;lt;/span&amp;gt;&amp;lt;!-- &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
If the recipe does not have a difficulty, this is located directly in the prototype. Otherwise, if the &amp;quot;&#039;&#039;&#039;normal&#039;&#039;&#039;&amp;quot; or &amp;quot;&#039;&#039;&#039;expensive&#039;&#039;&#039;&amp;quot; property exists, the recipe has difficulty. Then, the recipe data has to be specified for each difficulty instead of directly in the prototype. If at least one difficulty has recipe data defined, the other difficulty can be set to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. This will disable the recipe for the difficulty, same as setting it &amp;lt;code&amp;gt;enabled = false&amp;lt;/code&amp;gt;. If it is enabled (by technologies etc), it will use the data from the other difficulty. Not setting a difficulty, e.g. &amp;lt;code&amp;gt;normal = nil&amp;lt;/code&amp;gt;, is possible and gives that difficulty the exact same properties as the difficulty that is defined. Setting one or both difficulties to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; is not valid and will produce an error. See below for examples of difficulty.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ingredients|[[Types/table|table]] of [[Types/IngredientPrototype|IngredientPrototype]]}}&lt;br /&gt;
A table containing ingredient names and counts. Can also contain information about fluid temperature and catalyst amounts. The catalyst amounts are automatically calculated from the recipe, or can be set manually in the [[Types/IngredientPrototype|IngredientPrototype]].&amp;lt;sup&amp;gt;[https://factorio.com/blog/post/fff-256]&amp;lt;/sup&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Maximum ingredient amount is 65535.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ingredients&amp;lt;/code&amp;gt; can be set to an empty table  to create a recipe that needs no ingredients.&amp;lt;br&amp;gt;&lt;br /&gt;
Duplicate ingredients, e.g. two entries for the &amp;quot;wood&amp;quot; item, are &#039;&#039;not&#039;&#039; allowed.&amp;lt;br&amp;gt;&lt;br /&gt;
In-game, the item ingredients are ordered by [[Prototype/ItemGroup#order_in_recipe|item group order_in_recipe]].&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{&amp;quot;iron-stick&amp;quot;, 2}, {&amp;quot;iron-plate&amp;quot;, 3}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The same with full format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-stick&amp;quot;, amount = 2}, {type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-plate&amp;quot;, amount = 3}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
For fluids, the full format always has to be used:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{type=&amp;quot;fluid&amp;quot;, name=&amp;quot;water&amp;quot;, amount=50}, {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;crude-oil&amp;quot;, amount=100}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|result|[[Types/string|string]]|optional=true}}&lt;br /&gt;
Can be replaced with the results parameter. The item created by this recipe. Must be the name of an item, such as &amp;quot;iron-gear-wheel&amp;quot;.&lt;br /&gt;
Note that &amp;lt;code&amp;gt;results&amp;lt;/code&amp;gt; takes priority over &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt;. So if a recipe has both keys set, &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt; will be ignored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|result_count|[[Types/uint32|uint32]]|1|optional=true}}&lt;br /&gt;
Optional. The number of items created by this recipe.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|results|[[Types/table|table]] of [[Types/ProductPrototype|ProductPrototype]]|optional=true}}&lt;br /&gt;
A table containing result names and counts. Can also contain information about fluid temperature and catalyst amounts. The catalyst amounts are automatically calculated from the recipe, or can be set manually in the [[Types/ProductPrototype|ProductPrototype]].&amp;lt;sup&amp;gt;[https://factorio.com/blog/post/fff-256]&amp;lt;/sup&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;results&amp;lt;/code&amp;gt; can be set to an empty table to create a recipe that produces nothing.&amp;lt;br&amp;gt;&lt;br /&gt;
Duplicate results, e.g. two entries for the &amp;quot;iron-plate&amp;quot; item, are allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results=&lt;br /&gt;
    {&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=3},&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;light-oil&amp;quot;, amount=3},&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;petroleum-gas&amp;quot;, amount=4}&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results = &lt;br /&gt;
    {&lt;br /&gt;
      {type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-nuggets&amp;quot;, amount = 9},&lt;br /&gt;
      {type = &amp;quot;item&amp;quot;, name = &amp;quot;gold-nuggets&amp;quot;, amount = 1}&lt;br /&gt;
     },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results = &lt;br /&gt;
    {&lt;br /&gt;
      {type = &amp;quot;fluid&amp;quot;, name = &amp;quot;steam&amp;quot;, amount = 1, temperature = 165}&lt;br /&gt;
     },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|energy_required|[[Types/double|double]]|0.5|optional=true}}&lt;br /&gt;
Optional. The amount of time it takes to make this recipe. Must be greater than 0.001.&lt;br /&gt;
&lt;br /&gt;
This is the number of seconds it takes to craft at crafting speed 1.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|emissions_multiplier|[[Types/double|double]]|1.0|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|requester_paste_multiplier|[[Types/uint32|uint32]]|30|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|overload_multiplier|[[Types/uint32|uint32]]|0|optional=true}}&lt;br /&gt;
Used to determine how many extra items are put into an assembling machine before it&#039;s considered &amp;quot;full enough&amp;quot;. See [[Inserters#Insertion_limits]].&lt;br /&gt;
&lt;br /&gt;
If set to 0, it instead uses the following formula: 1.166 / (energy_required / the assembler&#039;s crafting_speed), rounded up, and clamped between 2 and 100. The numbers used in this formula can be changed by the [[Prototype/UtilityConstants]] dynamic_recipe_overload_factor, minimum_recipe_overload_multiplier and maximum_recipe_overload_multiplier.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_inserter_overload|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
If the recipe is allowed to have the extra inserter overload bonus applied (4 * stack inserter stack size).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|enabled|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. This can be false to disable the recipe at the start of the game, or &amp;quot;true&amp;quot; to leave it enabled.&lt;br /&gt;
&lt;br /&gt;
If your recipe is unlocked by a technology, you should set this to &amp;quot;false&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hidden|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from crafting menus.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hide_from_stats|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from flow stats (item/fluid production statistics).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hide_from_player_crafting|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from the player&#039;s crafting screen. The recipe will still show up for selection in machines.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_decomposition|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether this recipe is allowed to be broken down for the recipe tooltip &amp;quot;Total raw&amp;quot; calculations.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_as_intermediate|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe can be used as an intermediate recipe in hand-crafting.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_intermediates|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe is allowed to use intermediate recipes when hand-crafting.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|always_show_made_in|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Whether the &amp;quot;Made in: {Machine}&amp;quot; part of the tool-tip should always be present, not only when the recipe can not be hand-crafted.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|show_amount_in_title|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe name should have the product amount in front of it, e.g. &amp;quot;2 [[transport belt]]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|always_show_products|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Whether the products are always shown in the recipe tool-tip.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|unlock_results|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether enabling this recipe unlocks its item products to show in selection lists (item filter, logistic request etc.).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|main_product|[[Types/string|string]]|optional=true}}&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
For recipes with more than one product: The recipe takes that product&#039;s localised_name, localised_description, icon, and subgroup.&lt;br /&gt;
&lt;br /&gt;
For recipes with one product (&amp;lt;code&amp;gt;results&amp;lt;/code&amp;gt; with one product or &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt;): The recipe uses the localised_name, localised_description, icon, and subgroup of the product.&lt;br /&gt;
&lt;br /&gt;
If 1) there are multiple products and this property is nil, 2) this property is set to an empty string (&amp;lt;code&amp;gt;&amp;quot;&amp;quot;&amp;lt;/code&amp;gt;), or 3) there are no products, the recipe will use the localised_name, localised_description, icon, and subgroup of the recipe. icon and subgroup become non-optional.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;iron-plate&amp;quot; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-plate&amp;quot;,&lt;br /&gt;
    category = &amp;quot;smelting&amp;quot;,&lt;br /&gt;
    energy_required = 3.5,&lt;br /&gt;
    ingredients = {{&amp;quot;iron-ore&amp;quot;, 1}},&lt;br /&gt;
    result = &amp;quot;iron-plate&amp;quot;&lt;br /&gt;
  }&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;coal-liquefaction&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{&lt;br /&gt;
  type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
  name = &amp;quot;coal-liquefaction&amp;quot;,&lt;br /&gt;
  category = &amp;quot;oil-processing&amp;quot;,&lt;br /&gt;
  subgroup = &amp;quot;fluid-recipes&amp;quot;,&lt;br /&gt;
  order = &amp;quot;a[oil-processing]-c[coal-liquefaction]&amp;quot;,&lt;br /&gt;
  enabled = false,&lt;br /&gt;
  energy_required = 5,&lt;br /&gt;
  icon = &amp;quot;__base__/graphics/icons/fluid/coal-liquefaction.png&amp;quot;,&lt;br /&gt;
  icon_size = 32,&lt;br /&gt;
  ingredients =&lt;br /&gt;
  {&lt;br /&gt;
    {type=&amp;quot;item&amp;quot;, name=&amp;quot;coal&amp;quot;, amount=10},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=25},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;steam&amp;quot;, amount=50}&lt;br /&gt;
  },&lt;br /&gt;
  results=&lt;br /&gt;
  {&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=35},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;light-oil&amp;quot;, amount=15},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;petroleum-gas&amp;quot;, amount=20}&lt;br /&gt;
  },&lt;br /&gt;
  allow_decomposition = false&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;iron-gear-wheel&amp;quot; — recipe with difficulty ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 2}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modified so that it cannot be crafted in normal mode, unless unlocked via command/research ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal = false,&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modified so that the expensive recipe is always used, even in normal mode ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal = nil, --this line can be omitted&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Prototype/Recipe&amp;diff=191219</id>
		<title>Prototype/Recipe</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Prototype/Recipe&amp;diff=191219"/>
		<updated>2023-04-06T08:55:23Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Recipe data */ re-describe main_product for clearer logic and more cases&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Prototype parent|PrototypeBase}}&lt;br /&gt;
A recipe. It can be a crafting recipe, a smelting recipe, or a custom type of recipe (see [[Prototype/RecipeCategory]]).&lt;br /&gt;
&lt;br /&gt;
{{Prototype TOC|recipe}}&lt;br /&gt;
&lt;br /&gt;
== General properties ==&lt;br /&gt;
Inherits all properties from [[PrototypeBase]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|category|[[Types/string|string]]|&amp;quot;crafting&amp;quot;|optional=true}}&lt;br /&gt;
Optional. Name of a [[Prototype/RecipeCategory]]. The category of the recipe is used to control which machines can craft the recipe. The built-in categories can be found [[Data.raw#recipe-category|here]].&lt;br /&gt;
&lt;br /&gt;
The recipe category &amp;quot;crafting&amp;quot; cannot contain recipes with fluid ingredients or products.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|subgroup|[[Types/string|string]]||optional=true}}&lt;br /&gt;
Optional. Name of a [[Prototype/ItemSubGroup]]. The subgroup of this recipe. If not specified, defaults to the subgroup of the product if there is only 1, or main_product if multiple products exist. If multiple products exist and no main_product is specified, the subgroup is required.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|icons, icon,  icon_size (IconSpecification)|[[Types/IconSpecification|IconSpecification]]|optional=true}}&lt;br /&gt;
An icon is mandatory for recipe with more than 1 product and no main_product. Otherwise defaults to the icon of main_product/1 product.&lt;br /&gt;
&lt;br /&gt;
If given, it overwrites the icon of the main_product/1 product.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|crafting_machine_tint|[[Types/table|table]] of [[Types/Color|Color]]|optional=true}}&lt;br /&gt;
Optional. Used by crafting machine &amp;lt;code&amp;gt;[[Prototype/CraftingMachine#working_visualisations|working_visualisations]]&amp;lt;/code&amp;gt; to tint certain layers with the recipe color. [[Types/WorkingVisualisation#apply_recipe_tint|apply_recipe_tint]] on the working visualisation determines which of the 4 colors is used for that layer (if any).&lt;br /&gt;
&lt;br /&gt;
Format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;crafting_machine_tint = { primary = {r=0,g=0,b=0,a=0}, secondary = {r=0,g=0,b=0,a=0}, tertiary = {r=0,g=0,b=0,a=0}, quaternary = {r=0,g=0,b=0,a=0}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each key/value pair is optional and defaults to the above value.&lt;br /&gt;
&lt;br /&gt;
== Recipe data ==&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
Anchor and property for the TOC at the top --&amp;gt;&amp;lt;span id=&amp;quot;normal&amp;quot;&amp;gt;{{#subobject:normal&lt;br /&gt;
 |Prototype property name=normal&lt;br /&gt;
 |Prototype property type=[[Prototype/Recipe#Recipe_data|Recipe data]] or [[Types/bool|bool]]&lt;br /&gt;
 |Prototype property optional=true&lt;br /&gt;
 |Prototype property pagename={{FULLPAGENAME}}&lt;br /&gt;
}}&amp;lt;/span&amp;gt;&amp;lt;!-- &lt;br /&gt;
Anchor and property for the TOC at the top --&amp;gt;&amp;lt;span id=&amp;quot;expensive&amp;quot;&amp;gt;{{#subobject:expensive&lt;br /&gt;
 |Prototype property name=expensive&lt;br /&gt;
 |Prototype property type=[[Prototype/Recipe#Recipe_data|Recipe data]] or [[Types/bool|bool]]&lt;br /&gt;
 |Prototype property optional=true&lt;br /&gt;
 |Prototype property pagename={{FULLPAGENAME}}&lt;br /&gt;
}}&amp;lt;/span&amp;gt;&amp;lt;!-- &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
If the recipe does not have a difficulty, this is located directly in the prototype. Otherwise, if the &amp;quot;&#039;&#039;&#039;normal&#039;&#039;&#039;&amp;quot; or &amp;quot;&#039;&#039;&#039;expensive&#039;&#039;&#039;&amp;quot; property exists, the recipe has difficulty. Then, the recipe data has to be specified for each difficulty instead of directly in the prototype. If at least one difficulty has recipe data defined, the other difficulty can be set to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. This will disable the recipe for the difficulty, same as setting it &amp;lt;code&amp;gt;enabled = false&amp;lt;/code&amp;gt;. If it is enabled (by technologies etc), it will use the data from the other difficulty. Not setting a difficulty, e.g. &amp;lt;code&amp;gt;normal = nil&amp;lt;/code&amp;gt;, is possible and gives that difficulty the exact same properties as the difficulty that is defined. Setting one or both difficulties to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; is not valid and will produce an error. See below for examples of difficulty.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ingredients|[[Types/table|table]] of [[Types/IngredientPrototype|IngredientPrototype]]}}&lt;br /&gt;
A table containing ingredient names and counts. Can also contain information about fluid temperature and catalyst amounts. The catalyst amounts are automatically calculated from the recipe, or can be set manually in the [[Types/IngredientPrototype|IngredientPrototype]].&amp;lt;sup&amp;gt;[https://factorio.com/blog/post/fff-256]&amp;lt;/sup&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Maximum ingredient amount is 65535.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ingredients&amp;lt;/code&amp;gt; can be set to an empty table  to create a recipe that needs no ingredients.&amp;lt;br&amp;gt;&lt;br /&gt;
Duplicate ingredients, e.g. two entries for the &amp;quot;wood&amp;quot; item, are &#039;&#039;not&#039;&#039; allowed.&amp;lt;br&amp;gt;&lt;br /&gt;
In-game, the item ingredients are ordered by [[Prototype/ItemGroup#order_in_recipe|item group order_in_recipe]].&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{&amp;quot;iron-stick&amp;quot;, 2}, {&amp;quot;iron-plate&amp;quot;, 3}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The same with full format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-stick&amp;quot;, amount = 2}, {type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-plate&amp;quot;, amount = 3}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
For fluids, the full format always has to be used:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{type=&amp;quot;fluid&amp;quot;, name=&amp;quot;water&amp;quot;, amount=50}, {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;crude-oil&amp;quot;, amount=100}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|result|[[Types/string|string]]|optional=true}}&lt;br /&gt;
Can be replaced with the results parameter. The item created by this recipe. Must be the name of an item, such as &amp;quot;iron-gear-wheel&amp;quot;.&lt;br /&gt;
Note that &amp;lt;code&amp;gt;results&amp;lt;/code&amp;gt; takes priority over &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt;. So if a recipe has both keys set, &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt; will be ignored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|result_count|[[Types/uint32|uint32]]|1|optional=true}}&lt;br /&gt;
Optional. The number of items created by this recipe.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|results|[[Types/table|table]] of [[Types/ProductPrototype|ProductPrototype]]|optional=true}}&lt;br /&gt;
A table containing result names and counts. Can also contain information about fluid temperature and catalyst amounts. The catalyst amounts are automatically calculated from the recipe, or can be set manually in the [[Types/ProductPrototype|ProductPrototype]].&amp;lt;sup&amp;gt;[https://factorio.com/blog/post/fff-256]&amp;lt;/sup&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;results&amp;lt;/code&amp;gt; can be set to an empty table to create a recipe that produces nothing.&amp;lt;br&amp;gt;&lt;br /&gt;
Duplicate results, e.g. two entries for the &amp;quot;iron-plate&amp;quot; item, are allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results=&lt;br /&gt;
    {&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=3},&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;light-oil&amp;quot;, amount=3},&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;petroleum-gas&amp;quot;, amount=4}&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results = &lt;br /&gt;
    {&lt;br /&gt;
      {type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-nuggets&amp;quot;, amount = 9},&lt;br /&gt;
      {type = &amp;quot;item&amp;quot;, name = &amp;quot;gold-nuggets&amp;quot;, amount = 1}&lt;br /&gt;
     },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results = &lt;br /&gt;
    {&lt;br /&gt;
      {type = &amp;quot;fluid&amp;quot;, name = &amp;quot;steam&amp;quot;, amount = 1, temperature = 165}&lt;br /&gt;
     },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|energy_required|[[Types/double|double]]|0.5|optional=true}}&lt;br /&gt;
Optional. The amount of time it takes to make this recipe. Must be greater than 0.001.&lt;br /&gt;
&lt;br /&gt;
This is the number of seconds it takes to craft at crafting speed 1.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|emissions_multiplier|[[Types/double|double]]|1.0|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|requester_paste_multiplier|[[Types/uint32|uint32]]|30|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|overload_multiplier|[[Types/uint32|uint32]]|0|optional=true}}&lt;br /&gt;
Used to determine how many extra items are put into an assembling machine before it&#039;s considered &amp;quot;full enough&amp;quot;. See [[Inserters#Insertion_limits]].&lt;br /&gt;
&lt;br /&gt;
If set to 0, it instead uses the following formula: 1.166 / (energy_required / the assembler&#039;s crafting_speed), rounded up, and clamped between 2 and 100. The numbers used in this formula can be changed by the [[Prototype/UtilityConstants]] dynamic_recipe_overload_factor, minimum_recipe_overload_multiplier and maximum_recipe_overload_multiplier.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_inserter_overload|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
If the recipe is allowed to have the extra inserter overload bonus applied (4 * stack inserter stack size).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|enabled|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. This can be false to disable the recipe at the start of the game, or &amp;quot;true&amp;quot; to leave it enabled.&lt;br /&gt;
&lt;br /&gt;
If your recipe is unlocked by a technology, you should set this to &amp;quot;false&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hidden|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from crafting menus.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hide_from_stats|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from flow stats (item/fluid production statistics).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hide_from_player_crafting|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from the player&#039;s crafting screen. The recipe will still show up for selection in machines.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_decomposition|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether this recipe is allowed to be broken down for the recipe tooltip &amp;quot;Total raw&amp;quot; calculations.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_as_intermediate|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe can be used as an intermediate recipe in hand-crafting.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_intermediates|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe is allowed to use intermediate recipes when hand-crafting.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|always_show_made_in|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Whether the &amp;quot;Made in: {Machine}&amp;quot; part of the tool-tip should always be present, not only when the recipe can not be hand-crafted.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|show_amount_in_title|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe name should have the product amount in front of it, e.g. &amp;quot;2 [[transport belt]]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|always_show_products|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Whether the products are always shown in the recipe tool-tip.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|unlock_results|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether enabling this recipe unlocks its item products to show in selection lists (item filter, logistic request etc.).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|main_product|[[Types/string|string]]|optional=true}}&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
For recipes with more than one product: The recipe takes that product&#039;s localised_name, localised_description, icon, and subgroup.&lt;br /&gt;
&lt;br /&gt;
For recipes with one product (&amp;lt;code&amp;gt;results&amp;lt;/code&amp;gt; with one product or &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt;): The recipe uses the localised_name, localised_description, icon, and subgroup of the product.&lt;br /&gt;
&lt;br /&gt;
If 1) there are multiple products and this property is nil, 2) this property is set to an empty string (&amp;lt;code&amp;gt;&amp;quot;&amp;quot;&amp;lt;/code&amp;gt;), or 3) there are no products, the recipe will use the localised_name, localised_description, icon, and subgroup of the recipe. icon and subgroup become non-optional.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;iron-plate&amp;quot; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-plate&amp;quot;,&lt;br /&gt;
    category = &amp;quot;smelting&amp;quot;,&lt;br /&gt;
    energy_required = 3.5,&lt;br /&gt;
    ingredients = {{&amp;quot;iron-ore&amp;quot;, 1}},&lt;br /&gt;
    result = &amp;quot;iron-plate&amp;quot;&lt;br /&gt;
  }&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;coal-liquefaction&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{&lt;br /&gt;
  type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
  name = &amp;quot;coal-liquefaction&amp;quot;,&lt;br /&gt;
  category = &amp;quot;oil-processing&amp;quot;,&lt;br /&gt;
  subgroup = &amp;quot;fluid-recipes&amp;quot;,&lt;br /&gt;
  order = &amp;quot;a[oil-processing]-c[coal-liquefaction]&amp;quot;,&lt;br /&gt;
  enabled = false,&lt;br /&gt;
  energy_required = 5,&lt;br /&gt;
  icon = &amp;quot;__base__/graphics/icons/fluid/coal-liquefaction.png&amp;quot;,&lt;br /&gt;
  icon_size = 32,&lt;br /&gt;
  ingredients =&lt;br /&gt;
  {&lt;br /&gt;
    {type=&amp;quot;item&amp;quot;, name=&amp;quot;coal&amp;quot;, amount=10},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=25},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;steam&amp;quot;, amount=50}&lt;br /&gt;
  },&lt;br /&gt;
  results=&lt;br /&gt;
  {&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=35},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;light-oil&amp;quot;, amount=15},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;petroleum-gas&amp;quot;, amount=20}&lt;br /&gt;
  },&lt;br /&gt;
  allow_decomposition = false&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;iron-gear-wheel&amp;quot; — recipe with difficulty ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 2}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modified so that it cannot be crafted in normal mode, unless unlocked via command/research ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal = false,&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modified so that the expensive recipe is always used, even in normal mode ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal = nil, --this line can be omitted&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Prototype/BlueprintBook&amp;diff=191147</id>
		<title>Prototype/BlueprintBook</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Prototype/BlueprintBook&amp;diff=191147"/>
		<updated>2023-03-25T01:19:43Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Mandatory values */ better dynamic description?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Prototype parent|Prototype/ItemWithInventory}}&lt;br /&gt;
A [[blueprint book]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype TOC|blueprint-book|no-properties=true}}&lt;br /&gt;
&lt;br /&gt;
== Mandatory values ==&lt;br /&gt;
Blueprint books must have a stack size of 1.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|inventory_size|[[Types/ItemStackIndex|ItemStackIndex]] or [[Types/string|string]]}}&lt;br /&gt;
The inventory size of the item. The only accepted string is &amp;quot;dynamic&amp;quot;. If &amp;quot;dynamic&amp;quot;, the size of the LuaInventory object is the last occupied blueprint / book slot.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Prototype/BlueprintBook&amp;diff=191146</id>
		<title>Prototype/BlueprintBook</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Prototype/BlueprintBook&amp;diff=191146"/>
		<updated>2023-03-25T01:17:58Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Mandatory values */ &amp;quot;dynamic&amp;quot; inventory size&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Prototype parent|Prototype/ItemWithInventory}}&lt;br /&gt;
A [[blueprint book]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype TOC|blueprint-book|no-properties=true}}&lt;br /&gt;
&lt;br /&gt;
== Mandatory values ==&lt;br /&gt;
Blueprint books must have a stack size of 1.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|inventory_size|[[Types/ItemStackIndex|ItemStackIndex]] or [[Types/string|&amp;quot;dynamic&amp;quot;]]}}&lt;br /&gt;
The inventory size of the item. If &amp;quot;dynamic&amp;quot;, the size of the LuaInventory object is the last occupied blueprint / book slot.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Prototype/CraftingMachine&amp;diff=191108</id>
		<title>Prototype/CraftingMachine</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Prototype/CraftingMachine&amp;diff=191108"/>
		<updated>2023-03-22T20:18:25Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Optional properties */ idle animation grammar, split sentence&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Prototype parent|Prototype/EntityWithOwner}}&lt;br /&gt;
The abstract basis of the assembling machines and furnaces. Contains the properties that both of them have.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
{{Prototype TOC|&#039;&#039;abstract&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Extensions ==&lt;br /&gt;
&lt;br /&gt;
* [[Prototype/AssemblingMachine]] &#039;&#039;&#039;assembling-machine&#039;&#039;&#039;&lt;br /&gt;
** [[Prototype/RocketSilo]] &#039;&#039;&#039;rocket-silo&#039;&#039;&#039;&lt;br /&gt;
* [[Prototype/Furnace]] &#039;&#039;&#039;furnace&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
This prototype inherits all the properties from [[Prototype/EntityWithOwner]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|energy_usage|[[Types/Energy|Energy]]}}&lt;br /&gt;
Sets how much energy this machine uses while crafting. Energy usage has to be positive.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|crafting_speed|[[Types/double|double]]}}&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Crafting speed has to be positive.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|crafting_categories|[[Types/table|table]] of [[Types/string|string]]s}}&lt;br /&gt;
A list of [[Prototype/RecipeCategory|recipe categories]] this crafting machine can use.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crafting_categories = {&amp;quot;crafting&amp;quot;, &amp;quot;smelting&amp;quot;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|energy_source|[[Types/EnergySource|EnergySource]]}}&lt;br /&gt;
Defines how the crafting machine is powered.&lt;br /&gt;
&lt;br /&gt;
When using an electric energy source and &amp;lt;code&amp;gt;drain&amp;lt;/code&amp;gt; is not specified, it will be set to &amp;lt;code&amp;gt;energy_usage ÷ 30&amp;lt;/code&amp;gt; automatically.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|fluid_boxes|[[Types/table|table]] of [[Types/FluidBox|FluidBox]]|optional=true}}&lt;br /&gt;
Can have off_when_no_fluid_recipe key that has a [[Types/bool|bool]] value. off_when_no_fluid_recipe defaults to false. off_when_no_fluid_recipe is ignored by [[Prototype/Furnace]]s and considered to always be false.&lt;br /&gt;
&lt;br /&gt;
If a crafting machine has fluid boxes &#039;&#039;and&#039;&#039; 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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;fluid_boxes =&lt;br /&gt;
    {&lt;br /&gt;
      {&lt;br /&gt;
        production_type = &amp;quot;input&amp;quot;,&lt;br /&gt;
        pipe_picture = assembler2pipepictures(),&lt;br /&gt;
        pipe_covers = pipecoverspictures(),&lt;br /&gt;
        base_area = 10,&lt;br /&gt;
        base_level = -1,&lt;br /&gt;
        pipe_connections = {{ type=&amp;quot;input&amp;quot;, position = {0, -2} }},&lt;br /&gt;
        secondary_draw_orders = { north = -1 }&lt;br /&gt;
      },&lt;br /&gt;
      {&lt;br /&gt;
        production_type = &amp;quot;output&amp;quot;,&lt;br /&gt;
        pipe_picture = assembler2pipepictures(),&lt;br /&gt;
        pipe_covers = pipecoverspictures(),&lt;br /&gt;
        base_area = 10,&lt;br /&gt;
        base_level = 1,&lt;br /&gt;
        pipe_connections = {{ type=&amp;quot;output&amp;quot;, position = {0, 2} }},&lt;br /&gt;
        secondary_draw_orders = { north = -1 }&lt;br /&gt;
      },&lt;br /&gt;
      off_when_no_fluid_recipe = true&lt;br /&gt;
    },&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allowed_effects|[[Types/EffectTypeLimitation|EffectTypeLimitation]]|No effects are allowed|optional=true}}&lt;br /&gt;
Sets the module effects that are allowed to be used on this machine.&lt;br /&gt;
&lt;br /&gt;
Note: If the time to complete a recipe is shorter than one tick, only one craft can be completed per tick, but productivity bonus is applied to the non-limited &#039;&#039;completable&#039;&#039; work. For a simple example, if a recipe were to take half a tick, only one recipe would be completed, but twice the productivity bonus would occur. The surplus production from productivity is &#039;&#039;&#039;not&#039;&#039;&#039; limited to one craft per tick.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|scale_entity_info_icon|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Whether the &amp;quot;alt-mode icon&amp;quot; should be scaled to the size of the machine.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|show_recipe_icon|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Whether the &amp;quot;alt-mode icon&amp;quot; should be drawn at all.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|return_ingredients_on_change|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|animation|[[Types/Animation4Way|Animation4Way]]|optional=true}}&lt;br /&gt;
The animation played when crafting. When the crafting machine is idle, the animation will be paused.&lt;br /&gt;
&lt;br /&gt;
When a crafting machine cannot be rotated, only the north rotation of the animation will be used.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;animation_speed&amp;lt;/code&amp;gt; of the animation is divided by 2 by the game. For example, the default animation speed of 1 means one animation frame per 2 ticks (30 fps) instead of the usual 60 fps.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|idle_animation|[[Types/Animation4Way|Animation4Way]]|optional=true}}&lt;br /&gt;
Idle animation must have the same frame count as animation. It is used for drawing the machine in the idle state. The animation is frozen on a single frame when the machine is idle.&amp;lt;br&amp;gt;&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
When a crafting machine cannot be rotated, only the north rotation of the idle animation will be used.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;animation_speed&amp;lt;/code&amp;gt; of the animation is divided by 2 by the game. For example, the default animation speed of 1 means one animation frame per 2 ticks (30 fps) instead of the usual 60 fps.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|always_draw_idle_animation|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Only loaded if &amp;lt;code&amp;gt;idle_animation&amp;lt;/code&amp;gt; is present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|default_recipe_tint|[[Types/table|table]] of [[Types/Color|Color]]|optional=true}}&lt;br /&gt;
Format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;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}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Each key/value pair is optional and defaults to the above value.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|shift_animation_waypoints|[[Types/table|table]] of [[Types/table|table]] (array) of [[Types/vector|vector]]|optional=true}}&lt;br /&gt;
Table with the following optional key/value pairs:&lt;br /&gt;
* north - [[Types/table|array]] of [[Types/vector|vector]]&lt;br /&gt;
* east - [[Types/table|array]] of [[Types/vector|vector]]&lt;br /&gt;
* south - [[Types/table|array]] of [[Types/vector|vector]]&lt;br /&gt;
* west - [[Types/table|array]] of [[Types/vector|vector]]&lt;br /&gt;
&lt;br /&gt;
Only loaded if one of &amp;lt;code&amp;gt;shift_animation_waypoint_stop_duration&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;shift_animation_transition_duration&amp;lt;/code&amp;gt; is not 0.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|shift_animation_waypoint_stop_duration|[[Types/uint16|uint16]]|0|optional=true}}&lt;br /&gt;
Only loaded if &amp;lt;code&amp;gt;shift_animation_waypoints&amp;lt;/code&amp;gt; is present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|shift_animation_transition_duration |[[Types/uint16|uint16]]|0|optional=true}}&lt;br /&gt;
Only loaded if &amp;lt;code&amp;gt;shift_animation_waypoints&amp;lt;/code&amp;gt; is present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|status_colors|[[Types/table|table]] of [[Types/Color|Color]]|optional=true}}&lt;br /&gt;
Table with the following optional key/value pairs:&lt;br /&gt;
* idle - [[Types/Color|Color]] - Default: White&lt;br /&gt;
* no_minable_resources - [[Types/Color|Color]] - Default: &amp;lt;code&amp;gt;idle&amp;lt;/code&amp;gt;&lt;br /&gt;
* full_output - [[Types/Color|Color]] - Default: &amp;lt;code&amp;gt;idle&amp;lt;/code&amp;gt;&lt;br /&gt;
* insufficient_input - [[Types/Color|Color]] - Default: &amp;lt;code&amp;gt;idle&amp;lt;/code&amp;gt;&lt;br /&gt;
* disabled - [[Types/Color|Color]] - Default: &amp;lt;code&amp;gt;idle&amp;lt;/code&amp;gt;&lt;br /&gt;
* no_power - [[Types/Color|Color]] - Default: No color&lt;br /&gt;
* working - [[Types/Color|Color]] - Default: White &lt;br /&gt;
* low_power - [[Types/Color|Color]] - Default: &amp;lt;code&amp;gt;working&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Used by [[Types/WorkingVisualisation#apply_tint]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|entity_info_icon_shift|[[Types/vector|vector]]|&amp;lt;nowiki&amp;gt;{0, -0.3}&amp;lt;/nowiki&amp;gt; for [[Prototype/AssemblingMachine]] and &amp;lt;nowiki&amp;gt;{0, -0.1}&amp;lt;/nowiki&amp;gt; for [[Prototype/Furnace]]|optional=true}}&lt;br /&gt;
Shift of the &amp;quot;alt-mode icon&amp;quot; relative to the machine&#039;s center.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|draw_entity_info_icon_background|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Whether the &amp;quot;alt-mode icon&amp;quot; should have a black background.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|match_animation_speed_to_activity|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Whether the speed of the animation and working visualization should be based on the machine&#039;s speed (boosted or slowed by modules).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|show_recipe_icon_on_map|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Whether the recipe icon should be shown on the map.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|base_productivity|[[Types/float|float]]|0|optional=true}}&lt;br /&gt;
Productivity bonus that this machine always has.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|module_specification|[[Types/ModuleSpecification|ModuleSpecification]]|optional=true}}&lt;br /&gt;
The number of module slots in this machine, and their icon positions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;module_specification = {&lt;br /&gt;
  module_info_icon_shift = {&lt;br /&gt;
    0,&lt;br /&gt;
    0.8&lt;br /&gt;
  },&lt;br /&gt;
  module_slots = 2&lt;br /&gt;
},&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|working_visualisations|[[Types/table|table]] of [[Types/WorkingVisualisation|WorkingVisualisation]]|optional=true}}&lt;br /&gt;
Used to display different animations when the machine is running, for example tinted based on the current recipe.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;animation_speed&amp;lt;/code&amp;gt; of the animations is divided by 2 by the game. For example, the default animation speed of 1 means one animation frame per 2 ticks (30 fps) instead of the usual 60 fps.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/ItemProductPrototype&amp;diff=191070</id>
		<title>Types/ItemProductPrototype</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/ItemProductPrototype&amp;diff=191070"/>
		<updated>2023-03-11T01:59:06Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* probability */ the case of amount and no min or max&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__An item product definition, for example for a [[Prototype/Recipe]]. Its loading is triggered by the &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; of a [[Types/ProductPrototype]] being &amp;quot;item&amp;quot;. It can be specified as a table with named or numbered keys, but not a mix of both.&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
&lt;br /&gt;
=== name or 1 ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
The name of a [[Prototype/Item]].&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
&lt;br /&gt;
=== amount or 2 ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint16]]&lt;br /&gt;
&lt;br /&gt;
Mandatory when using numbered keys (an array).&amp;lt;br&amp;gt;&lt;br /&gt;
If &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; is present, &amp;lt;code&amp;gt;amount_min&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;amount_max&amp;lt;/code&amp;gt; are not loaded.&lt;br /&gt;
&lt;br /&gt;
=== probability ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Value between 0 and 1, 0 for 0% chance and 1 for 100% chance.&lt;br /&gt;
&lt;br /&gt;
The effect of probability is no product, or, a linear distribution on [min, max]. For a recipe with probability p, amount_min min, and amount_max max, the Expected Value of this &#039;&#039;&#039;product&#039;&#039;&#039; can be expressed as &amp;lt;code&amp;gt;p * (0.5 * (max + min))&amp;lt;/code&amp;gt;. This is what will be shown in a recipe tooltip. The effect of &amp;lt;code&amp;gt;catalyst_amount&amp;lt;/code&amp;gt; on the product is not shown.&lt;br /&gt;
&lt;br /&gt;
When amount_min and amount_max are not provided, &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; applies as min and max. The Expected Value simplifies to &amp;lt;code&amp;gt;p*amount&amp;lt;/code&amp;gt;, providing 0 product, or, &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; product, on recipe completion.&lt;br /&gt;
&lt;br /&gt;
=== amount_min ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint16]]&lt;br /&gt;
&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; is not specified and named keys are being used.&lt;br /&gt;
&lt;br /&gt;
=== amount_max ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint16]]&lt;br /&gt;
&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; is not specified and named keys are being used.&lt;br /&gt;
&lt;br /&gt;
If set to a number that is less than &amp;lt;code&amp;gt;amount_min&amp;lt;/code&amp;gt;, the game will use &amp;lt;code&amp;gt;amount_min&amp;lt;/code&amp;gt; internally.&lt;br /&gt;
&lt;br /&gt;
=== catalyst_amount ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint16]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Amount that should not be affected by productivity modules (not yielded from bonus production) and should not be included in the item production statistics.&lt;br /&gt;
&lt;br /&gt;
If this ItemProductPrototype is used in a recipe, the catalyst amount is calculated automatically based on the [[Prototype/Recipe#ingredients|ingredients]] and [[Prototype/Recipe#results|results]].[https://factorio.com/blog/post/fff-256]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Types/ProductPrototype]]&lt;br /&gt;
* [[Types/FluidProductPrototype]]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Mod_settings&amp;diff=190966</id>
		<title>Tutorial:Mod settings</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Mod_settings&amp;diff=190966"/>
		<updated>2023-03-06T20:41:34Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* color-setting */ a setting exists in data, removed reference to control&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
This tutorial aims to explain how to create and use mod settings. Basic knowledge of modding is assumed, so you should have at least understood [[Tutorial:Modding tutorial/Gangsir|Gangsir&#039;s modding tutorial]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Each mod can specify settings that users can change. The values of these settings can be accessed from inside the data stage or the control stage depending on their [[#The_setting_type_property|setting_type]] and allow to conditionally create or modify prototypes and to add configuration options to control scripts. They allow modders to easily create a graphical interface for their configuration options, instead of using on text files that have to be edited manually by users.&lt;br /&gt;
&lt;br /&gt;
== Location ==&lt;br /&gt;
&lt;br /&gt;
Mod settings are defined in the [https://lua-api.factorio.com/latest/Data-Lifecycle.html settings stage]. This stage is loaded before the data stage. There are three files in which settings can be defined:&lt;br /&gt;
* settings.lua&lt;br /&gt;
* settings-updates.lua&lt;br /&gt;
* settings-final-fixes.lua&lt;br /&gt;
&lt;br /&gt;
First the settings.lua file is called for each mod, in the order of their dependencies and then in the [[:Wikipedia:natural sort order|natural sort order]]. After settings.lua has been called for all mods, the settings-updates.lua file is called for each mod &amp;lt;sup&amp;gt;(in the same order)&amp;lt;/sup&amp;gt; and finally the settings-final-fixes.lua file is called for each mod &amp;lt;sup&amp;gt;(in the same order)&amp;lt;/sup&amp;gt;. These 3 different phases of the settings stage allow to change settings of other mods without needing to rely on dependencies to load last. The settings are all defined in the same stage and their user defined values are not available, therefore mods cannot conditionally create settings depending on the values of other mod settings. Since the settings stage gets loaded first, there is also no prototype data or [http://lua-api.factorio.com/latest/LuaRemote.html remote interface] available.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;mod-settings.dat&amp;quot; file stored in the [[Application_directory#User_Data_directory|mods folder]] for the game contains the local players settings between game sessions similar to the player-data.json file.&lt;br /&gt;
&lt;br /&gt;
== Creation ==&lt;br /&gt;
&lt;br /&gt;
Mod settings are defined and modified by using the data table during the settings stage. This works [[Tutorial:Modding_tutorial/Gangsir#Prototype_creation|the same way as other prototypes]]. An example would be:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;bool-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-test-setting&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = true&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the setting has multiple properties. Each setting supports the following standard prototype properties:&lt;br /&gt;
* name - [[Types/string|string]] - Mandatory.&lt;br /&gt;
* type - [[Types/string|string]] - Mandatory.&lt;br /&gt;
* localised_name - [[Types/LocalisedString|LocalisedString]] - Optional.&lt;br /&gt;
* localised_description - [[Types/LocalisedString|LocalisedString]] - Optional.&lt;br /&gt;
* [[Types/Order|order]] - [[Types/string|string]] - Optional.&lt;br /&gt;
&lt;br /&gt;
In addition to the standard properties, mod settings also contain:&lt;br /&gt;
&lt;br /&gt;
* hidden - [[Types/bool|bool]] - Optional.&lt;br /&gt;
* setting_type - [[Types/string|string]] - Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== The name property ===&lt;br /&gt;
&lt;br /&gt;
The name of the settings prototype should be unique to avoid mod conflicts since the mod settings are global across all mods. Because of that it is recommened to prefix mod settings with your mod name, &amp;quot;my-mod&amp;quot; in this example.&lt;br /&gt;
&lt;br /&gt;
=== The type property ===&lt;br /&gt;
&lt;br /&gt;
There are four types of mod settings:&lt;br /&gt;
&lt;br /&gt;
* bool-setting - a true/false checkbox&lt;br /&gt;
* int-setting - a signed 64 bit integer textfield (or selection dropdown)&lt;br /&gt;
* double-setting - a double precision floating point textfield (or selection dropdown)&lt;br /&gt;
* string-setting - a string textfield (or selection dropdown)&lt;br /&gt;
* color-setting - a color picker (sliders), with whole number textfields. Includes alpha.&lt;br /&gt;
&lt;br /&gt;
Depending on the type, the prototype also allows or requires additional properties, these are listed below.&lt;br /&gt;
&lt;br /&gt;
==== bool-setting ====&lt;br /&gt;
* default_value - [[Types/bool|bool]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting, in this case whether the checkbox is checked or not.&lt;br /&gt;
* forced_value - [[Types/bool|bool]] - Optional.&lt;br /&gt;
** Only loaded if &amp;lt;code&amp;gt;hidden = true&amp;lt;/code&amp;gt;. This forces the setting to be of this value. This can be useful for mod compatiblity.&amp;lt;sup&amp;gt;[https://forums.factorio.com/viewtopic.php?p=531322#p531322]&lt;br /&gt;
&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== int-setting ====&lt;br /&gt;
* default_value - [[Types/int64|int64]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* minimum_value - [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Defines the lowest possible number.&lt;br /&gt;
* maximum_value - [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Defines the highest possible number.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a texfield.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== double-setting ====&lt;br /&gt;
* default_value - [[Types/double|double]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* minimum_value - [[Types/double|double]] - Optional.&lt;br /&gt;
** Defines the lowest possible number.&lt;br /&gt;
* maximum_value - [[Types/double|double]] - Optional.&lt;br /&gt;
** Defines the highest possible number.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/double|double]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a textfield.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== string-setting ====&lt;br /&gt;
* default_value - [[Types/string|string]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* allow_blank - [[Types/bool|bool]] - Optional. - Default: false&lt;br /&gt;
** Defines whether it&#039;s possible for the user to set the textfield to empty and apply the setting.&lt;br /&gt;
* auto_trim - [[Types/bool|bool]] - Optional. - Default: false&lt;br /&gt;
** Whether values that are input by the user should have whitespace removed from both ends of the string.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/string|string]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined strings, creates a dropdown instead of a textfield. The strings in the dropdown can be localized (translated) and can have a tooltip, see below.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== color-setting ====&lt;br /&gt;
* default_value = [[Types/Color|color]] - Mandatory.&lt;br /&gt;
** Default color to set. When read, the color has &#039;r&#039;, &#039;g&#039;, &#039;b&#039;, &#039;a&#039; keys and values [0, 1]&lt;br /&gt;
&lt;br /&gt;
=== The order property ===&lt;br /&gt;
&lt;br /&gt;
The order property can be used to change how the mod settings are ordered in the settings gui. Mod settings are sorted&lt;br /&gt;
* first by mod&lt;br /&gt;
* then by the setting &amp;quot;order&amp;quot; string&lt;br /&gt;
* then finally by the setting name.&lt;br /&gt;
&lt;br /&gt;
For more info on how to use the order string, see [[Types/Order]].&lt;br /&gt;
&lt;br /&gt;
=== The hidden property ===&lt;br /&gt;
&lt;br /&gt;
The hidden property can be used to hide mod settings from GUIs, so that they cannot be seen or changed by players. However, other mods can still access hidden settings.&amp;lt;sup&amp;gt;[https://forums.factorio.com/83316]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The setting_type property ===&lt;br /&gt;
[[File:Mod_settings_gui.png|right|300px|thumb|The mod settings gui. Can be reached from the main menu → Settings → Mod settings.]]&lt;br /&gt;
There are the overall kinds of settings:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;startup&#039;&#039;&#039;: This kind of setting is available in the prototype stage, and can not be changed runtime. They have to be  set to the same values for all players on a server.&lt;br /&gt;
* &#039;&#039;&#039;runtime-global&#039;&#039;&#039;: This kind of setting is global to an entire save game and can be changed runtime. On servers, only admins can change these settings.&lt;br /&gt;
* &#039;&#039;&#039;runtime-per-user&#039;&#039;&#039;: This kind of setting is only available runtime in the control.lua stage and each player has their own instance of this setting. When a player joins a server their local setting of &amp;quot;keep mod settings per save&amp;quot; determines if the local settings they have set are synced to the loaded save or if the save&#039;s settings are used.&lt;br /&gt;
&lt;br /&gt;
This &amp;quot;setting_type&amp;quot; also determines in which tab the setting is showed in the mod settings menu.&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
The locale for mod settings works like any other locale in the game. The names of the groups for the setting name and description (tooltip) are &amp;quot;mod-setting-name&amp;quot; and &amp;quot;mod-setting-description&amp;quot;. The dropdown items of a string setting can be localized in the &amp;quot;string-mod-setting&amp;quot; group, but the game falls back to just showing the name of the dropdown item if no localization is found. An example for mod setting localization that would be set within &amp;quot;locale/en/locale.cfg&amp;quot;, is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mod-setting-name]&lt;br /&gt;
my-mod-test-setting=Localized test setting name&lt;br /&gt;
&lt;br /&gt;
[mod-setting-description]&lt;br /&gt;
my-mod-test-setting=Localized test setting description&lt;br /&gt;
&lt;br /&gt;
[string-mod-setting]&lt;br /&gt;
#&amp;lt;setting-name&amp;gt;-&amp;lt;dropdown-item-name&amp;gt;=&amp;lt;translated dropdown item&amp;gt;&lt;br /&gt;
my-mod-string-test-setting-item-1=Item 1 localized string&lt;br /&gt;
&lt;br /&gt;
[string-mod-setting-description]&lt;br /&gt;
#&amp;lt;setting-name&amp;gt;-&amp;lt;dropdown-item-name&amp;gt;=&amp;lt;tooltip of dropdown item&amp;gt;&lt;br /&gt;
my-mod-string-test-setting-item-1=Item 1 localized tooltip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
=== Reading settings ===&lt;br /&gt;
When accessing any mod setting, you will have to specifically access the &#039;&#039;value&#039;&#039; of the setting. The data type of the value depends on the type of the setting. For string settings that use a selection of allowed values, the value of the setting is one of the original string values defined in the prototype, the localization is ignored. See also: [http://lua-api.factorio.com/latest/Concepts.html#ModSetting ModSetting concept].&lt;br /&gt;
&lt;br /&gt;
In the prototype stage you can access settings of the setting_type &amp;quot;startup&amp;quot; by indexing &amp;lt;code&amp;gt;settings.startup&amp;lt;/code&amp;gt; with the name of the setting. Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;int-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-stone-wall-stack-size&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;startup&amp;quot;,&lt;br /&gt;
        minimum_value = 1,&lt;br /&gt;
        default_value = 100&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in data.lua:&lt;br /&gt;
data.raw.item[&amp;quot;stone-wall&amp;quot;].stack_size = settings.startup[&amp;quot;my-mod-stone-wall-stack-size&amp;quot;].value&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;plainlinks&amp;quot;&amp;gt;&lt;br /&gt;
In the control stage, the settings of the setting_type &amp;quot;runtime-global&amp;quot; can be accessed using &amp;lt;code&amp;gt;settings.global[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt; (see [https://lua-api.factorio.com/latest/LuaSettings.html LuaSettings]). Settings of the setting_type &amp;quot;runtime-per-user&amp;quot; are accessed using &amp;lt;code&amp;gt;settings.get_player_settings([https://lua-api.factorio.com/latest/Concepts.html#PlayerIdentification &amp;amp;lt;PlayerIdentification&amp;amp;gt;])[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;game.players[[https://lua-api.factorio.com/latest/Concepts.html#PlayerIdentification &amp;amp;lt;PlayerIdentification&amp;amp;gt;]].mod_settings[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;string-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-always-difficult&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = &amp;quot;yes&amp;quot;,&lt;br /&gt;
        allowed_values = {&amp;quot;yes&amp;quot;, &amp;quot;no&amp;quot;}&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;bool-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-kill-player-on-entity-built&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-per-user&amp;quot;,&lt;br /&gt;
        default_value = false&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in control.lua:&lt;br /&gt;
script.on_init(function()&lt;br /&gt;
    if settings.global[&amp;quot;my-mod-always-difficult&amp;quot;].value == &amp;quot;yes&amp;quot; then&lt;br /&gt;
        game.difficulty_settings.recipe_difficulty = 1&lt;br /&gt;
        game.difficulty_settings.technology_difficulty = 1&lt;br /&gt;
        game.difficulty_settings.technology_price_multiplier = 4&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
script.on_event(defines.events.on_built_entity, function(event)&lt;br /&gt;
    local setting_value = settings.get_player_settings(event.player_index)[&amp;quot;my-mod-kill-player-on-entity-built&amp;quot;].value&lt;br /&gt;
    if setting_value then&lt;br /&gt;
        game.get_player(event.player_index).die()&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Writing to your own settings ===&lt;br /&gt;
It is possible for mods to write to their own runtime (global or per player) mod settings. This is done by writing a new [https://lua-api.factorio.com/latest/Concepts.html#ModSetting ModSetting] table to the setting.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;string-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-always-difficult&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = &amp;quot;yes&amp;quot;,&lt;br /&gt;
        allowed_values = {&amp;quot;yes&amp;quot;, &amp;quot;no&amp;quot;}&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in control.lua:&lt;br /&gt;
script.on_event(defines.events.on_rocket_launched, function()&lt;br /&gt;
    settings.global[&amp;quot;my-mod-always-difficult&amp;quot;] = {value = &amp;quot;yes&amp;quot;}&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Changing another mod&#039;s settings ===&lt;br /&gt;
After creating a setting in the settings stage, it is stored in data.raw until the end of the stage, so it can be altered from another mod.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings-updates.lua:&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].order = &amp;quot;abc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the intent is to force the setting to be of a certain value that cannot be modified by players, the properties [[#The_hidden_property|hidden]], allowed_values and forced_value can be used. Modifying existing settings of other mods can be useful for mod packs or other mod compatibility goals.[https://forums.factorio.com/viewtopic.php?p=531322#p531322]&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings-updates.lua:&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].hidden = true&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].allowed_values = {&amp;quot;no&amp;quot;}&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].default_value = &amp;quot;no&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tips ===&lt;br /&gt;
&lt;br /&gt;
* Do not conditionally &#039;require(...)&#039; things depending on mod settings: This breaks the CRC checks and people will get errors trying to use your mod in multiplayer. &#039;require(...)&#039; everything and then conditionally add the values to data.raw using the settings.&lt;br /&gt;
* You should cache the settings table inside the event you use it in. Accessing it is relatively expensive (about as expensive as accessing game.*prototypes[...]), so when accessing it mutliple times within the same event, you should set a local variable to it (within the event) to improve performance.&lt;br /&gt;
** If you want to cache startup/and runtime settings outside of events, you will have to makes sure that the local variable of settings of the setting_type &amp;quot;runtime-global&amp;quot; are updated in the &amp;lt;code&amp;gt;on_runtime_mod_setting_changed&amp;lt;/code&amp;gt; event.&lt;br /&gt;
* If you want to detect whether a certain mod is installed in the settings stage, you can use &amp;lt;code&amp;gt;if mods[&amp;quot;another-mods-name&amp;quot;] then&amp;lt;/code&amp;gt;, just like in the data stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?p=207275 Forum post documenting mod settings]&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?p=305644#p305644 per_user is not a valid property and has no effects!]&lt;br /&gt;
* [http://lua-api.factorio.com/latest/LuaSettings.html Lua api documentation on the settings table]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/HeatConnection&amp;diff=190964</id>
		<title>Types/HeatConnection</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/HeatConnection&amp;diff=190964"/>
		<updated>2023-03-04T08:11:22Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* direction */ explanation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Defines the connections for a heat energy source in [[Types/EnergySource]].&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
=== position ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Position]]&lt;br /&gt;
&lt;br /&gt;
The location of the heat pipe connection, relative to the center of the entity in the north-facing direction.&lt;br /&gt;
&lt;br /&gt;
=== direction ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Direction]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;outward&amp;quot; direction of this heat connection. For a connection to succeed, the other heat connection must face the opposite direction (a south-facing connection needs a north-facing connection to succeed). A connection rotates with the entity.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/HeatConnection&amp;diff=190963</id>
		<title>Types/HeatConnection</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/HeatConnection&amp;diff=190963"/>
		<updated>2023-03-04T08:05:51Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* position */ description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Defines the connections for a heat energy source in [[Types/EnergySource]].&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
=== position ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Position]]&lt;br /&gt;
&lt;br /&gt;
The location of the heat pipe connection, relative to the center of the entity in the north-facing direction.&lt;br /&gt;
&lt;br /&gt;
=== direction ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Direction]]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Prototype/TransportBeltConnectable&amp;diff=190962</id>
		<title>Prototype/TransportBeltConnectable</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Prototype/TransportBeltConnectable&amp;diff=190962"/>
		<updated>2023-03-04T00:21:14Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Mandatory properties */ simple speed, rephrasing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Prototype parent|Prototype/EntityWithOwner}}&lt;br /&gt;
Abstract class that anything that is a belt or can connect to belts uses.&lt;br /&gt;
&lt;br /&gt;
{{Prototype TOC|&#039;&#039;abstract&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Extensions ==&lt;br /&gt;
&lt;br /&gt;
* [[Prototype/LinkedBelt]] &#039;&#039;&#039;linked-belt&#039;&#039;&#039;&lt;br /&gt;
* [[Prototype/Loader1x1]] &#039;&#039;&#039;loader-1x1&#039;&#039;&#039;&lt;br /&gt;
* [[Prototype/Loader1x2]] &#039;&#039;&#039;loader&#039;&#039;&#039;&lt;br /&gt;
* [[Prototype/Splitter]] &#039;&#039;&#039;splitter&#039;&#039;&#039;&lt;br /&gt;
* [[Prototype/TransportBelt]] &#039;&#039;&#039;transport-belt&#039;&#039;&#039;&lt;br /&gt;
* [[Prototype/UndergroundBelt]] &#039;&#039;&#039;underground-belt&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
This prototype inherits all the properties from [[Prototype/EntityWithOwner]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|speed|[[Types/double|double]]}}&lt;br /&gt;
The speed of the belt (since 0.17): &amp;lt;code&amp;gt;speed × 480 = x Items/second&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The raw value is expressed as the number of tiles traveled by each item on the belt per tick, relative to the belt&#039;s maximum density - e.g. &amp;lt;code&amp;gt;x items/second ÷ (4 items/lane × 2 lanes/belt × 60 ticks/second) = &amp;lt;speed&amp;gt; belts/tick&amp;lt;/code&amp;gt; where a &amp;quot;belt&amp;quot; is the size of one tile. See [[Transport_belts/Physics]] for more details.&lt;br /&gt;
&lt;br /&gt;
Must be a positive non-infinite number. The number is a fixed point number with 8 bits reserved for decimal precision, meaning the smallest value step is 1/2^8 = 0.00390625. In the simple case of a non-curved belt, the rate is multiples of 1.875 items / s, even though the entity tooltip may show a different rate.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|animation_speed_coefficient|[[Types/double|double]]|1|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|belt_animation_set|[[Types/table|table]]|optional=true}}&lt;br /&gt;
Either this, or all of the properties below this one have to be present.&lt;br /&gt;
&lt;br /&gt;
Table with the following properties:&lt;br /&gt;
&lt;br /&gt;
* animation_set - [[Types/RotatedAnimation|RotatedAnimation]] - Mandatory.&lt;br /&gt;
* east_index - [[Types/uint8|uint8]] - Optional. - Default: 1&lt;br /&gt;
* west_index - [[Types/uint8|uint8]] - Optional. - Default: 2&lt;br /&gt;
* north_index - [[Types/uint8|uint8]] - Optional. - Default: 3&lt;br /&gt;
* south_index - [[Types/uint8|uint8]] - Optional. - Default: 4&lt;br /&gt;
* starting_south_index - [[Types/uint8|uint8]] - Optional. - Default: 13&lt;br /&gt;
* ending_south_index - [[Types/uint8|uint8]] - Optional. - Default: 14&lt;br /&gt;
* starting_west_index - [[Types/uint8|uint8]] - Optional. - Default: 15&lt;br /&gt;
* ending_west_index - [[Types/uint8|uint8]] - Optional. - Default: 16&lt;br /&gt;
* starting_north_index - [[Types/uint8|uint8]] - Optional. - Default: 17&lt;br /&gt;
* ending_north_index - [[Types/uint8|uint8]] - Optional. - Default: 18&lt;br /&gt;
* starting_east_index - [[Types/uint8|uint8]] - Optional. - Default: 19&lt;br /&gt;
* ending_east_index - [[Types/uint8|uint8]] - Optional. - Default: 20&lt;br /&gt;
* ending_patch - [[Types/Sprite4Way|Sprite4Way]] - Optional.&lt;br /&gt;
* ends_with_stopper - [[Types/bool|bool]] - Optional. - Default: false&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|belt_horizontal|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|belt_vertical|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ending_top|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ending_bottom|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ending_side|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|starting_top|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|starting_bottom|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|starting_side|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ending_patch|[[Types/Sprite4Way|Sprite4Way]]|optional=true}}&lt;br /&gt;
Always optional. Only read if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ends_with_stopper|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
&lt;br /&gt;
== Mandatory values ==&lt;br /&gt;
Transport belt connectables have additional requirements for the properties inherited from [[Prototype/Entity]]:&lt;br /&gt;
* Transport belt connectable entities must collide with [[Types/CollisionMask#Layers|&amp;quot;transport-belt-layer&amp;quot;]].&lt;br /&gt;
* Transport belt connectable entities must have [[Types/CollisionMask#Collision_options|collision mask]] that collides with itself.&lt;br /&gt;
* Transport belt connectable entities cannot have collision mask that collides only with tiles (must collide with entities in some way).&lt;br /&gt;
* Transport belt connectable entities must have collision box of an appropriate minimal size, they should occupy more than half of every tile the entity covers.&lt;br /&gt;
* Transport belt connectable entities cannot have the [[Types/EntityPrototypeFlags#.22placeable-off-grid.22|&amp;quot;placeable-off-grid&amp;quot;]] flag specified.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Mod_settings&amp;diff=190961</id>
		<title>Tutorial:Mod settings</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Mod_settings&amp;diff=190961"/>
		<updated>2023-03-03T19:40:51Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* color-setting */ resulting table in control&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
This tutorial aims to explain how to create and use mod settings. Basic knowledge of modding is assumed, so you should have at least understood [[Tutorial:Modding tutorial/Gangsir|Gangsir&#039;s modding tutorial]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Each mod can specify settings that users can change. The values of these settings can be accessed from inside the data stage or the control stage depending on their [[#The_setting_type_property|setting_type]] and allow to conditionally create or modify prototypes and to add configuration options to control scripts. They allow modders to easily create a graphical interface for their configuration options, instead of using on text files that have to be edited manually by users.&lt;br /&gt;
&lt;br /&gt;
== Location ==&lt;br /&gt;
&lt;br /&gt;
Mod settings are defined in the [https://lua-api.factorio.com/latest/Data-Lifecycle.html settings stage]. This stage is loaded before the data stage. There are three files in which settings can be defined:&lt;br /&gt;
* settings.lua&lt;br /&gt;
* settings-updates.lua&lt;br /&gt;
* settings-final-fixes.lua&lt;br /&gt;
&lt;br /&gt;
First the settings.lua file is called for each mod, in the order of their dependencies and then in the [[:Wikipedia:natural sort order|natural sort order]]. After settings.lua has been called for all mods, the settings-updates.lua file is called for each mod &amp;lt;sup&amp;gt;(in the same order)&amp;lt;/sup&amp;gt; and finally the settings-final-fixes.lua file is called for each mod &amp;lt;sup&amp;gt;(in the same order)&amp;lt;/sup&amp;gt;. These 3 different phases of the settings stage allow to change settings of other mods without needing to rely on dependencies to load last. The settings are all defined in the same stage and their user defined values are not available, therefore mods cannot conditionally create settings depending on the values of other mod settings. Since the settings stage gets loaded first, there is also no prototype data or [http://lua-api.factorio.com/latest/LuaRemote.html remote interface] available.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;mod-settings.dat&amp;quot; file stored in the [[Application_directory#User_Data_directory|mods folder]] for the game contains the local players settings between game sessions similar to the player-data.json file.&lt;br /&gt;
&lt;br /&gt;
== Creation ==&lt;br /&gt;
&lt;br /&gt;
Mod settings are defined and modified by using the data table during the settings stage. This works [[Tutorial:Modding_tutorial/Gangsir#Prototype_creation|the same way as other prototypes]]. An example would be:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;bool-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-test-setting&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = true&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the setting has multiple properties. Each setting supports the following standard prototype properties:&lt;br /&gt;
* name - [[Types/string|string]] - Mandatory.&lt;br /&gt;
* type - [[Types/string|string]] - Mandatory.&lt;br /&gt;
* localised_name - [[Types/LocalisedString|LocalisedString]] - Optional.&lt;br /&gt;
* localised_description - [[Types/LocalisedString|LocalisedString]] - Optional.&lt;br /&gt;
* [[Types/Order|order]] - [[Types/string|string]] - Optional.&lt;br /&gt;
&lt;br /&gt;
In addition to the standard properties, mod settings also contain:&lt;br /&gt;
&lt;br /&gt;
* hidden - [[Types/bool|bool]] - Optional.&lt;br /&gt;
* setting_type - [[Types/string|string]] - Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== The name property ===&lt;br /&gt;
&lt;br /&gt;
The name of the settings prototype should be unique to avoid mod conflicts since the mod settings are global across all mods. Because of that it is recommened to prefix mod settings with your mod name, &amp;quot;my-mod&amp;quot; in this example.&lt;br /&gt;
&lt;br /&gt;
=== The type property ===&lt;br /&gt;
&lt;br /&gt;
There are four types of mod settings:&lt;br /&gt;
&lt;br /&gt;
* bool-setting - a true/false checkbox&lt;br /&gt;
* int-setting - a signed 64 bit integer textfield (or selection dropdown)&lt;br /&gt;
* double-setting - a double precision floating point textfield (or selection dropdown)&lt;br /&gt;
* string-setting - a string textfield (or selection dropdown)&lt;br /&gt;
* color-setting - a color picker (sliders), with whole number textfields. Includes alpha.&lt;br /&gt;
&lt;br /&gt;
Depending on the type, the prototype also allows or requires additional properties, these are listed below.&lt;br /&gt;
&lt;br /&gt;
==== bool-setting ====&lt;br /&gt;
* default_value - [[Types/bool|bool]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting, in this case whether the checkbox is checked or not.&lt;br /&gt;
* forced_value - [[Types/bool|bool]] - Optional.&lt;br /&gt;
** Only loaded if &amp;lt;code&amp;gt;hidden = true&amp;lt;/code&amp;gt;. This forces the setting to be of this value. This can be useful for mod compatiblity.&amp;lt;sup&amp;gt;[https://forums.factorio.com/viewtopic.php?p=531322#p531322]&lt;br /&gt;
&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== int-setting ====&lt;br /&gt;
* default_value - [[Types/int64|int64]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* minimum_value - [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Defines the lowest possible number.&lt;br /&gt;
* maximum_value - [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Defines the highest possible number.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a texfield.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== double-setting ====&lt;br /&gt;
* default_value - [[Types/double|double]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* minimum_value - [[Types/double|double]] - Optional.&lt;br /&gt;
** Defines the lowest possible number.&lt;br /&gt;
* maximum_value - [[Types/double|double]] - Optional.&lt;br /&gt;
** Defines the highest possible number.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/double|double]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a textfield.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== string-setting ====&lt;br /&gt;
* default_value - [[Types/string|string]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* allow_blank - [[Types/bool|bool]] - Optional. - Default: false&lt;br /&gt;
** Defines whether it&#039;s possible for the user to set the textfield to empty and apply the setting.&lt;br /&gt;
* auto_trim - [[Types/bool|bool]] - Optional. - Default: false&lt;br /&gt;
** Whether values that are input by the user should have whitespace removed from both ends of the string.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/string|string]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined strings, creates a dropdown instead of a textfield. The strings in the dropdown can be localized (translated) and can have a tooltip, see below.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== color-setting ====&lt;br /&gt;
* default_value = [[Types/Color|color]] - Mandatory.&lt;br /&gt;
** Default color to set. When read during control, the color has &#039;r&#039;, &#039;g&#039;, &#039;b&#039;, &#039;a&#039; keys and values [0, 1]&lt;br /&gt;
&lt;br /&gt;
=== The order property ===&lt;br /&gt;
&lt;br /&gt;
The order property can be used to change how the mod settings are ordered in the settings gui. Mod settings are sorted&lt;br /&gt;
* first by mod&lt;br /&gt;
* then by the setting &amp;quot;order&amp;quot; string&lt;br /&gt;
* then finally by the setting name.&lt;br /&gt;
&lt;br /&gt;
For more info on how to use the order string, see [[Types/Order]].&lt;br /&gt;
&lt;br /&gt;
=== The hidden property ===&lt;br /&gt;
&lt;br /&gt;
The hidden property can be used to hide mod settings from GUIs, so that they cannot be seen or changed by players. However, other mods can still access hidden settings.&amp;lt;sup&amp;gt;[https://forums.factorio.com/83316]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The setting_type property ===&lt;br /&gt;
[[File:Mod_settings_gui.png|right|300px|thumb|The mod settings gui. Can be reached from the main menu → Settings → Mod settings.]]&lt;br /&gt;
There are the overall kinds of settings:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;startup&#039;&#039;&#039;: This kind of setting is available in the prototype stage, and can not be changed runtime. They have to be  set to the same values for all players on a server.&lt;br /&gt;
* &#039;&#039;&#039;runtime-global&#039;&#039;&#039;: This kind of setting is global to an entire save game and can be changed runtime. On servers, only admins can change these settings.&lt;br /&gt;
* &#039;&#039;&#039;runtime-per-user&#039;&#039;&#039;: This kind of setting is only available runtime in the control.lua stage and each player has their own instance of this setting. When a player joins a server their local setting of &amp;quot;keep mod settings per save&amp;quot; determines if the local settings they have set are synced to the loaded save or if the save&#039;s settings are used.&lt;br /&gt;
&lt;br /&gt;
This &amp;quot;setting_type&amp;quot; also determines in which tab the setting is showed in the mod settings menu.&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
The locale for mod settings works like any other locale in the game. The names of the groups for the setting name and description (tooltip) are &amp;quot;mod-setting-name&amp;quot; and &amp;quot;mod-setting-description&amp;quot;. The dropdown items of a string setting can be localized in the &amp;quot;string-mod-setting&amp;quot; group, but the game falls back to just showing the name of the dropdown item if no localization is found. An example for mod setting localization that would be set within &amp;quot;locale/en/locale.cfg&amp;quot;, is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mod-setting-name]&lt;br /&gt;
my-mod-test-setting=Localized test setting name&lt;br /&gt;
&lt;br /&gt;
[mod-setting-description]&lt;br /&gt;
my-mod-test-setting=Localized test setting description&lt;br /&gt;
&lt;br /&gt;
[string-mod-setting]&lt;br /&gt;
#&amp;lt;setting-name&amp;gt;-&amp;lt;dropdown-item-name&amp;gt;=&amp;lt;translated dropdown item&amp;gt;&lt;br /&gt;
my-mod-string-test-setting-item-1=Item 1 localized string&lt;br /&gt;
&lt;br /&gt;
[string-mod-setting-description]&lt;br /&gt;
#&amp;lt;setting-name&amp;gt;-&amp;lt;dropdown-item-name&amp;gt;=&amp;lt;tooltip of dropdown item&amp;gt;&lt;br /&gt;
my-mod-string-test-setting-item-1=Item 1 localized tooltip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
=== Reading settings ===&lt;br /&gt;
When accessing any mod setting, you will have to specifically access the &#039;&#039;value&#039;&#039; of the setting. The data type of the value depends on the type of the setting. For string settings that use a selection of allowed values, the value of the setting is one of the original string values defined in the prototype, the localization is ignored. See also: [http://lua-api.factorio.com/latest/Concepts.html#ModSetting ModSetting concept].&lt;br /&gt;
&lt;br /&gt;
In the prototype stage you can access settings of the setting_type &amp;quot;startup&amp;quot; by indexing &amp;lt;code&amp;gt;settings.startup&amp;lt;/code&amp;gt; with the name of the setting. Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;int-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-stone-wall-stack-size&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;startup&amp;quot;,&lt;br /&gt;
        minimum_value = 1,&lt;br /&gt;
        default_value = 100&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in data.lua:&lt;br /&gt;
data.raw.item[&amp;quot;stone-wall&amp;quot;].stack_size = settings.startup[&amp;quot;my-mod-stone-wall-stack-size&amp;quot;].value&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;plainlinks&amp;quot;&amp;gt;&lt;br /&gt;
In the control stage, the settings of the setting_type &amp;quot;runtime-global&amp;quot; can be accessed using &amp;lt;code&amp;gt;settings.global[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt; (see [https://lua-api.factorio.com/latest/LuaSettings.html LuaSettings]). Settings of the setting_type &amp;quot;runtime-per-user&amp;quot; are accessed using &amp;lt;code&amp;gt;settings.get_player_settings([https://lua-api.factorio.com/latest/Concepts.html#PlayerIdentification &amp;amp;lt;PlayerIdentification&amp;amp;gt;])[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;game.players[[https://lua-api.factorio.com/latest/Concepts.html#PlayerIdentification &amp;amp;lt;PlayerIdentification&amp;amp;gt;]].mod_settings[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;string-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-always-difficult&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = &amp;quot;yes&amp;quot;,&lt;br /&gt;
        allowed_values = {&amp;quot;yes&amp;quot;, &amp;quot;no&amp;quot;}&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;bool-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-kill-player-on-entity-built&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-per-user&amp;quot;,&lt;br /&gt;
        default_value = false&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in control.lua:&lt;br /&gt;
script.on_init(function()&lt;br /&gt;
    if settings.global[&amp;quot;my-mod-always-difficult&amp;quot;].value == &amp;quot;yes&amp;quot; then&lt;br /&gt;
        game.difficulty_settings.recipe_difficulty = 1&lt;br /&gt;
        game.difficulty_settings.technology_difficulty = 1&lt;br /&gt;
        game.difficulty_settings.technology_price_multiplier = 4&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
script.on_event(defines.events.on_built_entity, function(event)&lt;br /&gt;
    local setting_value = settings.get_player_settings(event.player_index)[&amp;quot;my-mod-kill-player-on-entity-built&amp;quot;].value&lt;br /&gt;
    if setting_value then&lt;br /&gt;
        game.get_player(event.player_index).die()&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Writing to your own settings ===&lt;br /&gt;
It is possible for mods to write to their own runtime (global or per player) mod settings. This is done by writing a new [https://lua-api.factorio.com/latest/Concepts.html#ModSetting ModSetting] table to the setting.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;string-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-always-difficult&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = &amp;quot;yes&amp;quot;,&lt;br /&gt;
        allowed_values = {&amp;quot;yes&amp;quot;, &amp;quot;no&amp;quot;}&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in control.lua:&lt;br /&gt;
script.on_event(defines.events.on_rocket_launched, function()&lt;br /&gt;
    settings.global[&amp;quot;my-mod-always-difficult&amp;quot;] = {value = &amp;quot;yes&amp;quot;}&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Changing another mod&#039;s settings ===&lt;br /&gt;
After creating a setting in the settings stage, it is stored in data.raw until the end of the stage, so it can be altered from another mod.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings-updates.lua:&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].order = &amp;quot;abc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the intent is to force the setting to be of a certain value that cannot be modified by players, the properties [[#The_hidden_property|hidden]], allowed_values and forced_value can be used. Modifying existing settings of other mods can be useful for mod packs or other mod compatibility goals.[https://forums.factorio.com/viewtopic.php?p=531322#p531322]&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings-updates.lua:&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].hidden = true&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].allowed_values = {&amp;quot;no&amp;quot;}&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].default_value = &amp;quot;no&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tips ===&lt;br /&gt;
&lt;br /&gt;
* Do not conditionally &#039;require(...)&#039; things depending on mod settings: This breaks the CRC checks and people will get errors trying to use your mod in multiplayer. &#039;require(...)&#039; everything and then conditionally add the values to data.raw using the settings.&lt;br /&gt;
* You should cache the settings table inside the event you use it in. Accessing it is relatively expensive (about as expensive as accessing game.*prototypes[...]), so when accessing it mutliple times within the same event, you should set a local variable to it (within the event) to improve performance.&lt;br /&gt;
** If you want to cache startup/and runtime settings outside of events, you will have to makes sure that the local variable of settings of the setting_type &amp;quot;runtime-global&amp;quot; are updated in the &amp;lt;code&amp;gt;on_runtime_mod_setting_changed&amp;lt;/code&amp;gt; event.&lt;br /&gt;
* If you want to detect whether a certain mod is installed in the settings stage, you can use &amp;lt;code&amp;gt;if mods[&amp;quot;another-mods-name&amp;quot;] then&amp;lt;/code&amp;gt;, just like in the data stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?p=207275 Forum post documenting mod settings]&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?p=305644#p305644 per_user is not a valid property and has no effects!]&lt;br /&gt;
* [http://lua-api.factorio.com/latest/LuaSettings.html Lua api documentation on the settings table]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Mod_settings&amp;diff=190960</id>
		<title>Tutorial:Mod settings</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Mod_settings&amp;diff=190960"/>
		<updated>2023-03-03T19:31:48Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* The type property */ color setting description at top&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
This tutorial aims to explain how to create and use mod settings. Basic knowledge of modding is assumed, so you should have at least understood [[Tutorial:Modding tutorial/Gangsir|Gangsir&#039;s modding tutorial]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Each mod can specify settings that users can change. The values of these settings can be accessed from inside the data stage or the control stage depending on their [[#The_setting_type_property|setting_type]] and allow to conditionally create or modify prototypes and to add configuration options to control scripts. They allow modders to easily create a graphical interface for their configuration options, instead of using on text files that have to be edited manually by users.&lt;br /&gt;
&lt;br /&gt;
== Location ==&lt;br /&gt;
&lt;br /&gt;
Mod settings are defined in the [https://lua-api.factorio.com/latest/Data-Lifecycle.html settings stage]. This stage is loaded before the data stage. There are three files in which settings can be defined:&lt;br /&gt;
* settings.lua&lt;br /&gt;
* settings-updates.lua&lt;br /&gt;
* settings-final-fixes.lua&lt;br /&gt;
&lt;br /&gt;
First the settings.lua file is called for each mod, in the order of their dependencies and then in the [[:Wikipedia:natural sort order|natural sort order]]. After settings.lua has been called for all mods, the settings-updates.lua file is called for each mod &amp;lt;sup&amp;gt;(in the same order)&amp;lt;/sup&amp;gt; and finally the settings-final-fixes.lua file is called for each mod &amp;lt;sup&amp;gt;(in the same order)&amp;lt;/sup&amp;gt;. These 3 different phases of the settings stage allow to change settings of other mods without needing to rely on dependencies to load last. The settings are all defined in the same stage and their user defined values are not available, therefore mods cannot conditionally create settings depending on the values of other mod settings. Since the settings stage gets loaded first, there is also no prototype data or [http://lua-api.factorio.com/latest/LuaRemote.html remote interface] available.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;mod-settings.dat&amp;quot; file stored in the [[Application_directory#User_Data_directory|mods folder]] for the game contains the local players settings between game sessions similar to the player-data.json file.&lt;br /&gt;
&lt;br /&gt;
== Creation ==&lt;br /&gt;
&lt;br /&gt;
Mod settings are defined and modified by using the data table during the settings stage. This works [[Tutorial:Modding_tutorial/Gangsir#Prototype_creation|the same way as other prototypes]]. An example would be:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;bool-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-test-setting&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = true&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the setting has multiple properties. Each setting supports the following standard prototype properties:&lt;br /&gt;
* name - [[Types/string|string]] - Mandatory.&lt;br /&gt;
* type - [[Types/string|string]] - Mandatory.&lt;br /&gt;
* localised_name - [[Types/LocalisedString|LocalisedString]] - Optional.&lt;br /&gt;
* localised_description - [[Types/LocalisedString|LocalisedString]] - Optional.&lt;br /&gt;
* [[Types/Order|order]] - [[Types/string|string]] - Optional.&lt;br /&gt;
&lt;br /&gt;
In addition to the standard properties, mod settings also contain:&lt;br /&gt;
&lt;br /&gt;
* hidden - [[Types/bool|bool]] - Optional.&lt;br /&gt;
* setting_type - [[Types/string|string]] - Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== The name property ===&lt;br /&gt;
&lt;br /&gt;
The name of the settings prototype should be unique to avoid mod conflicts since the mod settings are global across all mods. Because of that it is recommened to prefix mod settings with your mod name, &amp;quot;my-mod&amp;quot; in this example.&lt;br /&gt;
&lt;br /&gt;
=== The type property ===&lt;br /&gt;
&lt;br /&gt;
There are four types of mod settings:&lt;br /&gt;
&lt;br /&gt;
* bool-setting - a true/false checkbox&lt;br /&gt;
* int-setting - a signed 64 bit integer textfield (or selection dropdown)&lt;br /&gt;
* double-setting - a double precision floating point textfield (or selection dropdown)&lt;br /&gt;
* string-setting - a string textfield (or selection dropdown)&lt;br /&gt;
* color-setting - a color picker (sliders), with whole number textfields. Includes alpha.&lt;br /&gt;
&lt;br /&gt;
Depending on the type, the prototype also allows or requires additional properties, these are listed below.&lt;br /&gt;
&lt;br /&gt;
==== bool-setting ====&lt;br /&gt;
* default_value - [[Types/bool|bool]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting, in this case whether the checkbox is checked or not.&lt;br /&gt;
* forced_value - [[Types/bool|bool]] - Optional.&lt;br /&gt;
** Only loaded if &amp;lt;code&amp;gt;hidden = true&amp;lt;/code&amp;gt;. This forces the setting to be of this value. This can be useful for mod compatiblity.&amp;lt;sup&amp;gt;[https://forums.factorio.com/viewtopic.php?p=531322#p531322]&lt;br /&gt;
&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== int-setting ====&lt;br /&gt;
* default_value - [[Types/int64|int64]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* minimum_value - [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Defines the lowest possible number.&lt;br /&gt;
* maximum_value - [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Defines the highest possible number.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a texfield.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== double-setting ====&lt;br /&gt;
* default_value - [[Types/double|double]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* minimum_value - [[Types/double|double]] - Optional.&lt;br /&gt;
** Defines the lowest possible number.&lt;br /&gt;
* maximum_value - [[Types/double|double]] - Optional.&lt;br /&gt;
** Defines the highest possible number.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/double|double]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a textfield.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== string-setting ====&lt;br /&gt;
* default_value - [[Types/string|string]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* allow_blank - [[Types/bool|bool]] - Optional. - Default: false&lt;br /&gt;
** Defines whether it&#039;s possible for the user to set the textfield to empty and apply the setting.&lt;br /&gt;
* auto_trim - [[Types/bool|bool]] - Optional. - Default: false&lt;br /&gt;
** Whether values that are input by the user should have whitespace removed from both ends of the string.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/string|string]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined strings, creates a dropdown instead of a textfield. The strings in the dropdown can be localized (translated) and can have a tooltip, see below.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== color-setting ====&lt;br /&gt;
* default_value = [[Types/Color|color]] - Mandatory.&lt;br /&gt;
** Default color to set.&lt;br /&gt;
&lt;br /&gt;
=== The order property ===&lt;br /&gt;
&lt;br /&gt;
The order property can be used to change how the mod settings are ordered in the settings gui. Mod settings are sorted&lt;br /&gt;
* first by mod&lt;br /&gt;
* then by the setting &amp;quot;order&amp;quot; string&lt;br /&gt;
* then finally by the setting name.&lt;br /&gt;
&lt;br /&gt;
For more info on how to use the order string, see [[Types/Order]].&lt;br /&gt;
&lt;br /&gt;
=== The hidden property ===&lt;br /&gt;
&lt;br /&gt;
The hidden property can be used to hide mod settings from GUIs, so that they cannot be seen or changed by players. However, other mods can still access hidden settings.&amp;lt;sup&amp;gt;[https://forums.factorio.com/83316]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The setting_type property ===&lt;br /&gt;
[[File:Mod_settings_gui.png|right|300px|thumb|The mod settings gui. Can be reached from the main menu → Settings → Mod settings.]]&lt;br /&gt;
There are the overall kinds of settings:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;startup&#039;&#039;&#039;: This kind of setting is available in the prototype stage, and can not be changed runtime. They have to be  set to the same values for all players on a server.&lt;br /&gt;
* &#039;&#039;&#039;runtime-global&#039;&#039;&#039;: This kind of setting is global to an entire save game and can be changed runtime. On servers, only admins can change these settings.&lt;br /&gt;
* &#039;&#039;&#039;runtime-per-user&#039;&#039;&#039;: This kind of setting is only available runtime in the control.lua stage and each player has their own instance of this setting. When a player joins a server their local setting of &amp;quot;keep mod settings per save&amp;quot; determines if the local settings they have set are synced to the loaded save or if the save&#039;s settings are used.&lt;br /&gt;
&lt;br /&gt;
This &amp;quot;setting_type&amp;quot; also determines in which tab the setting is showed in the mod settings menu.&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
The locale for mod settings works like any other locale in the game. The names of the groups for the setting name and description (tooltip) are &amp;quot;mod-setting-name&amp;quot; and &amp;quot;mod-setting-description&amp;quot;. The dropdown items of a string setting can be localized in the &amp;quot;string-mod-setting&amp;quot; group, but the game falls back to just showing the name of the dropdown item if no localization is found. An example for mod setting localization that would be set within &amp;quot;locale/en/locale.cfg&amp;quot;, is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mod-setting-name]&lt;br /&gt;
my-mod-test-setting=Localized test setting name&lt;br /&gt;
&lt;br /&gt;
[mod-setting-description]&lt;br /&gt;
my-mod-test-setting=Localized test setting description&lt;br /&gt;
&lt;br /&gt;
[string-mod-setting]&lt;br /&gt;
#&amp;lt;setting-name&amp;gt;-&amp;lt;dropdown-item-name&amp;gt;=&amp;lt;translated dropdown item&amp;gt;&lt;br /&gt;
my-mod-string-test-setting-item-1=Item 1 localized string&lt;br /&gt;
&lt;br /&gt;
[string-mod-setting-description]&lt;br /&gt;
#&amp;lt;setting-name&amp;gt;-&amp;lt;dropdown-item-name&amp;gt;=&amp;lt;tooltip of dropdown item&amp;gt;&lt;br /&gt;
my-mod-string-test-setting-item-1=Item 1 localized tooltip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
=== Reading settings ===&lt;br /&gt;
When accessing any mod setting, you will have to specifically access the &#039;&#039;value&#039;&#039; of the setting. The data type of the value depends on the type of the setting. For string settings that use a selection of allowed values, the value of the setting is one of the original string values defined in the prototype, the localization is ignored. See also: [http://lua-api.factorio.com/latest/Concepts.html#ModSetting ModSetting concept].&lt;br /&gt;
&lt;br /&gt;
In the prototype stage you can access settings of the setting_type &amp;quot;startup&amp;quot; by indexing &amp;lt;code&amp;gt;settings.startup&amp;lt;/code&amp;gt; with the name of the setting. Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;int-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-stone-wall-stack-size&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;startup&amp;quot;,&lt;br /&gt;
        minimum_value = 1,&lt;br /&gt;
        default_value = 100&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in data.lua:&lt;br /&gt;
data.raw.item[&amp;quot;stone-wall&amp;quot;].stack_size = settings.startup[&amp;quot;my-mod-stone-wall-stack-size&amp;quot;].value&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;plainlinks&amp;quot;&amp;gt;&lt;br /&gt;
In the control stage, the settings of the setting_type &amp;quot;runtime-global&amp;quot; can be accessed using &amp;lt;code&amp;gt;settings.global[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt; (see [https://lua-api.factorio.com/latest/LuaSettings.html LuaSettings]). Settings of the setting_type &amp;quot;runtime-per-user&amp;quot; are accessed using &amp;lt;code&amp;gt;settings.get_player_settings([https://lua-api.factorio.com/latest/Concepts.html#PlayerIdentification &amp;amp;lt;PlayerIdentification&amp;amp;gt;])[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;game.players[[https://lua-api.factorio.com/latest/Concepts.html#PlayerIdentification &amp;amp;lt;PlayerIdentification&amp;amp;gt;]].mod_settings[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;string-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-always-difficult&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = &amp;quot;yes&amp;quot;,&lt;br /&gt;
        allowed_values = {&amp;quot;yes&amp;quot;, &amp;quot;no&amp;quot;}&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;bool-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-kill-player-on-entity-built&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-per-user&amp;quot;,&lt;br /&gt;
        default_value = false&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in control.lua:&lt;br /&gt;
script.on_init(function()&lt;br /&gt;
    if settings.global[&amp;quot;my-mod-always-difficult&amp;quot;].value == &amp;quot;yes&amp;quot; then&lt;br /&gt;
        game.difficulty_settings.recipe_difficulty = 1&lt;br /&gt;
        game.difficulty_settings.technology_difficulty = 1&lt;br /&gt;
        game.difficulty_settings.technology_price_multiplier = 4&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
script.on_event(defines.events.on_built_entity, function(event)&lt;br /&gt;
    local setting_value = settings.get_player_settings(event.player_index)[&amp;quot;my-mod-kill-player-on-entity-built&amp;quot;].value&lt;br /&gt;
    if setting_value then&lt;br /&gt;
        game.get_player(event.player_index).die()&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Writing to your own settings ===&lt;br /&gt;
It is possible for mods to write to their own runtime (global or per player) mod settings. This is done by writing a new [https://lua-api.factorio.com/latest/Concepts.html#ModSetting ModSetting] table to the setting.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;string-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-always-difficult&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = &amp;quot;yes&amp;quot;,&lt;br /&gt;
        allowed_values = {&amp;quot;yes&amp;quot;, &amp;quot;no&amp;quot;}&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in control.lua:&lt;br /&gt;
script.on_event(defines.events.on_rocket_launched, function()&lt;br /&gt;
    settings.global[&amp;quot;my-mod-always-difficult&amp;quot;] = {value = &amp;quot;yes&amp;quot;}&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Changing another mod&#039;s settings ===&lt;br /&gt;
After creating a setting in the settings stage, it is stored in data.raw until the end of the stage, so it can be altered from another mod.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings-updates.lua:&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].order = &amp;quot;abc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the intent is to force the setting to be of a certain value that cannot be modified by players, the properties [[#The_hidden_property|hidden]], allowed_values and forced_value can be used. Modifying existing settings of other mods can be useful for mod packs or other mod compatibility goals.[https://forums.factorio.com/viewtopic.php?p=531322#p531322]&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings-updates.lua:&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].hidden = true&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].allowed_values = {&amp;quot;no&amp;quot;}&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].default_value = &amp;quot;no&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tips ===&lt;br /&gt;
&lt;br /&gt;
* Do not conditionally &#039;require(...)&#039; things depending on mod settings: This breaks the CRC checks and people will get errors trying to use your mod in multiplayer. &#039;require(...)&#039; everything and then conditionally add the values to data.raw using the settings.&lt;br /&gt;
* You should cache the settings table inside the event you use it in. Accessing it is relatively expensive (about as expensive as accessing game.*prototypes[...]), so when accessing it mutliple times within the same event, you should set a local variable to it (within the event) to improve performance.&lt;br /&gt;
** If you want to cache startup/and runtime settings outside of events, you will have to makes sure that the local variable of settings of the setting_type &amp;quot;runtime-global&amp;quot; are updated in the &amp;lt;code&amp;gt;on_runtime_mod_setting_changed&amp;lt;/code&amp;gt; event.&lt;br /&gt;
* If you want to detect whether a certain mod is installed in the settings stage, you can use &amp;lt;code&amp;gt;if mods[&amp;quot;another-mods-name&amp;quot;] then&amp;lt;/code&amp;gt;, just like in the data stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?p=207275 Forum post documenting mod settings]&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?p=305644#p305644 per_user is not a valid property and has no effects!]&lt;br /&gt;
* [http://lua-api.factorio.com/latest/LuaSettings.html Lua api documentation on the settings table]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Mod_settings&amp;diff=190959</id>
		<title>Tutorial:Mod settings</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Mod_settings&amp;diff=190959"/>
		<updated>2023-03-03T19:26:05Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* string-setting */ -&amp;gt; new color setting!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
This tutorial aims to explain how to create and use mod settings. Basic knowledge of modding is assumed, so you should have at least understood [[Tutorial:Modding tutorial/Gangsir|Gangsir&#039;s modding tutorial]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Each mod can specify settings that users can change. The values of these settings can be accessed from inside the data stage or the control stage depending on their [[#The_setting_type_property|setting_type]] and allow to conditionally create or modify prototypes and to add configuration options to control scripts. They allow modders to easily create a graphical interface for their configuration options, instead of using on text files that have to be edited manually by users.&lt;br /&gt;
&lt;br /&gt;
== Location ==&lt;br /&gt;
&lt;br /&gt;
Mod settings are defined in the [https://lua-api.factorio.com/latest/Data-Lifecycle.html settings stage]. This stage is loaded before the data stage. There are three files in which settings can be defined:&lt;br /&gt;
* settings.lua&lt;br /&gt;
* settings-updates.lua&lt;br /&gt;
* settings-final-fixes.lua&lt;br /&gt;
&lt;br /&gt;
First the settings.lua file is called for each mod, in the order of their dependencies and then in the [[:Wikipedia:natural sort order|natural sort order]]. After settings.lua has been called for all mods, the settings-updates.lua file is called for each mod &amp;lt;sup&amp;gt;(in the same order)&amp;lt;/sup&amp;gt; and finally the settings-final-fixes.lua file is called for each mod &amp;lt;sup&amp;gt;(in the same order)&amp;lt;/sup&amp;gt;. These 3 different phases of the settings stage allow to change settings of other mods without needing to rely on dependencies to load last. The settings are all defined in the same stage and their user defined values are not available, therefore mods cannot conditionally create settings depending on the values of other mod settings. Since the settings stage gets loaded first, there is also no prototype data or [http://lua-api.factorio.com/latest/LuaRemote.html remote interface] available.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;mod-settings.dat&amp;quot; file stored in the [[Application_directory#User_Data_directory|mods folder]] for the game contains the local players settings between game sessions similar to the player-data.json file.&lt;br /&gt;
&lt;br /&gt;
== Creation ==&lt;br /&gt;
&lt;br /&gt;
Mod settings are defined and modified by using the data table during the settings stage. This works [[Tutorial:Modding_tutorial/Gangsir#Prototype_creation|the same way as other prototypes]]. An example would be:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;bool-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-test-setting&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = true&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the setting has multiple properties. Each setting supports the following standard prototype properties:&lt;br /&gt;
* name - [[Types/string|string]] - Mandatory.&lt;br /&gt;
* type - [[Types/string|string]] - Mandatory.&lt;br /&gt;
* localised_name - [[Types/LocalisedString|LocalisedString]] - Optional.&lt;br /&gt;
* localised_description - [[Types/LocalisedString|LocalisedString]] - Optional.&lt;br /&gt;
* [[Types/Order|order]] - [[Types/string|string]] - Optional.&lt;br /&gt;
&lt;br /&gt;
In addition to the standard properties, mod settings also contain:&lt;br /&gt;
&lt;br /&gt;
* hidden - [[Types/bool|bool]] - Optional.&lt;br /&gt;
* setting_type - [[Types/string|string]] - Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== The name property ===&lt;br /&gt;
&lt;br /&gt;
The name of the settings prototype should be unique to avoid mod conflicts since the mod settings are global across all mods. Because of that it is recommened to prefix mod settings with your mod name, &amp;quot;my-mod&amp;quot; in this example.&lt;br /&gt;
&lt;br /&gt;
=== The type property ===&lt;br /&gt;
&lt;br /&gt;
There are four types of mod settings:&lt;br /&gt;
&lt;br /&gt;
* bool-setting - a true/false checkbox&lt;br /&gt;
* int-setting - a signed 64 bit integer textfield (or selection dropdown)&lt;br /&gt;
* double-setting - a double precision floating point textfield (or selection dropdown)&lt;br /&gt;
* string-setting - a string textfield (or selection dropdown)&lt;br /&gt;
&lt;br /&gt;
Depending on the type, the prototype also allows or requires additional properties, these are listed below.&lt;br /&gt;
&lt;br /&gt;
==== bool-setting ====&lt;br /&gt;
* default_value - [[Types/bool|bool]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting, in this case whether the checkbox is checked or not.&lt;br /&gt;
* forced_value - [[Types/bool|bool]] - Optional.&lt;br /&gt;
** Only loaded if &amp;lt;code&amp;gt;hidden = true&amp;lt;/code&amp;gt;. This forces the setting to be of this value. This can be useful for mod compatiblity.&amp;lt;sup&amp;gt;[https://forums.factorio.com/viewtopic.php?p=531322#p531322]&lt;br /&gt;
&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== int-setting ====&lt;br /&gt;
* default_value - [[Types/int64|int64]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* minimum_value - [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Defines the lowest possible number.&lt;br /&gt;
* maximum_value - [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Defines the highest possible number.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/int64|int64]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a texfield.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== double-setting ====&lt;br /&gt;
* default_value - [[Types/double|double]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* minimum_value - [[Types/double|double]] - Optional.&lt;br /&gt;
** Defines the lowest possible number.&lt;br /&gt;
* maximum_value - [[Types/double|double]] - Optional.&lt;br /&gt;
** Defines the highest possible number.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/double|double]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a textfield.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== string-setting ====&lt;br /&gt;
* default_value - [[Types/string|string]] - Mandatory.&lt;br /&gt;
** Defines the default value of the setting.&lt;br /&gt;
* allow_blank - [[Types/bool|bool]] - Optional. - Default: false&lt;br /&gt;
** Defines whether it&#039;s possible for the user to set the textfield to empty and apply the setting.&lt;br /&gt;
* auto_trim - [[Types/bool|bool]] - Optional. - Default: false&lt;br /&gt;
** Whether values that are input by the user should have whitespace removed from both ends of the string.&lt;br /&gt;
* allowed_values - [[Types/table|array]] of [[Types/string|string]] - Optional.&lt;br /&gt;
** Makes it possible to force the player to choose between the defined strings, creates a dropdown instead of a textfield. The strings in the dropdown can be localized (translated) and can have a tooltip, see below.&lt;br /&gt;
** If only one allowed value is given, the settings is forced to be of that value.&lt;br /&gt;
&lt;br /&gt;
==== color-setting ====&lt;br /&gt;
* default_value = [[Types/Color|color]] - Mandatory.&lt;br /&gt;
** Default color to set.&lt;br /&gt;
&lt;br /&gt;
=== The order property ===&lt;br /&gt;
&lt;br /&gt;
The order property can be used to change how the mod settings are ordered in the settings gui. Mod settings are sorted&lt;br /&gt;
* first by mod&lt;br /&gt;
* then by the setting &amp;quot;order&amp;quot; string&lt;br /&gt;
* then finally by the setting name.&lt;br /&gt;
&lt;br /&gt;
For more info on how to use the order string, see [[Types/Order]].&lt;br /&gt;
&lt;br /&gt;
=== The hidden property ===&lt;br /&gt;
&lt;br /&gt;
The hidden property can be used to hide mod settings from GUIs, so that they cannot be seen or changed by players. However, other mods can still access hidden settings.&amp;lt;sup&amp;gt;[https://forums.factorio.com/83316]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The setting_type property ===&lt;br /&gt;
[[File:Mod_settings_gui.png|right|300px|thumb|The mod settings gui. Can be reached from the main menu → Settings → Mod settings.]]&lt;br /&gt;
There are the overall kinds of settings:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;startup&#039;&#039;&#039;: This kind of setting is available in the prototype stage, and can not be changed runtime. They have to be  set to the same values for all players on a server.&lt;br /&gt;
* &#039;&#039;&#039;runtime-global&#039;&#039;&#039;: This kind of setting is global to an entire save game and can be changed runtime. On servers, only admins can change these settings.&lt;br /&gt;
* &#039;&#039;&#039;runtime-per-user&#039;&#039;&#039;: This kind of setting is only available runtime in the control.lua stage and each player has their own instance of this setting. When a player joins a server their local setting of &amp;quot;keep mod settings per save&amp;quot; determines if the local settings they have set are synced to the loaded save or if the save&#039;s settings are used.&lt;br /&gt;
&lt;br /&gt;
This &amp;quot;setting_type&amp;quot; also determines in which tab the setting is showed in the mod settings menu.&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
The locale for mod settings works like any other locale in the game. The names of the groups for the setting name and description (tooltip) are &amp;quot;mod-setting-name&amp;quot; and &amp;quot;mod-setting-description&amp;quot;. The dropdown items of a string setting can be localized in the &amp;quot;string-mod-setting&amp;quot; group, but the game falls back to just showing the name of the dropdown item if no localization is found. An example for mod setting localization that would be set within &amp;quot;locale/en/locale.cfg&amp;quot;, is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mod-setting-name]&lt;br /&gt;
my-mod-test-setting=Localized test setting name&lt;br /&gt;
&lt;br /&gt;
[mod-setting-description]&lt;br /&gt;
my-mod-test-setting=Localized test setting description&lt;br /&gt;
&lt;br /&gt;
[string-mod-setting]&lt;br /&gt;
#&amp;lt;setting-name&amp;gt;-&amp;lt;dropdown-item-name&amp;gt;=&amp;lt;translated dropdown item&amp;gt;&lt;br /&gt;
my-mod-string-test-setting-item-1=Item 1 localized string&lt;br /&gt;
&lt;br /&gt;
[string-mod-setting-description]&lt;br /&gt;
#&amp;lt;setting-name&amp;gt;-&amp;lt;dropdown-item-name&amp;gt;=&amp;lt;tooltip of dropdown item&amp;gt;&lt;br /&gt;
my-mod-string-test-setting-item-1=Item 1 localized tooltip&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
=== Reading settings ===&lt;br /&gt;
When accessing any mod setting, you will have to specifically access the &#039;&#039;value&#039;&#039; of the setting. The data type of the value depends on the type of the setting. For string settings that use a selection of allowed values, the value of the setting is one of the original string values defined in the prototype, the localization is ignored. See also: [http://lua-api.factorio.com/latest/Concepts.html#ModSetting ModSetting concept].&lt;br /&gt;
&lt;br /&gt;
In the prototype stage you can access settings of the setting_type &amp;quot;startup&amp;quot; by indexing &amp;lt;code&amp;gt;settings.startup&amp;lt;/code&amp;gt; with the name of the setting. Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;int-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-stone-wall-stack-size&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;startup&amp;quot;,&lt;br /&gt;
        minimum_value = 1,&lt;br /&gt;
        default_value = 100&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in data.lua:&lt;br /&gt;
data.raw.item[&amp;quot;stone-wall&amp;quot;].stack_size = settings.startup[&amp;quot;my-mod-stone-wall-stack-size&amp;quot;].value&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;plainlinks&amp;quot;&amp;gt;&lt;br /&gt;
In the control stage, the settings of the setting_type &amp;quot;runtime-global&amp;quot; can be accessed using &amp;lt;code&amp;gt;settings.global[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt; (see [https://lua-api.factorio.com/latest/LuaSettings.html LuaSettings]). Settings of the setting_type &amp;quot;runtime-per-user&amp;quot; are accessed using &amp;lt;code&amp;gt;settings.get_player_settings([https://lua-api.factorio.com/latest/Concepts.html#PlayerIdentification &amp;amp;lt;PlayerIdentification&amp;amp;gt;])[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;game.players[[https://lua-api.factorio.com/latest/Concepts.html#PlayerIdentification &amp;amp;lt;PlayerIdentification&amp;amp;gt;]].mod_settings[&amp;quot;setting-name&amp;quot;]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;string-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-always-difficult&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = &amp;quot;yes&amp;quot;,&lt;br /&gt;
        allowed_values = {&amp;quot;yes&amp;quot;, &amp;quot;no&amp;quot;}&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;bool-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-kill-player-on-entity-built&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-per-user&amp;quot;,&lt;br /&gt;
        default_value = false&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in control.lua:&lt;br /&gt;
script.on_init(function()&lt;br /&gt;
    if settings.global[&amp;quot;my-mod-always-difficult&amp;quot;].value == &amp;quot;yes&amp;quot; then&lt;br /&gt;
        game.difficulty_settings.recipe_difficulty = 1&lt;br /&gt;
        game.difficulty_settings.technology_difficulty = 1&lt;br /&gt;
        game.difficulty_settings.technology_price_multiplier = 4&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
script.on_event(defines.events.on_built_entity, function(event)&lt;br /&gt;
    local setting_value = settings.get_player_settings(event.player_index)[&amp;quot;my-mod-kill-player-on-entity-built&amp;quot;].value&lt;br /&gt;
    if setting_value then&lt;br /&gt;
        game.get_player(event.player_index).die()&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Writing to your own settings ===&lt;br /&gt;
It is possible for mods to write to their own runtime (global or per player) mod settings. This is done by writing a new [https://lua-api.factorio.com/latest/Concepts.html#ModSetting ModSetting] table to the setting.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings.lua:&lt;br /&gt;
data:extend({&lt;br /&gt;
    {&lt;br /&gt;
        type = &amp;quot;string-setting&amp;quot;,&lt;br /&gt;
        name = &amp;quot;my-mod-always-difficult&amp;quot;,&lt;br /&gt;
        setting_type = &amp;quot;runtime-global&amp;quot;,&lt;br /&gt;
        default_value = &amp;quot;yes&amp;quot;,&lt;br /&gt;
        allowed_values = {&amp;quot;yes&amp;quot;, &amp;quot;no&amp;quot;}&lt;br /&gt;
    }&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
--in control.lua:&lt;br /&gt;
script.on_event(defines.events.on_rocket_launched, function()&lt;br /&gt;
    settings.global[&amp;quot;my-mod-always-difficult&amp;quot;] = {value = &amp;quot;yes&amp;quot;}&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Changing another mod&#039;s settings ===&lt;br /&gt;
After creating a setting in the settings stage, it is stored in data.raw until the end of the stage, so it can be altered from another mod.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings-updates.lua:&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].order = &amp;quot;abc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the intent is to force the setting to be of a certain value that cannot be modified by players, the properties [[#The_hidden_property|hidden]], allowed_values and forced_value can be used. Modifying existing settings of other mods can be useful for mod packs or other mod compatibility goals.[https://forums.factorio.com/viewtopic.php?p=531322#p531322]&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--in settings-updates.lua:&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].hidden = true&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].allowed_values = {&amp;quot;no&amp;quot;}&lt;br /&gt;
data.raw[&amp;quot;string-setting&amp;quot;][&amp;quot;my-mod-always-difficult&amp;quot;].default_value = &amp;quot;no&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tips ===&lt;br /&gt;
&lt;br /&gt;
* Do not conditionally &#039;require(...)&#039; things depending on mod settings: This breaks the CRC checks and people will get errors trying to use your mod in multiplayer. &#039;require(...)&#039; everything and then conditionally add the values to data.raw using the settings.&lt;br /&gt;
* You should cache the settings table inside the event you use it in. Accessing it is relatively expensive (about as expensive as accessing game.*prototypes[...]), so when accessing it mutliple times within the same event, you should set a local variable to it (within the event) to improve performance.&lt;br /&gt;
** If you want to cache startup/and runtime settings outside of events, you will have to makes sure that the local variable of settings of the setting_type &amp;quot;runtime-global&amp;quot; are updated in the &amp;lt;code&amp;gt;on_runtime_mod_setting_changed&amp;lt;/code&amp;gt; event.&lt;br /&gt;
* If you want to detect whether a certain mod is installed in the settings stage, you can use &amp;lt;code&amp;gt;if mods[&amp;quot;another-mods-name&amp;quot;] then&amp;lt;/code&amp;gt;, just like in the data stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?p=207275 Forum post documenting mod settings]&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?p=305644#p305644 per_user is not a valid property and has no effects!]&lt;br /&gt;
* [http://lua-api.factorio.com/latest/LuaSettings.html Lua api documentation on the settings table]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Prototype/TransportBeltConnectable&amp;diff=190917</id>
		<title>Prototype/TransportBeltConnectable</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Prototype/TransportBeltConnectable&amp;diff=190917"/>
		<updated>2023-03-02T00:55:08Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Mandatory properties */ added in-game speed which is a little more obvious&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Prototype parent|Prototype/EntityWithOwner}}&lt;br /&gt;
Abstract class that anything that is a belt or can connect to belts uses.&lt;br /&gt;
&lt;br /&gt;
{{Prototype TOC|&#039;&#039;abstract&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Extensions ==&lt;br /&gt;
&lt;br /&gt;
* [[Prototype/LinkedBelt]] &#039;&#039;&#039;linked-belt&#039;&#039;&#039;&lt;br /&gt;
* [[Prototype/Loader1x1]] &#039;&#039;&#039;loader-1x1&#039;&#039;&#039;&lt;br /&gt;
* [[Prototype/Loader1x2]] &#039;&#039;&#039;loader&#039;&#039;&#039;&lt;br /&gt;
* [[Prototype/Splitter]] &#039;&#039;&#039;splitter&#039;&#039;&#039;&lt;br /&gt;
* [[Prototype/TransportBelt]] &#039;&#039;&#039;transport-belt&#039;&#039;&#039;&lt;br /&gt;
* [[Prototype/UndergroundBelt]] &#039;&#039;&#039;underground-belt&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
This prototype inherits all the properties from [[Prototype/EntityWithOwner]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|speed|[[Types/double|double]]}}&lt;br /&gt;
The speed of the belt (since 0.17): &amp;lt;code&amp;gt;speed × 480 = x Items/second&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The raw value is expressed as the number of tiles traveled by each item on the belt per tick, relative to the belt&#039;s maximum density - e.g. &amp;lt;code&amp;gt;x items/second ÷ (4 items/lane × 2 lanes/belt × 60 ticks/second) = &amp;lt;speed&amp;gt; belts/tick&amp;lt;/code&amp;gt; where a &amp;quot;belt&amp;quot; is the size of one tile. See [[Transport_belts/Physics]] for more details.&lt;br /&gt;
&lt;br /&gt;
Must be a positive non-infinite number. The number is a fixed point number with 8 bits reserved for decimal precision, meaning the smallest value step is 1/2^8 = 0.00390625. In terms of speed, all speeds are multiples of 1.875 items / s, even though the entity tooltip may show a different rate.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|animation_speed_coefficient|[[Types/double|double]]|1|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|belt_animation_set|[[Types/table|table]]|optional=true}}&lt;br /&gt;
Either this, or all of the properties below this one have to be present.&lt;br /&gt;
&lt;br /&gt;
Table with the following properties:&lt;br /&gt;
&lt;br /&gt;
* animation_set - [[Types/RotatedAnimation|RotatedAnimation]] - Mandatory.&lt;br /&gt;
* east_index - [[Types/uint8|uint8]] - Optional. - Default: 1&lt;br /&gt;
* west_index - [[Types/uint8|uint8]] - Optional. - Default: 2&lt;br /&gt;
* north_index - [[Types/uint8|uint8]] - Optional. - Default: 3&lt;br /&gt;
* south_index - [[Types/uint8|uint8]] - Optional. - Default: 4&lt;br /&gt;
* starting_south_index - [[Types/uint8|uint8]] - Optional. - Default: 13&lt;br /&gt;
* ending_south_index - [[Types/uint8|uint8]] - Optional. - Default: 14&lt;br /&gt;
* starting_west_index - [[Types/uint8|uint8]] - Optional. - Default: 15&lt;br /&gt;
* ending_west_index - [[Types/uint8|uint8]] - Optional. - Default: 16&lt;br /&gt;
* starting_north_index - [[Types/uint8|uint8]] - Optional. - Default: 17&lt;br /&gt;
* ending_north_index - [[Types/uint8|uint8]] - Optional. - Default: 18&lt;br /&gt;
* starting_east_index - [[Types/uint8|uint8]] - Optional. - Default: 19&lt;br /&gt;
* ending_east_index - [[Types/uint8|uint8]] - Optional. - Default: 20&lt;br /&gt;
* ending_patch - [[Types/Sprite4Way|Sprite4Way]] - Optional.&lt;br /&gt;
* ends_with_stopper - [[Types/bool|bool]] - Optional. - Default: false&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|belt_horizontal|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|belt_vertical|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ending_top|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ending_bottom|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ending_side|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|starting_top|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|starting_bottom|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|starting_side|[[Types/Animation|Animation]]|optional=true}}&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ending_patch|[[Types/Sprite4Way|Sprite4Way]]|optional=true}}&lt;br /&gt;
Always optional. Only read if &amp;lt;code&amp;gt;belt_animation_set&amp;lt;/code&amp;gt; is not present.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ends_with_stopper|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
&lt;br /&gt;
== Mandatory values ==&lt;br /&gt;
Transport belt connectables have additional requirements for the properties inherited from [[Prototype/Entity]]:&lt;br /&gt;
* Transport belt connectable entities must collide with [[Types/CollisionMask#Layers|&amp;quot;transport-belt-layer&amp;quot;]].&lt;br /&gt;
* Transport belt connectable entities must have [[Types/CollisionMask#Collision_options|collision mask]] that collides with itself.&lt;br /&gt;
* Transport belt connectable entities cannot have collision mask that collides only with tiles (must collide with entities in some way).&lt;br /&gt;
* Transport belt connectable entities must have collision box of an appropriate minimal size, they should occupy more than half of every tile the entity covers.&lt;br /&gt;
* Transport belt connectable entities cannot have the [[Types/EntityPrototypeFlags#.22placeable-off-grid.22|&amp;quot;placeable-off-grid&amp;quot;]] flag specified.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/SpiderLegSpecification&amp;diff=190889</id>
		<title>Types/SpiderLegSpecification</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/SpiderLegSpecification&amp;diff=190889"/>
		<updated>2023-02-26T23:33:11Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* leg_hit_the_ground_trigger */ position isn&amp;#039;t in the script event, not sure about other triggers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Used by [[Types/SpiderEnginePrototype]] for [[Prototype/SpiderVehicle]].&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
=== leg ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Name of a [[Prototype/SpiderLeg]].&lt;br /&gt;
&lt;br /&gt;
=== mount_position ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/vector|vector]]&lt;br /&gt;
&lt;br /&gt;
=== ground_position ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/vector|vector]]&lt;br /&gt;
&lt;br /&gt;
=== blocking_legs ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table|array]] of [[Types/uint32|uint32]]&lt;br /&gt;
&lt;br /&gt;
The 1-based indices of the legs that should block this leg&#039;s movement.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
=== leg_hit_the_ground_trigger ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/TriggerEffect|TriggerEffect]]&lt;br /&gt;
&lt;br /&gt;
For triggers, the source and target is the leg entity. Certain effects may not raise as desired, e.g. &amp;lt;code&amp;gt;&amp;quot;push-back&amp;quot;&amp;lt;/code&amp;gt; does nothing, and &amp;lt;code&amp;gt;&amp;quot;script&amp;quot;&amp;lt;/code&amp;gt; has leg as the source and target of the event.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/SpiderLegSpecification&amp;diff=190888</id>
		<title>Types/SpiderLegSpecification</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/SpiderLegSpecification&amp;diff=190888"/>
		<updated>2023-02-26T23:31:46Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* leg_hit_the_ground_trigger */ little bit of details for how triggers act&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Used by [[Types/SpiderEnginePrototype]] for [[Prototype/SpiderVehicle]].&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
=== leg ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
Name of a [[Prototype/SpiderLeg]].&lt;br /&gt;
&lt;br /&gt;
=== mount_position ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/vector|vector]]&lt;br /&gt;
&lt;br /&gt;
=== ground_position ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/vector|vector]]&lt;br /&gt;
&lt;br /&gt;
=== blocking_legs ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table|array]] of [[Types/uint32|uint32]]&lt;br /&gt;
&lt;br /&gt;
The 1-based indices of the legs that should block this leg&#039;s movement.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
=== leg_hit_the_ground_trigger ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/TriggerEffect|TriggerEffect]]&lt;br /&gt;
&lt;br /&gt;
For triggers, the source and target is the leg entity and &amp;quot;foot&amp;quot; position. Certain effects may not raise as desired, e.g. &amp;lt;code&amp;gt;&amp;quot;push-back&amp;quot;&amp;lt;/code&amp;gt; does nothing, and &amp;lt;code&amp;gt;&amp;quot;script&amp;quot;&amp;lt;/code&amp;gt; has leg as the source and target of the event.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Localisation&amp;diff=190636</id>
		<title>Tutorial:Localisation</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Localisation&amp;diff=190636"/>
		<updated>2023-01-07T13:38:38Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* File format */ category&amp;#039;s need not be built-ins.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}Mods should define human readable names for prototypes that they add. They can also define descriptions for items or custom strings for usage in GUIs etc. This is called &#039;&#039;&#039;localisation&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
Translations are stored as .cfg files, with the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;welcome-message=Hello world&lt;br /&gt;
[category]&lt;br /&gt;
title=Category related title&lt;br /&gt;
# Comment&lt;br /&gt;
; Another comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
Any whitespace after or before &amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt; is included in the key or string, so &amp;lt;code&amp;gt;title =Category related title&amp;lt;/code&amp;gt; will give an unknown key error if you are looking for the &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; key, since it is the &amp;lt;code&amp;gt;title&amp;amp;nbsp;&amp;lt;/code&amp;gt; key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt; can be one of the existing locale categories, which permits implicit search mechanisms to find translations, but may also be another key, such as &amp;lt;code&amp;gt;[my-mod-messages]&amp;lt;/code&amp;gt;. These are accessible the same as other translations, e.g. &amp;lt;code&amp;gt;{&amp;quot;my-mod-messages.hello&amp;quot;}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These files are located within the language code of the language in the locale folder of the mod, so as an English example &amp;lt;code&amp;gt;__mod__/locale/en/any_name_here.cfg&amp;lt;/code&amp;gt;. There can be more than 1 file per language, all of them will be read.&lt;br /&gt;
&lt;br /&gt;
== Localising simple strings ==&lt;br /&gt;
The simplest localisation is of items, entities etc. If we say the item is &amp;lt;code&amp;gt;iron-plate&amp;lt;/code&amp;gt;, the game will then search all loaded locale files for &amp;lt;code&amp;gt;item-name.iron-plate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;item-description.iron-plate&amp;lt;/code&amp;gt;, which in the locale file looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[item-name]&lt;br /&gt;
iron-plate=Iron plate&lt;br /&gt;
[item-description]&lt;br /&gt;
iron-plate=A plate made of iron.&amp;lt;/pre&amp;gt;&lt;br /&gt;
If found in the locale, the label is set to this string. If not found, the game will instead show: &amp;lt;code&amp;gt;Unknown key: &amp;amp;quot;item-name.iron-plate&amp;amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In script, the localised string is formatted as &amp;lt;code&amp;gt;{&amp;amp;quot;category.name&amp;amp;quot;}&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;game.print({&amp;amp;quot;item-name.iron-plate&amp;amp;quot;})&amp;lt;/code&amp;gt; prints &#039;&#039;Iron plate&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It is possible to use [[rich text]] features in the localised text if the location where the text is shown supports it, e.g. in the chat, prototype names and prototype tooltips.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; can be used for line breaks if the location where the text is shown supports multiline text.&lt;br /&gt;
&lt;br /&gt;
== Localising with parameters ==&lt;br /&gt;
For more complex strings, localisation parameters can be used. For instance we want to show &#039;&#039;Time left: 10 minutes.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So a key with a placeholder is defined, which is replaced by the first parameter after the locale key.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;time-left=Time left: __1__ minutes.&amp;lt;/pre&amp;gt;&lt;br /&gt;
So it is used like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;time-left&amp;quot;, 10})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
It also works with multiple parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;time-left&amp;quot;, 10, 45})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;time-left=Time left: __1__ minutes and __2__ seconds.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Which results in &#039;&#039;Time left: 10 minutes and 45 seconds.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Built-in parameters ===&lt;br /&gt;
For some situations, we use localisation to show control schemes. For instance we want to say:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;technology-prompt=Use T to open the technology screen&amp;lt;/pre&amp;gt;&lt;br /&gt;
However the player may have rebound the key, but we can’t figure out which key as it would not be deterministic. So instead we use the built-in replacement functionality&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;technology-prompt=Use __CONTROL__open-technology-gui__ to open the technology screen.&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can also use this for items and entities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;big-iron-plate=Big __ITEM__iron-plate__&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;tiny-gun-turret=Tiny __ENTITY__gun-turret__&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== List of built-in parameters ====&lt;br /&gt;
&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; is the name of an internal game control or a prototype name, depending on context. &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; can be 1 or 2, it&#039;s used in parameters that control [[#Localising_alternate_input_names|alternate input names]]. For a list of internal game control names, see [[Prototype/CustomInput#linked_game_control]].&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL__name__&amp;lt;/code&amp;gt; - The combination of modifiers and input, such as &amp;quot;Control + Alt + Left-click&amp;quot;, or &amp;quot;Not set&amp;quot;.&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_MODIFIER__name__&amp;lt;/code&amp;gt; - The modifiers, such as &amp;quot;ControlShift&amp;quot;, or, &amp;quot;No modifier selected.&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_STYLE_BEGIN__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_STYLE_END__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_LEFT_CLICK__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-b&amp;lt;/code&amp;gt;[https://crowdin.com/project/factorio/discussions/214]&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_RIGHT_CLICK__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-2&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-x&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_KEY_SHIFT__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.shift&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-leftshoulder&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_KEY_CTRL__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.control&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-rightshoulder&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL_LEFT_CLICK__n__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-1-alt-n&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-button-alt-n&amp;lt;/code&amp;gt; (with parameter &amp;lt;code&amp;gt;control-keys.controller-b&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL_RIGHT_CLICK__n__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-2-alt-n&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-button-alt-n&amp;lt;/code&amp;gt; (with parameter &amp;lt;code&amp;gt;control-keys.controller-x&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;__REMARK_COLOR_BEGIN__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__REMARK_COLOR_END__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL__n__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_MOVE__&amp;lt;/code&amp;gt; - The Movement keys, squished together. Example: &amp;quot;WASD&amp;quot;, from a conventional QWERTY English keyboard.&lt;br /&gt;
* &amp;lt;code&amp;gt;__ENTITY__name__&amp;lt;/code&amp;gt; - The localised_name of the [[Prototype/Entity]] extension.&lt;br /&gt;
* &amp;lt;code&amp;gt;__ITEM__name__&amp;lt;/code&amp;gt; - The localised_name of the [[Prototype/Item]] or extension.&lt;br /&gt;
* &amp;lt;code&amp;gt;__TILE__name__&amp;lt;/code&amp;gt; - The localised_name of the [[Prototype/Tile]].&lt;br /&gt;
* &amp;lt;code&amp;gt;__FLUID__name__&amp;lt;/code&amp;gt; - The localised_name of the [[Prototype/Fluid]].&lt;br /&gt;
&lt;br /&gt;
=== Plurals ===&lt;br /&gt;
Pluralization can be used in any string that uses a parameter (e.g. __1__) that is numeric, so something like an amount of minutes. It can be used multiple times per string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;format-days=__1__ __plural_for_parameter_1_{1=day|rest=days}__&amp;lt;/pre&amp;gt;&lt;br /&gt;
This results in &amp;quot;1 day&amp;quot; and &amp;quot;2 days&amp;quot; / &amp;quot;500 days&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
The number after &amp;lt;code&amp;gt;__plural_for_parameter_&amp;lt;/code&amp;gt; denotes which parameter is used to determine the plural. This is the parameter 1 in the above example. Anything inside the {} is used to make the plural. Each plural form is separated by a |.&lt;br /&gt;
The text in front of the = determines for what the plural form is used. Options for this are:&lt;br /&gt;
* a simple number, e.g. &amp;quot;1&amp;quot;.&lt;br /&gt;
* Multiple numbers, e.g. &amp;quot;2,3,4&amp;quot;.&lt;br /&gt;
* What the number ends with, e.g. &amp;quot;ends in 11&amp;quot; or &amp;quot;ends in 1&amp;quot;&lt;br /&gt;
* Multiple ends with, e.g. &amp;quot;ends in 1,ends in 2,ends in 12&amp;quot;.&lt;br /&gt;
* &amp;quot;rest&amp;quot; to give the default plural.&lt;br /&gt;
&lt;br /&gt;
Plural forms may be empty or contain other keys such as __1__ or spaces. This allows rather large plural forms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;__plural_for_parameter_1_{1=__1__ player is|rest=__1__ players are}__ connecting&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system chooses the first fitting plural that it encounters when multiple would fit:&lt;br /&gt;
&amp;lt;pre&amp;gt;__plural_for_parameter_1_{ends in 12=option 1|ends in 2=option 2|rest=option 3}__&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will result in &amp;quot;option 1&amp;quot; for 12 and in &amp;quot;option 2&amp;quot; for 22 and in &amp;quot;option 3&amp;quot; for numbers not ending with 2.&lt;br /&gt;
&lt;br /&gt;
=== Concatenating localised strings ===&lt;br /&gt;
The special locale key: &amp;lt;code&amp;gt;&amp;amp;quot;&amp;amp;quot;&amp;lt;/code&amp;gt; is used to concatenate, as the table format does not support concatenation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;&amp;quot;, {&amp;quot;item-name.iron-plate&amp;quot;}, &amp;quot;: &amp;quot;, 60})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Will result in: &#039;&#039;Iron plate: 60&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Localising alternate input names ===&lt;br /&gt;
&lt;br /&gt;
In the introduction campaign, a special locale system is used for informing players how to do certain actions with their mouse.&lt;br /&gt;
The normal form is to use eg:&lt;br /&gt;
&amp;lt;pre&amp;gt;how-to-build=Use __CONTROL__build__ to place a building&amp;lt;/pre&amp;gt;&lt;br /&gt;
which results in &amp;quot;Use Left mouse button to place a building&amp;quot;. A more natural phrasing would be &amp;quot;Left-click to place a building&amp;quot;, which can be achieved by using the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;how-to-build=__ALT_CONTROL__1__build__ to place a building&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These &amp;quot;alt&amp;quot; versions are controlled by a few special locale keys, mouse-button-X-alt-1 and mouse-button-X-alt-2. In English, form 1 produces eg &amp;quot;Left-click&amp;quot;, and form 2 produces eg &amp;quot;Left-clicking&amp;quot;.  Only two alt forms (&amp;quot;1&amp;quot; and &amp;quot;2&amp;quot;) are available at the moment, but if this a problem for some languages, more forms may be added in the future.&lt;br /&gt;
Extra mouse buttons, mouse scroll and keyboard keys are handled through the mouse-button-n-alt-1/2, mouse-wheel-alt-1/2 and keyboard-alt-1/2 keys, which just take the normal name and prepend something like &amp;quot;Press/Pressing&amp;quot;, or &amp;quot;Scroll/Scrolling&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When translating to another language, you can use whatever forms you want here, but the important part is that you are consistent when you use the alt-forms everywhere else. It does not necessarily make sense to just copy the usages of alt forms from the English locale, and for some languages it may be more natural to simply not use this system at all.&lt;br /&gt;
&lt;br /&gt;
== Accessing the localised result in code ==&lt;br /&gt;
While usually unneeded, it is possible to read the resulting localised text in code, for example to search in localised names. See [https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.request_translation LuaPlayer::request_translation] and  [https://lua-api.factorio.com/latest/events.html#on_string_translated on_string_translated event].&lt;br /&gt;
&lt;br /&gt;
== Default Behavior(s) for finding an Unspecified Localised String ==&lt;br /&gt;
If a localised_string is not defined in the prototype for certain prototype classes, e.g. entity, item, Factorio may have a default search behavior.&lt;br /&gt;
&lt;br /&gt;
Determining an item&#039;s localised name:&lt;br /&gt;
Note: the angle brackets are meant to mean a generic term, they are not part of the actual string. Also, place_result and placed_as_equipment_result are strings, and Factorio fetches the matching prototype to examine.&lt;br /&gt;
&lt;br /&gt;
# if localised_name is provided in the item prototype and it is not empty {}, use the provided value&lt;br /&gt;
# else if there is place_result and it has localised_name that is not an empty table: {}, use the localised_name of place_result&lt;br /&gt;
# else if there is place_result with an empty localised_name, use {&amp;quot;entity-name.&amp;lt;entity prototype name&amp;gt;&amp;quot;}&lt;br /&gt;
# else if there is placed_as_equipment_result and it has a localised_name that is not an empty table: {}, use the localised_name of placed_as_equipment_result&lt;br /&gt;
# else if there is placed_as_equipment_result with empty localised_name, use {&amp;quot;equipment-name.&amp;lt;equipment name&amp;gt;&amp;quot;}&lt;br /&gt;
# else use default {&amp;quot;item-name.&amp;lt;item name&amp;gt;&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Reference: [https://forums.factorio.com/viewtopic.php?p=494243#p494243]&lt;br /&gt;
&lt;br /&gt;
Example: The transport-belt item does not have a localised_name, so 1-&amp;gt;2. There is a place result, but not localised_name in the entity prototype. 2-&amp;gt;3. The place result lacks a localised_name. Use the localised string {&amp;quot;entity-name.transport-belt&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Such defaults often include a &amp;quot;leading key&amp;quot; using [&amp;lt;group&amp;gt;-name] or [&amp;lt;group&amp;gt;-description] (such as [recipe-name], [mod-setting-description]). However, each prototype may have a distinct search behavior before using those, based on presence/absence of values in the prototype. [[Prototype/Recipe]] for example may use the first product&#039;s localised_name, or the main_product&#039;s localised_name, or the localised string found in {&amp;quot;recipe-name.&amp;lt;recipe name&amp;gt;&amp;quot;], depending on values provided (and lacking) in the prototype.&lt;br /&gt;
&lt;br /&gt;
== Scenario Name and Description ==&lt;br /&gt;
Scenarios have special keys, before a [category]. &amp;lt;code&amp;gt;scenario-name&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt; allow for localising the name and description while selecting from a &#039;Start new game&#039; scenario selector. Example from freeplay/locale/en/freeplay.cfg (msg-intro is not included because it is not special):&lt;br /&gt;
&lt;br /&gt;
:scenario-name=Freeplay&lt;br /&gt;
:description=Your task is to launch a rocket into space. Start from nothing, work your way up with automation, and don&#039;t forget to protect yourself from the natives.\n[font=default-bold]This is the intended way of playing Factorio.[/font]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Types/LocalisedString|LocalisedString data stage doc]]&lt;br /&gt;
* [https://lua-api.factorio.com/latest/Concepts.html#LocalisedString LocalisedString control stage doc]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/LocalisedString&amp;diff=190635</id>
		<title>Types/LocalisedString</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/LocalisedString&amp;diff=190635"/>
		<updated>2023-01-07T05:43:56Z</updated>

		<summary type="html">&lt;p&gt;Honktown: Added second paragraph, an explanation of what the localised string means in the more general context.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Localised strings are a way to support translation of in-game text. It is an array where the first element is the &#039;&#039;key&#039;&#039; and the remaining elements are parameters that will be substituted for placeholders in the template designated by the key.&lt;br /&gt;
&lt;br /&gt;
When presented to a player, what appears to &#039;&#039;each&#039;&#039; player is determined by their Language (as chosen by game setting). As Language is set per-player, and Factorio must reach the same results for every player, a localised string offers a player-independent &#039;&#039;&#039;code&#039;&#039;&#039; representation. The Factorio API Docs provide the means to expose a translation, during gameplay, to everyone. Stated a different way, any place a translation is visible is not available for code to access &amp;quot;as it appears to be&amp;quot;, because it would result in different outcomes for different players. The localised string provides an abstract representation, preventing inconsistencies.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;key&#039;&#039; identifies the string template. For example, &amp;quot;gui-alert-tooltip.attack&amp;quot; (for the template &amp;quot;__1__ objects are being damaged&amp;quot;; see the file data/core/locale/en.cfg). In the data stage, this key cannot be longer than 200 characters. &lt;br /&gt;
&lt;br /&gt;
The template can contain placeholders such as __1__ or __2__. These will be replaced by the respective parameter in the LocalisedString. The parameters themselves can be other localised strings, which will be processed recursively in the same fashion. Localised strings cannot be recursed deeper than 20 levels and cannot have more than 20 parameters.&lt;br /&gt;
&lt;br /&gt;
As a special case, when the key is just the empty string, all the parameters will be concatenated (after processing, if any are localised strings). If there is only one parameter, it will be used as is.&lt;br /&gt;
&lt;br /&gt;
Furthermore, when an API function expects a localised string, it will also accept a regular string (i.e. not a table) which will not be translated, or a number or boolean which will be converted to its textual representation.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
In the English translation, this will print &amp;quot;No ammo&amp;quot;; in the Czech translation, it will print &amp;quot;Bez munice&amp;quot;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.player.print({&amp;quot;description.no-ammo&amp;quot;})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The description.no-ammo template contains no placeholders, so no further parameters are necessary.&lt;br /&gt;
&lt;br /&gt;
In the English translation, this will print &amp;quot;Durability: 5/9&amp;quot;; in the Japanese one, it will print &amp;quot;耐久度: 5/9&amp;quot;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.player.print({&amp;quot;description.durability&amp;quot;, 5, 9})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will print &amp;quot;hello&amp;quot; in all translations:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.player.print({&amp;quot;&amp;quot;, &amp;quot;hello&amp;quot;})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will print &amp;quot;Iron plate: 60&amp;quot; in the English translation and &amp;quot;Eisenplatte: 60&amp;quot; in the German translation.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;&amp;quot;, {&amp;quot;item-name.iron-plate&amp;quot;}, &amp;quot;: &amp;quot;, 60})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [https://lua-api.factorio.com/latest/Concepts.html#LocalisedString Control stage doc]&lt;br /&gt;
* [[Tutorial:Localisation]]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Localisation&amp;diff=190634</id>
		<title>Tutorial:Localisation</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Localisation&amp;diff=190634"/>
		<updated>2023-01-07T05:02:22Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* List of built-in parameters */ detail / examples&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}Mods should define human readable names for prototypes that they add. They can also define descriptions for items or custom strings for usage in GUIs etc. This is called &#039;&#039;&#039;localisation&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
Translations are stored as .cfg files, with the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;welcome-message=Hello world&lt;br /&gt;
[category]&lt;br /&gt;
title=Category related title&lt;br /&gt;
# Comment&lt;br /&gt;
; Another comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
Any whitespace after or before &amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt; is included in the key or string, so &amp;lt;code&amp;gt;title =Category related title&amp;lt;/code&amp;gt; will give an unknown key error if you are looking for the &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; key, since it is the &amp;lt;code&amp;gt;title&amp;amp;nbsp;&amp;lt;/code&amp;gt; key.&lt;br /&gt;
&lt;br /&gt;
These files are located within the language code of the language in the locale folder of the mod, so as an English example &amp;lt;code&amp;gt;__mod__/locale/en/any_name_here.cfg&amp;lt;/code&amp;gt;. There can be more than 1 file per language, all of them will be read.&lt;br /&gt;
&lt;br /&gt;
== Localising simple strings ==&lt;br /&gt;
The simplest localisation is of items, entities etc. If we say the item is &amp;lt;code&amp;gt;iron-plate&amp;lt;/code&amp;gt;, the game will then search all loaded locale files for &amp;lt;code&amp;gt;item-name.iron-plate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;item-description.iron-plate&amp;lt;/code&amp;gt;, which in the locale file looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[item-name]&lt;br /&gt;
iron-plate=Iron plate&lt;br /&gt;
[item-description]&lt;br /&gt;
iron-plate=A plate made of iron.&amp;lt;/pre&amp;gt;&lt;br /&gt;
If found in the locale, the label is set to this string. If not found, the game will instead show: &amp;lt;code&amp;gt;Unknown key: &amp;amp;quot;item-name.iron-plate&amp;amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In script, the localised string is formatted as &amp;lt;code&amp;gt;{&amp;amp;quot;category.name&amp;amp;quot;}&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;game.print({&amp;amp;quot;item-name.iron-plate&amp;amp;quot;})&amp;lt;/code&amp;gt; prints &#039;&#039;Iron plate&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It is possible to use [[rich text]] features in the localised text if the location where the text is shown supports it, e.g. in the chat, prototype names and prototype tooltips.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; can be used for line breaks if the location where the text is shown supports multiline text.&lt;br /&gt;
&lt;br /&gt;
== Localising with parameters ==&lt;br /&gt;
For more complex strings, localisation parameters can be used. For instance we want to show &#039;&#039;Time left: 10 minutes.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So a key with a placeholder is defined, which is replaced by the first parameter after the locale key.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;time-left=Time left: __1__ minutes.&amp;lt;/pre&amp;gt;&lt;br /&gt;
So it is used like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;time-left&amp;quot;, 10})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
It also works with multiple parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;time-left&amp;quot;, 10, 45})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;time-left=Time left: __1__ minutes and __2__ seconds.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Which results in &#039;&#039;Time left: 10 minutes and 45 seconds.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Built-in parameters ===&lt;br /&gt;
For some situations, we use localisation to show control schemes. For instance we want to say:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;technology-prompt=Use T to open the technology screen&amp;lt;/pre&amp;gt;&lt;br /&gt;
However the player may have rebound the key, but we can’t figure out which key as it would not be deterministic. So instead we use the built-in replacement functionality&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;technology-prompt=Use __CONTROL__open-technology-gui__ to open the technology screen.&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can also use this for items and entities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;big-iron-plate=Big __ITEM__iron-plate__&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;tiny-gun-turret=Tiny __ENTITY__gun-turret__&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== List of built-in parameters ====&lt;br /&gt;
&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; is the name of an internal game control or a prototype name, depending on context. &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; can be 1 or 2, it&#039;s used in parameters that control [[#Localising_alternate_input_names|alternate input names]]. For a list of internal game control names, see [[Prototype/CustomInput#linked_game_control]].&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL__name__&amp;lt;/code&amp;gt; - The combination of modifiers and input, such as &amp;quot;Control + Alt + Left-click&amp;quot;, or &amp;quot;Not set&amp;quot;.&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_MODIFIER__name__&amp;lt;/code&amp;gt; - The modifiers, such as &amp;quot;ControlShift&amp;quot;, or, &amp;quot;No modifier selected.&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_STYLE_BEGIN__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_STYLE_END__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_LEFT_CLICK__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-b&amp;lt;/code&amp;gt;[https://crowdin.com/project/factorio/discussions/214]&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_RIGHT_CLICK__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-2&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-x&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_KEY_SHIFT__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.shift&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-leftshoulder&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_KEY_CTRL__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.control&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-rightshoulder&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL_LEFT_CLICK__n__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-1-alt-n&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-button-alt-n&amp;lt;/code&amp;gt; (with parameter &amp;lt;code&amp;gt;control-keys.controller-b&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL_RIGHT_CLICK__n__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-2-alt-n&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-button-alt-n&amp;lt;/code&amp;gt; (with parameter &amp;lt;code&amp;gt;control-keys.controller-x&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;__REMARK_COLOR_BEGIN__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__REMARK_COLOR_END__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL__n__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_MOVE__&amp;lt;/code&amp;gt; - The Movement keys, squished together. Example: &amp;quot;WASD&amp;quot;, from a conventional QWERTY English keyboard.&lt;br /&gt;
* &amp;lt;code&amp;gt;__ENTITY__name__&amp;lt;/code&amp;gt; - The localised_name of the [[Prototype/Entity]] extension.&lt;br /&gt;
* &amp;lt;code&amp;gt;__ITEM__name__&amp;lt;/code&amp;gt; - The localised_name of the [[Prototype/Item]] or extension.&lt;br /&gt;
* &amp;lt;code&amp;gt;__TILE__name__&amp;lt;/code&amp;gt; - The localised_name of the [[Prototype/Tile]].&lt;br /&gt;
* &amp;lt;code&amp;gt;__FLUID__name__&amp;lt;/code&amp;gt; - The localised_name of the [[Prototype/Fluid]].&lt;br /&gt;
&lt;br /&gt;
=== Plurals ===&lt;br /&gt;
Pluralization can be used in any string that uses a parameter (e.g. __1__) that is numeric, so something like an amount of minutes. It can be used multiple times per string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;format-days=__1__ __plural_for_parameter_1_{1=day|rest=days}__&amp;lt;/pre&amp;gt;&lt;br /&gt;
This results in &amp;quot;1 day&amp;quot; and &amp;quot;2 days&amp;quot; / &amp;quot;500 days&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
The number after &amp;lt;code&amp;gt;__plural_for_parameter_&amp;lt;/code&amp;gt; denotes which parameter is used to determine the plural. This is the parameter 1 in the above example. Anything inside the {} is used to make the plural. Each plural form is separated by a |.&lt;br /&gt;
The text in front of the = determines for what the plural form is used. Options for this are:&lt;br /&gt;
* a simple number, e.g. &amp;quot;1&amp;quot;.&lt;br /&gt;
* Multiple numbers, e.g. &amp;quot;2,3,4&amp;quot;.&lt;br /&gt;
* What the number ends with, e.g. &amp;quot;ends in 11&amp;quot; or &amp;quot;ends in 1&amp;quot;&lt;br /&gt;
* Multiple ends with, e.g. &amp;quot;ends in 1,ends in 2,ends in 12&amp;quot;.&lt;br /&gt;
* &amp;quot;rest&amp;quot; to give the default plural.&lt;br /&gt;
&lt;br /&gt;
Plural forms may be empty or contain other keys such as __1__ or spaces. This allows rather large plural forms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;__plural_for_parameter_1_{1=__1__ player is|rest=__1__ players are}__ connecting&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system chooses the first fitting plural that it encounters when multiple would fit:&lt;br /&gt;
&amp;lt;pre&amp;gt;__plural_for_parameter_1_{ends in 12=option 1|ends in 2=option 2|rest=option 3}__&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will result in &amp;quot;option 1&amp;quot; for 12 and in &amp;quot;option 2&amp;quot; for 22 and in &amp;quot;option 3&amp;quot; for numbers not ending with 2.&lt;br /&gt;
&lt;br /&gt;
=== Concatenating localised strings ===&lt;br /&gt;
The special locale key: &amp;lt;code&amp;gt;&amp;amp;quot;&amp;amp;quot;&amp;lt;/code&amp;gt; is used to concatenate, as the table format does not support concatenation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;&amp;quot;, {&amp;quot;item-name.iron-plate&amp;quot;}, &amp;quot;: &amp;quot;, 60})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Will result in: &#039;&#039;Iron plate: 60&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Localising alternate input names ===&lt;br /&gt;
&lt;br /&gt;
In the introduction campaign, a special locale system is used for informing players how to do certain actions with their mouse.&lt;br /&gt;
The normal form is to use eg:&lt;br /&gt;
&amp;lt;pre&amp;gt;how-to-build=Use __CONTROL__build__ to place a building&amp;lt;/pre&amp;gt;&lt;br /&gt;
which results in &amp;quot;Use Left mouse button to place a building&amp;quot;. A more natural phrasing would be &amp;quot;Left-click to place a building&amp;quot;, which can be achieved by using the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;how-to-build=__ALT_CONTROL__1__build__ to place a building&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These &amp;quot;alt&amp;quot; versions are controlled by a few special locale keys, mouse-button-X-alt-1 and mouse-button-X-alt-2. In English, form 1 produces eg &amp;quot;Left-click&amp;quot;, and form 2 produces eg &amp;quot;Left-clicking&amp;quot;.  Only two alt forms (&amp;quot;1&amp;quot; and &amp;quot;2&amp;quot;) are available at the moment, but if this a problem for some languages, more forms may be added in the future.&lt;br /&gt;
Extra mouse buttons, mouse scroll and keyboard keys are handled through the mouse-button-n-alt-1/2, mouse-wheel-alt-1/2 and keyboard-alt-1/2 keys, which just take the normal name and prepend something like &amp;quot;Press/Pressing&amp;quot;, or &amp;quot;Scroll/Scrolling&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When translating to another language, you can use whatever forms you want here, but the important part is that you are consistent when you use the alt-forms everywhere else. It does not necessarily make sense to just copy the usages of alt forms from the English locale, and for some languages it may be more natural to simply not use this system at all.&lt;br /&gt;
&lt;br /&gt;
== Accessing the localised result in code ==&lt;br /&gt;
While usually unneeded, it is possible to read the resulting localised text in code, for example to search in localised names. See [https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.request_translation LuaPlayer::request_translation] and  [https://lua-api.factorio.com/latest/events.html#on_string_translated on_string_translated event].&lt;br /&gt;
&lt;br /&gt;
== Default Behavior(s) for finding an Unspecified Localised String ==&lt;br /&gt;
If a localised_string is not defined in the prototype for certain prototype classes, e.g. entity, item, Factorio may have a default search behavior.&lt;br /&gt;
&lt;br /&gt;
Determining an item&#039;s localised name:&lt;br /&gt;
Note: the angle brackets are meant to mean a generic term, they are not part of the actual string. Also, place_result and placed_as_equipment_result are strings, and Factorio fetches the matching prototype to examine.&lt;br /&gt;
&lt;br /&gt;
# if localised_name is provided in the item prototype and it is not empty {}, use the provided value&lt;br /&gt;
# else if there is place_result and it has localised_name that is not an empty table: {}, use the localised_name of place_result&lt;br /&gt;
# else if there is place_result with an empty localised_name, use {&amp;quot;entity-name.&amp;lt;entity prototype name&amp;gt;&amp;quot;}&lt;br /&gt;
# else if there is placed_as_equipment_result and it has a localised_name that is not an empty table: {}, use the localised_name of placed_as_equipment_result&lt;br /&gt;
# else if there is placed_as_equipment_result with empty localised_name, use {&amp;quot;equipment-name.&amp;lt;equipment name&amp;gt;&amp;quot;}&lt;br /&gt;
# else use default {&amp;quot;item-name.&amp;lt;item name&amp;gt;&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Reference: [https://forums.factorio.com/viewtopic.php?p=494243#p494243]&lt;br /&gt;
&lt;br /&gt;
Example: The transport-belt item does not have a localised_name, so 1-&amp;gt;2. There is a place result, but not localised_name in the entity prototype. 2-&amp;gt;3. The place result lacks a localised_name. Use the localised string {&amp;quot;entity-name.transport-belt&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Such defaults often include a &amp;quot;leading key&amp;quot; using [&amp;lt;group&amp;gt;-name] or [&amp;lt;group&amp;gt;-description] (such as [recipe-name], [mod-setting-description]). However, each prototype may have a distinct search behavior before using those, based on presence/absence of values in the prototype. [[Prototype/Recipe]] for example may use the first product&#039;s localised_name, or the main_product&#039;s localised_name, or the localised string found in {&amp;quot;recipe-name.&amp;lt;recipe name&amp;gt;&amp;quot;], depending on values provided (and lacking) in the prototype.&lt;br /&gt;
&lt;br /&gt;
== Scenario Name and Description ==&lt;br /&gt;
Scenarios have special keys, before a [category]. &amp;lt;code&amp;gt;scenario-name&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt; allow for localising the name and description while selecting from a &#039;Start new game&#039; scenario selector. Example from freeplay/locale/en/freeplay.cfg (msg-intro is not included because it is not special):&lt;br /&gt;
&lt;br /&gt;
:scenario-name=Freeplay&lt;br /&gt;
:description=Your task is to launch a rocket into space. Start from nothing, work your way up with automation, and don&#039;t forget to protect yourself from the natives.\n[font=default-bold]This is the intended way of playing Factorio.[/font]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Types/LocalisedString|LocalisedString data stage doc]]&lt;br /&gt;
* [https://lua-api.factorio.com/latest/Concepts.html#LocalisedString LocalisedString control stage doc]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/FluidBox&amp;diff=190601</id>
		<title>Types/FluidBox</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/FluidBox&amp;diff=190601"/>
		<updated>2022-12-26T12:04:57Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* base_level */ small word change to reduce ambiguity (height of self vs where it&amp;#039;s positioned)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basics ==&lt;br /&gt;
[[File:Fluidboxes.png|thumb|550px|Visual representation of base_area, base_level and height. When all the fluidboxes are connected, the water leaves fluidbox A and flows into the other 3 boxes through fluidbox B until the water level is equal in all boxes. For more info about fluids, see [[Fluid system#See also]].]]&lt;br /&gt;
Used to set the fluid amount an entity can hold, as well as the connection points for pipes leading into and out of the entity.&lt;br /&gt;
&lt;br /&gt;
Entities can have multiple fluidboxes. These can be part of a [[Types/EnergySource#Fluid_energy_source]] or be specified directly in the entity prototype. &lt;br /&gt;
&lt;br /&gt;
A fluidbox can store only one type of fluid at a time. However, a fluid system (multiple connected fluid boxes) can contain multiple different fluids, see [[Fluid_system#Fluid_mixing]]. &lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
&lt;br /&gt;
=== pipe_connections ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/PipeConnectionDefinition]]&lt;br /&gt;
&lt;br /&gt;
Max number of members is 255.&lt;br /&gt;
&lt;br /&gt;
Connection points to connect to other fluidboxes. This is also marked as blue arrows in alt mode.&lt;br /&gt;
Fluid may flow in or out depending on the `type` field of each connection.&lt;br /&gt;
Connection points may depend on the direction the entity is facing.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
&lt;br /&gt;
=== base_area ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Must be greater than 0. The total fluid capacity of the fluid box is &amp;lt;code&amp;gt;base_area × height × 100&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== base_level ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Base level is the elevation of the invisible fluid box.&lt;br /&gt;
0 is ground level.&lt;br /&gt;
 &lt;br /&gt;
-1 puts the &#039;&#039;&#039;top&#039;&#039;&#039; of the fluid box at the &#039;&#039;&#039;bottom&#039;&#039;&#039; of a pipe connection, so, fluid &amp;quot;falls&amp;quot; in to it, and can&#039;t get out. &lt;br /&gt;
&lt;br /&gt;
1 puts the &#039;&#039;&#039;bottom&#039;&#039;&#039; of the fluid box at the &#039;&#039;&#039;top&#039;&#039;&#039; of a pipe connection, so fluid &amp;quot;falls&amp;quot; out of it, but fluids already outside cannot get into it.&lt;br /&gt;
&lt;br /&gt;
In other words: &lt;br /&gt;
&lt;br /&gt;
1 = output only (and will attempt to empty as fast as possible). &lt;br /&gt;
&lt;br /&gt;
-1 = input only (and will attempt to fill as fast as possible). &lt;br /&gt;
&lt;br /&gt;
0 means fluids can freely flow in and out (and like a pipe, will balance to the level of the pipe next to it).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having a -1 or 1 improperly set on an output or input, respectively, will cause issues like output fluid not leaving the building, or input fluid not entering, regardless of fluid levels in the pipe or fluid box.&lt;br /&gt;
&lt;br /&gt;
=== height ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Must be greater than 0. The total fluid capacity of the fluid box is &amp;lt;code&amp;gt;base_area × height × 100&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== filter ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Name of a [[Prototype/Fluid]]. Can be used to specify which fluid is allowed to enter this fluid box. [https://forums.factorio.com/viewtopic.php?f=28&amp;amp;t=46302]&lt;br /&gt;
&lt;br /&gt;
=== render_layer ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/RenderLayer]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;object&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== hide_connection_info ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: false&lt;br /&gt;
&lt;br /&gt;
Hides the blue input/output arrows and icons at each connection point.&lt;br /&gt;
&lt;br /&gt;
=== pipe_covers ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
The pictures to show when another fluid box connects to this one.&lt;br /&gt;
&lt;br /&gt;
=== pipe_picture ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
=== minimum_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
The minimum temperature allowed into the fluidbox. Only applied if a &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; is specified [https://forums.factorio.com/viewtopic.php?p=496738#p496738].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;minimum_temperature = 100.0&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== maximum_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
The maximum temperature allowed into the fluidbox. Only applied if a &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; is specified [https://forums.factorio.com/viewtopic.php?p=496738#p496738].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;maximum_temperature = 1000.0&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== production_type ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;None&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Possible values:&lt;br /&gt;
* &amp;quot;None&amp;quot; or &amp;quot;none&amp;quot;&lt;br /&gt;
* &amp;quot;input&amp;quot;&lt;br /&gt;
* &amp;quot;input-output&amp;quot;&lt;br /&gt;
* &amp;quot;output&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== secondary_draw_order ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/int8]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Set the secondary draw order for all orientations. Used to determine render order for sprites with the same &amp;lt;code&amp;gt;render_layer&amp;lt;/code&amp;gt; in the same position. Sprites with a higher &amp;lt;code&amp;gt;secondary_draw_order&amp;lt;/code&amp;gt; are drawn on top.&lt;br /&gt;
&lt;br /&gt;
=== secondary_draw_orders ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/int8]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: {north = 1, east = 1, south = 1, west = 1}&lt;br /&gt;
&lt;br /&gt;
Set the secondary draw order for each orientation. Used to determine render order for sprites with the same &amp;lt;code&amp;gt;render_layer&amp;lt;/code&amp;gt; in the same position. Sprites with a higher &amp;lt;code&amp;gt;secondary_draw_order&amp;lt;/code&amp;gt; are drawn on top.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;fluid_box =&lt;br /&gt;
    {&lt;br /&gt;
      base_area = 1,&lt;br /&gt;
      height = 2,&lt;br /&gt;
      base_level = -1,&lt;br /&gt;
      pipe_covers = pipecoverspictures(),&lt;br /&gt;
      pipe_connections =&lt;br /&gt;
      {&lt;br /&gt;
        {type = &amp;quot;input-output&amp;quot;, position = {-2, 0.5}},&lt;br /&gt;
        {type = &amp;quot;input-output&amp;quot;, position = {2, 0.5}}&lt;br /&gt;
      },&lt;br /&gt;
      production_type = &amp;quot;input-output&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/EnergySource&amp;diff=190527</id>
		<title>Types/EnergySource</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/EnergySource&amp;diff=190527"/>
		<updated>2022-12-08T17:53:40Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* input_flow_limit */ small clarification&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basics ==&lt;br /&gt;
Specifies the way the entity gets its energy.&lt;br /&gt;
=== type ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory. Only valid values are &amp;quot;electric&amp;quot;, &amp;quot;burner&amp;quot;, &amp;quot;heat&amp;quot;, &amp;quot;fluid&amp;quot; or &amp;quot;void&amp;quot;, it specifies the type of the energy source to be used.&lt;br /&gt;
&lt;br /&gt;
=== emissions_per_minute ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional. The pollution an entity emits per minute at full energy consumption. &amp;lt;code&amp;gt;emissions_per_minute&amp;lt;/code&amp;gt; is exactly the value that is shown in the entity tooltip.&lt;br /&gt;
&lt;br /&gt;
=== render_no_power_icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. Whether to render the [[File:Electricity-icon-red.png|50px]] icon on the entity if it is low on power. Also applies to [[File:Fuel-icon-red.png|50px]] when using a burner energy source.&lt;br /&gt;
&lt;br /&gt;
=== render_no_network_icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. Whether to render the [[File:Electricity-icon-unplugged.png|50px]] icon on the entity if it is not connected to a electric network.&lt;br /&gt;
&lt;br /&gt;
== Electric energy source ==&lt;br /&gt;
=== buffer_capacity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Optional. How much energy the entity holds.&lt;br /&gt;
&lt;br /&gt;
=== usage_priority ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ElectricUsagePriority]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
=== input_flow_limit ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: max double&lt;br /&gt;
&lt;br /&gt;
Optional. The rate at which energy can be taken, from the network, to refill the energy buffer. 0 means no transfer.&lt;br /&gt;
&lt;br /&gt;
=== output_flow_limit ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: max double&lt;br /&gt;
&lt;br /&gt;
Optional. The rate at which energy can be provided, to the network, from the energy buffer. 0 means no transfer.&lt;br /&gt;
&lt;br /&gt;
=== drain ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Optional. How much energy (per second) will be continuously removed from the energy buffer. In game, this is shown in the tooltip as &amp;quot;Min. &#039;&#039;[Minimum]&#039;&#039; Consumption&amp;quot;. Applied as a constant consumption-per-tick, even when the entity has the property &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt; false.&lt;br /&gt;
&lt;br /&gt;
== Burner ==&lt;br /&gt;
=== fuel_inventory_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ItemStackIndex]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== burnt_inventory_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ItemStackIndex]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== smoke ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/SmokeSource]]&lt;br /&gt;
&lt;br /&gt;
Optional. Array of 1 or more smoke sources.&lt;br /&gt;
&lt;br /&gt;
=== light_flicker ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/LightFlickeringDefinition]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== effectivity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional. 1 means 100% effectivity. Must be greater than 0. Multiplier of the energy output.&lt;br /&gt;
&lt;br /&gt;
=== fuel_category ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;chemical&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Optional. The energy source can be used with fuel from this [[Prototype/FuelCategory|fuel category]]. For a list on built-in categories, see [[Data.raw#fuel-category]].&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;fuel_categories&amp;lt;/code&amp;gt; is defined, fuel_category is ignored.&lt;br /&gt;
&lt;br /&gt;
=== fuel_categories ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Optional. Same as above, only one of them can exist. For a list on built-in categories, see [[Data.raw#fuel-category]].&lt;br /&gt;
&lt;br /&gt;
Takes precedence over &amp;lt;code&amp;gt;fuel_category&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Heat energy source ==&lt;br /&gt;
=== max_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
Mandatory. max_temperature must be &amp;gt;= default_temperature.&lt;br /&gt;
&lt;br /&gt;
=== default_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 15&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== specific_heat ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== max_transfer ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== min_temperature_gradient ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== min_working_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 15&lt;br /&gt;
&lt;br /&gt;
Optional. min_working_temperature must be &amp;gt;= default_temperature. min_working_temperature must be &amp;lt;= max_temperature.&lt;br /&gt;
&lt;br /&gt;
=== minimum_glow_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/float]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
=== pipe_covers ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_pipe_covers ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_picture ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_glow ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== connections ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/HeatConnection]]&lt;br /&gt;
&lt;br /&gt;
Optional. The table may only contain up to 32 connections.&lt;br /&gt;
&lt;br /&gt;
== Void energy source ==&lt;br /&gt;
Void is free energy, there are no additional entries required.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
  energy_source = {type = &amp;quot;void&amp;quot;}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Fluid energy source ==&lt;br /&gt;
=== fluid_box ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/FluidBox]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
All standard fluid box configurations are acceptable, but the type must be &amp;quot;input&amp;quot; or &amp;quot;input-output&amp;quot; to function correctly.&lt;br /&gt;
Scale_fluid_usage, fluid_usage_per_tick or a filter on the fluidbox must be set to be able to calculate the fluid usage of the energy source.&lt;br /&gt;
&lt;br /&gt;
=== smoke ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/SmokeSource]]&lt;br /&gt;
&lt;br /&gt;
Optional. Array of 1 or more smoke sources.&lt;br /&gt;
&lt;br /&gt;
=== light_flicker ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/LightFlickeringDefinition]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== effectivity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional. 1 means 100% effectivity. Must be greater than 0. Multiplier of the energy output.&lt;br /&gt;
&lt;br /&gt;
=== burns_fluid ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: false&lt;br /&gt;
&lt;br /&gt;
Optional. If set to true, the energy source will calculate power based on the fluid&#039;s fuel_value entry, else it will calculate based on fluid temperature.&lt;br /&gt;
&lt;br /&gt;
=== scale_fluid_usage ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: false&lt;br /&gt;
&lt;br /&gt;
Optional. If set to true, the energy source will consume as much fluid as required to produce the desired power, if set to false it will consume as much as it is allowed to, wasting any excess.&lt;br /&gt;
&lt;br /&gt;
=== destroy_non_fuel_fluid ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. This property is used when:&lt;br /&gt;
* &amp;lt;code&amp;gt;burns_fluid&amp;lt;/code&amp;gt; is true and the fluid has a [[Prototype/Fluid#fuel_value|fuel_value]] of 0&lt;br /&gt;
* or &amp;lt;code&amp;gt;burns_fluid&amp;lt;/code&amp;gt; is false and the fluid is at default temperature&lt;br /&gt;
In these cases, this property determines whether the fluid should be destroyed, meaning that the fluid is consumed at the rate of &amp;lt;code&amp;gt;fluid_usage_per_tick&amp;lt;/code&amp;gt;, without producing any power.&lt;br /&gt;
&lt;br /&gt;
=== fluid_usage_per_tick ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional. The number of fluid units the energy source uses per tick.&lt;br /&gt;
If used with scale_fluid_usage, this specifies the maximum. If this value is not set, scale_energy_usage = false and a fluid box filter is set, the game will attempt to calculate this value from the fluid box filter&#039;s fluid&#039;s fuel_value or heat_capacity and the entity&#039;s energy_usage. If burns_fluid is false, maximum_temperature will also be used. If the attempt of the game to calculate this value fails ( scale_energy_usage = false and a fluid box filter is set), then scale_energy_usage will be forced to true, to prevent the energy source from being an infinite fluid sink.[https://forums.factorio.com/90613]&lt;br /&gt;
&lt;br /&gt;
=== maximum_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0, meaning unlimited&lt;br /&gt;
&lt;br /&gt;
If it is specified while scale_fluid_usage = false and fluid_usage_per_tick is not specified, the game will use this value to calculate fluid_usage_per_tick.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property type usage|{{FULLPAGENAME}}}}&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/EnergySource&amp;diff=190526</id>
		<title>Types/EnergySource</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/EnergySource&amp;diff=190526"/>
		<updated>2022-12-08T17:53:19Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* output_flow_limit */ weird typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basics ==&lt;br /&gt;
Specifies the way the entity gets its energy.&lt;br /&gt;
=== type ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory. Only valid values are &amp;quot;electric&amp;quot;, &amp;quot;burner&amp;quot;, &amp;quot;heat&amp;quot;, &amp;quot;fluid&amp;quot; or &amp;quot;void&amp;quot;, it specifies the type of the energy source to be used.&lt;br /&gt;
&lt;br /&gt;
=== emissions_per_minute ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional. The pollution an entity emits per minute at full energy consumption. &amp;lt;code&amp;gt;emissions_per_minute&amp;lt;/code&amp;gt; is exactly the value that is shown in the entity tooltip.&lt;br /&gt;
&lt;br /&gt;
=== render_no_power_icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. Whether to render the [[File:Electricity-icon-red.png|50px]] icon on the entity if it is low on power. Also applies to [[File:Fuel-icon-red.png|50px]] when using a burner energy source.&lt;br /&gt;
&lt;br /&gt;
=== render_no_network_icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. Whether to render the [[File:Electricity-icon-unplugged.png|50px]] icon on the entity if it is not connected to a electric network.&lt;br /&gt;
&lt;br /&gt;
== Electric energy source ==&lt;br /&gt;
=== buffer_capacity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Optional. How much energy the entity holds.&lt;br /&gt;
&lt;br /&gt;
=== usage_priority ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ElectricUsagePriority]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
=== input_flow_limit ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: max double&lt;br /&gt;
&lt;br /&gt;
Optional. The rate at which energy can be taken, from the network, to refill the energy buffer. 0 means 0.&lt;br /&gt;
&lt;br /&gt;
=== output_flow_limit ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: max double&lt;br /&gt;
&lt;br /&gt;
Optional. The rate at which energy can be provided, to the network, from the energy buffer. 0 means no transfer.&lt;br /&gt;
&lt;br /&gt;
=== drain ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Optional. How much energy (per second) will be continuously removed from the energy buffer. In game, this is shown in the tooltip as &amp;quot;Min. &#039;&#039;[Minimum]&#039;&#039; Consumption&amp;quot;. Applied as a constant consumption-per-tick, even when the entity has the property &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt; false.&lt;br /&gt;
&lt;br /&gt;
== Burner ==&lt;br /&gt;
=== fuel_inventory_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ItemStackIndex]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== burnt_inventory_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ItemStackIndex]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== smoke ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/SmokeSource]]&lt;br /&gt;
&lt;br /&gt;
Optional. Array of 1 or more smoke sources.&lt;br /&gt;
&lt;br /&gt;
=== light_flicker ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/LightFlickeringDefinition]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== effectivity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional. 1 means 100% effectivity. Must be greater than 0. Multiplier of the energy output.&lt;br /&gt;
&lt;br /&gt;
=== fuel_category ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;chemical&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Optional. The energy source can be used with fuel from this [[Prototype/FuelCategory|fuel category]]. For a list on built-in categories, see [[Data.raw#fuel-category]].&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;fuel_categories&amp;lt;/code&amp;gt; is defined, fuel_category is ignored.&lt;br /&gt;
&lt;br /&gt;
=== fuel_categories ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Optional. Same as above, only one of them can exist. For a list on built-in categories, see [[Data.raw#fuel-category]].&lt;br /&gt;
&lt;br /&gt;
Takes precedence over &amp;lt;code&amp;gt;fuel_category&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Heat energy source ==&lt;br /&gt;
=== max_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
Mandatory. max_temperature must be &amp;gt;= default_temperature.&lt;br /&gt;
&lt;br /&gt;
=== default_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 15&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== specific_heat ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== max_transfer ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== min_temperature_gradient ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== min_working_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 15&lt;br /&gt;
&lt;br /&gt;
Optional. min_working_temperature must be &amp;gt;= default_temperature. min_working_temperature must be &amp;lt;= max_temperature.&lt;br /&gt;
&lt;br /&gt;
=== minimum_glow_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/float]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
=== pipe_covers ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_pipe_covers ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_picture ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_glow ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== connections ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/HeatConnection]]&lt;br /&gt;
&lt;br /&gt;
Optional. The table may only contain up to 32 connections.&lt;br /&gt;
&lt;br /&gt;
== Void energy source ==&lt;br /&gt;
Void is free energy, there are no additional entries required.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
  energy_source = {type = &amp;quot;void&amp;quot;}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Fluid energy source ==&lt;br /&gt;
=== fluid_box ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/FluidBox]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
All standard fluid box configurations are acceptable, but the type must be &amp;quot;input&amp;quot; or &amp;quot;input-output&amp;quot; to function correctly.&lt;br /&gt;
Scale_fluid_usage, fluid_usage_per_tick or a filter on the fluidbox must be set to be able to calculate the fluid usage of the energy source.&lt;br /&gt;
&lt;br /&gt;
=== smoke ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/SmokeSource]]&lt;br /&gt;
&lt;br /&gt;
Optional. Array of 1 or more smoke sources.&lt;br /&gt;
&lt;br /&gt;
=== light_flicker ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/LightFlickeringDefinition]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== effectivity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional. 1 means 100% effectivity. Must be greater than 0. Multiplier of the energy output.&lt;br /&gt;
&lt;br /&gt;
=== burns_fluid ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: false&lt;br /&gt;
&lt;br /&gt;
Optional. If set to true, the energy source will calculate power based on the fluid&#039;s fuel_value entry, else it will calculate based on fluid temperature.&lt;br /&gt;
&lt;br /&gt;
=== scale_fluid_usage ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: false&lt;br /&gt;
&lt;br /&gt;
Optional. If set to true, the energy source will consume as much fluid as required to produce the desired power, if set to false it will consume as much as it is allowed to, wasting any excess.&lt;br /&gt;
&lt;br /&gt;
=== destroy_non_fuel_fluid ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. This property is used when:&lt;br /&gt;
* &amp;lt;code&amp;gt;burns_fluid&amp;lt;/code&amp;gt; is true and the fluid has a [[Prototype/Fluid#fuel_value|fuel_value]] of 0&lt;br /&gt;
* or &amp;lt;code&amp;gt;burns_fluid&amp;lt;/code&amp;gt; is false and the fluid is at default temperature&lt;br /&gt;
In these cases, this property determines whether the fluid should be destroyed, meaning that the fluid is consumed at the rate of &amp;lt;code&amp;gt;fluid_usage_per_tick&amp;lt;/code&amp;gt;, without producing any power.&lt;br /&gt;
&lt;br /&gt;
=== fluid_usage_per_tick ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional. The number of fluid units the energy source uses per tick.&lt;br /&gt;
If used with scale_fluid_usage, this specifies the maximum. If this value is not set, scale_energy_usage = false and a fluid box filter is set, the game will attempt to calculate this value from the fluid box filter&#039;s fluid&#039;s fuel_value or heat_capacity and the entity&#039;s energy_usage. If burns_fluid is false, maximum_temperature will also be used. If the attempt of the game to calculate this value fails ( scale_energy_usage = false and a fluid box filter is set), then scale_energy_usage will be forced to true, to prevent the energy source from being an infinite fluid sink.[https://forums.factorio.com/90613]&lt;br /&gt;
&lt;br /&gt;
=== maximum_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0, meaning unlimited&lt;br /&gt;
&lt;br /&gt;
If it is specified while scale_fluid_usage = false and fluid_usage_per_tick is not specified, the game will use this value to calculate fluid_usage_per_tick.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property type usage|{{FULLPAGENAME}}}}&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Localisation&amp;diff=190510</id>
		<title>Tutorial:Localisation</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Localisation&amp;diff=190510"/>
		<updated>2022-12-06T01:32:48Z</updated>

		<summary type="html">&lt;p&gt;Honktown: Scenario Name and Description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}Mods should define human readable names for prototypes that they add. They can also define descriptions for items or custom strings for usage in GUIs etc. This is called &#039;&#039;&#039;localisation&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
Translations are stored as .cfg files, with the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;welcome-message=Hello world&lt;br /&gt;
[category]&lt;br /&gt;
title=Category related title&lt;br /&gt;
# Comment&lt;br /&gt;
; Another comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
Any whitespace after or before &amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt; is included in the key or string, so &amp;lt;code&amp;gt;title =Category related title&amp;lt;/code&amp;gt; will give an unknown key error if you are looking for the &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; key, since it is the &amp;lt;code&amp;gt;title&amp;amp;nbsp;&amp;lt;/code&amp;gt; key.&lt;br /&gt;
&lt;br /&gt;
These files are located within the language code of the language in the locale folder of the mod, so as an English example &amp;lt;code&amp;gt;__mod__/locale/en/any_name_here.cfg&amp;lt;/code&amp;gt;. There can be more than 1 file per language, all of them will be read.&lt;br /&gt;
&lt;br /&gt;
== Localising simple strings ==&lt;br /&gt;
The simplest localisation is of items, entities etc. If we say the item is &amp;lt;code&amp;gt;iron-plate&amp;lt;/code&amp;gt;, the game will then search all loaded locale files for &amp;lt;code&amp;gt;item-name.iron-plate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;item-description.iron-plate&amp;lt;/code&amp;gt;, which in the locale file looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[item-name]&lt;br /&gt;
iron-plate=Iron plate&lt;br /&gt;
[item-description]&lt;br /&gt;
iron-plate=A plate made of iron.&amp;lt;/pre&amp;gt;&lt;br /&gt;
If found in the locale, the label is set to this string. If not found, the game will instead show: &amp;lt;code&amp;gt;Unknown key: &amp;amp;quot;item-name.iron-plate&amp;amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In script, the localised string is formatted as &amp;lt;code&amp;gt;{&amp;amp;quot;category.name&amp;amp;quot;}&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;game.print({&amp;amp;quot;item-name.iron-plate&amp;amp;quot;})&amp;lt;/code&amp;gt; prints &#039;&#039;Iron plate&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It is possible to use [[rich text]] features in the localised text if the location where the text is shown supports it, e.g. in the chat, prototype names and prototype tooltips.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; can be used for line breaks if the location where the text is shown supports multiline text.&lt;br /&gt;
&lt;br /&gt;
== Localising with parameters ==&lt;br /&gt;
For more complex strings, localisation parameters can be used. For instance we want to show &#039;&#039;Time left: 10 minutes.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So a key with a placeholder is defined, which is replaced by the first parameter after the locale key.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;time-left=Time left: __1__ minutes.&amp;lt;/pre&amp;gt;&lt;br /&gt;
So it is used like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;time-left&amp;quot;, 10})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
It also works with multiple parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;time-left&amp;quot;, 10, 45})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;time-left=Time left: __1__ minutes and __2__ seconds.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Which results in &#039;&#039;Time left: 10 minutes and 45 seconds.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Built-in parameters ===&lt;br /&gt;
For some situations, we use localisation to show control schemes. For instance we want to say:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;technology-prompt=Use T to open the technology screen&amp;lt;/pre&amp;gt;&lt;br /&gt;
However the player may have rebound the key, but we can’t figure out which key as it would not be deterministic. So instead we use the built-in replacement functionality&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;technology-prompt=Use __CONTROL__open-technology-gui__ to open the technology screen.&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can also use this for items and entities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;big-iron-plate=Big __ITEM__iron-plate__&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;tiny-gun-turret=Tiny __ENTITY__gun-turret__&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== List of built-in parameters ====&lt;br /&gt;
&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; is the name of a control or prototype, depending on context. &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; can be 1 or 2, it&#039;s used in parameters that control [[#Localising_alternate_input_names|alternate input names]]. &lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_MODIFIER__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_STYLE_BEGIN__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_STYLE_END__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_LEFT_CLICK__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-b&amp;lt;/code&amp;gt;[https://crowdin.com/project/factorio/discussions/214]&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_RIGHT_CLICK__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-2&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-x&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_KEY_SHIFT__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.shift&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-leftshoulder&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_KEY_CTRL__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.control&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-rightshoulder&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL_LEFT_CLICK__n__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-1-alt-n&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-button-alt-n&amp;lt;/code&amp;gt; (with parameter &amp;lt;code&amp;gt;control-keys.controller-b&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL_RIGHT_CLICK__n__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-2-alt-n&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-button-alt-n&amp;lt;/code&amp;gt; (with parameter &amp;lt;code&amp;gt;control-keys.controller-x&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;__REMARK_COLOR_BEGIN__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__REMARK_COLOR_END__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL__n__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_MOVE__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ENTITY__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ITEM__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__TILE__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__FLUID__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plurals ===&lt;br /&gt;
Pluralization can be used in any string that uses a parameter (e.g. __1__) that is numeric, so something like an amount of minutes. It can be used multiple times per string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;format-days=__1__ __plural_for_parameter_1_{1=day|rest=days}__&amp;lt;/pre&amp;gt;&lt;br /&gt;
This results in &amp;quot;1 day&amp;quot; and &amp;quot;2 days&amp;quot; / &amp;quot;500 days&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
The number after &amp;lt;code&amp;gt;__plural_for_parameter_&amp;lt;/code&amp;gt; denotes which parameter is used to determine the plural. This is the parameter 1 in the above example. Anything inside the {} is used to make the plural. Each plural form is separated by a |.&lt;br /&gt;
The text in front of the = determines for what the plural form is used. Options for this are:&lt;br /&gt;
* a simple number, e.g. &amp;quot;1&amp;quot;.&lt;br /&gt;
* Multiple numbers, e.g. &amp;quot;2,3,4&amp;quot;.&lt;br /&gt;
* What the number ends with, e.g. &amp;quot;ends in 11&amp;quot; or &amp;quot;ends in 1&amp;quot;&lt;br /&gt;
* Multiple ends with, e.g. &amp;quot;ends in 1,ends in 2,ends in 12&amp;quot;.&lt;br /&gt;
* &amp;quot;rest&amp;quot; to give the default plural.&lt;br /&gt;
&lt;br /&gt;
Plural forms may be empty or contain other keys such as __1__ or spaces. This allows rather large plural forms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;__plural_for_parameter_1_{1=__1__ player is|rest=__1__ players are}__ connecting&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system chooses the first fitting plural that it encounters when multiple would fit:&lt;br /&gt;
&amp;lt;pre&amp;gt;__plural_for_parameter_1_{ends in 12=option 1|ends in 2=option 2|rest=option 3}__&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will result in &amp;quot;option 1&amp;quot; for 12 and in &amp;quot;option 2&amp;quot; for 22 and in &amp;quot;option 3&amp;quot; for numbers not ending with 2.&lt;br /&gt;
&lt;br /&gt;
=== Concatenating localised strings ===&lt;br /&gt;
The special locale key: &amp;lt;code&amp;gt;&amp;amp;quot;&amp;amp;quot;&amp;lt;/code&amp;gt; is used to concatenate, as the table format does not support concatenation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;&amp;quot;, {&amp;quot;item-name.iron-plate&amp;quot;}, &amp;quot;: &amp;quot;, 60})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Will result in: &#039;&#039;Iron plate: 60&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Localising alternate input names ===&lt;br /&gt;
&lt;br /&gt;
In the introduction campaign, a special locale system is used for informing players how to do certain actions with their mouse.&lt;br /&gt;
The normal form is to use eg:&lt;br /&gt;
&amp;lt;pre&amp;gt;how-to-build=Use __CONTROL__build__ to place a building&amp;lt;/pre&amp;gt;&lt;br /&gt;
which results in &amp;quot;Use Left mouse button to place a building&amp;quot;. A more natural phrasing would be &amp;quot;Left-click to place a building&amp;quot;, which can be achieved by using the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;how-to-build=__ALT_CONTROL__1__build__ to place a building&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These &amp;quot;alt&amp;quot; versions are controlled by a few special locale keys, mouse-button-X-alt-1 and mouse-button-X-alt-2. In English, form 1 produces eg &amp;quot;Left-click&amp;quot;, and form 2 produces eg &amp;quot;Left-clicking&amp;quot;.  Only two alt forms (&amp;quot;1&amp;quot; and &amp;quot;2&amp;quot;) are available at the moment, but if this a problem for some languages, more forms may be added in the future.&lt;br /&gt;
Extra mouse buttons, mouse scroll and keyboard keys are handled through the mouse-button-n-alt-1/2, mouse-wheel-alt-1/2 and keyboard-alt-1/2 keys, which just take the normal name and prepend something like &amp;quot;Press/Pressing&amp;quot;, or &amp;quot;Scroll/Scrolling&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When translating to another language, you can use whatever forms you want here, but the important part is that you are consistent when you use the alt-forms everywhere else. It does not necessarily make sense to just copy the usages of alt forms from the English locale, and for some languages it may be more natural to simply not use this system at all.&lt;br /&gt;
&lt;br /&gt;
== Accessing the localised result in code ==&lt;br /&gt;
While usually unneeded, it is possible to read the resulting localised text in code, for example to search in localised names. See [https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.request_translation LuaPlayer::request_translation] and  [https://lua-api.factorio.com/latest/events.html#on_string_translated on_string_translated event].&lt;br /&gt;
&lt;br /&gt;
== Default Behavior(s) for finding an Unspecified Localised String ==&lt;br /&gt;
If a localised_string is not defined in the prototype for certain prototype classes, e.g. entity, item, Factorio may have a default search behavior.&lt;br /&gt;
&lt;br /&gt;
Determining an item&#039;s localised name:&lt;br /&gt;
Note: the angle brackets are meant to mean a generic term, they are not part of the actual string. Also, place_result and placed_as_equipment_result are strings, and Factorio fetches the matching prototype to examine.&lt;br /&gt;
&lt;br /&gt;
# if localised_name is provided in the item prototype and it is not empty {}, use the provided value&lt;br /&gt;
# else if there is place_result and it has localised_name that is not an empty table: {}, use the localised_name of place_result&lt;br /&gt;
# else if there is place_result with an empty localised_name, use {&amp;quot;entity-name.&amp;lt;entity prototype name&amp;gt;&amp;quot;}&lt;br /&gt;
# else if there is placed_as_equipment_result and it has a localised_name that is not an empty table: {}, use the localised_name of placed_as_equipment_result&lt;br /&gt;
# else if there is placed_as_equipment_result with empty localised_name, use {&amp;quot;equipment-name.&amp;lt;equipment name&amp;gt;&amp;quot;}&lt;br /&gt;
# else use default {&amp;quot;item-name.&amp;lt;item name&amp;gt;&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Reference: [https://forums.factorio.com/viewtopic.php?p=494243#p494243]&lt;br /&gt;
&lt;br /&gt;
Example: The transport-belt item does not have a localised_name, so 1-&amp;gt;2. There is a place result, but not localised_name in the entity prototype. 2-&amp;gt;3. The place result lacks a localised_name. Use the localised string {&amp;quot;entity-name.transport-belt&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Such defaults often include a &amp;quot;leading key&amp;quot; using [&amp;lt;group&amp;gt;-name] or [&amp;lt;group&amp;gt;-description] (such as [recipe-name], [mod-setting-description]). However, each prototype may have a distinct search behavior before using those, based on presence/absence of values in the prototype. [[Prototype/Recipe]] for example may use the first product&#039;s localised_name, or the main_product&#039;s localised_name, or the localised string found in {&amp;quot;recipe-name.&amp;lt;recipe name&amp;gt;&amp;quot;], depending on values provided (and lacking) in the prototype.&lt;br /&gt;
&lt;br /&gt;
== Scenario Name and Description ==&lt;br /&gt;
Scenarios have special keys, before a [category]. &amp;lt;code&amp;gt;scenario-name&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt; allow for localising the name and description while selecting from a &#039;Start new game&#039; scenario selector. Example from freeplay/locale/en/freeplay.cfg (msg-intro is not included because it is not special):&lt;br /&gt;
&lt;br /&gt;
:scenario-name=Freeplay&lt;br /&gt;
:description=Your task is to launch a rocket into space. Start from nothing, work your way up with automation, and don&#039;t forget to protect yourself from the natives.\n[font=default-bold]This is the intended way of playing Factorio.[/font]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Types/LocalisedString|LocalisedString data stage doc]]&lt;br /&gt;
* [https://lua-api.factorio.com/latest/Concepts.html#LocalisedString LocalisedString control stage doc]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Mod_structure&amp;diff=190323</id>
		<title>Tutorial:Mod structure</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Mod_structure&amp;diff=190323"/>
		<updated>2022-11-12T08:31:25Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* dependencies */ indent -1 to Dependency section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}Mods are expected to have a certain structure in order to be loaded by the game. This page aims to explain that file structure and what each file is used for.&lt;br /&gt;
&lt;br /&gt;
== Mod folder and file structure ==&lt;br /&gt;
&lt;br /&gt;
The mod must either be in a folder, or in a folder inside a zip file. The mod folder (no zip file) must either be named in the pattern of &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt; or just &amp;lt;code&amp;gt;{mod-name}&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;test-mod-thing&amp;lt;/code&amp;gt;. The mod zip must be named in the pattern of &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;test-mod-thing_0.0.1&amp;lt;/code&amp;gt;. When using a zip file for the mod, the folder inside the zip file does not have any naming restrictions; only the zip file itself must be named with the &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt; pattern. The mod name and its version number are defined in the [[#info.json|info.json]] file.&lt;br /&gt;
&lt;br /&gt;
=== Files ===&lt;br /&gt;
Inside the mod folder, the game automatically reads the following files during load:&lt;br /&gt;
* info.json — The only mandatory file. The [[#info.json|info.json]] identifies the mod, defines its version and other general properties.&lt;br /&gt;
* changelog.txt — Version history of the mod, to be shown in the mod browser. The changelog file must follow the strict [[Tutorial:Mod changelog format|formatting requirements]].&lt;br /&gt;
* thumbnail.png — Thumbnail to be shown on the mod portal and in the mod browser in-game. Ideally a 144x144px image file.&lt;br /&gt;
* settings.lua — This and the next two files are used to set up mod [[Tutorial:Mod settings|configuration options]].&lt;br /&gt;
* settings-updates.lua&lt;br /&gt;
* settings-final-fixes.lua&lt;br /&gt;
* data.lua — This and the next two files are used to define [[Prototype definitions|prototypes]].&lt;br /&gt;
* data-updates.lua — The load order of the three data*.lua files is explained on [https://lua-api.factorio.com/latest/Data-Lifecycle.html Data-Lifecycle].&lt;br /&gt;
* data-final-fixes.lua&lt;br /&gt;
* control.lua — This file is used for runtime scripting. Runtime scripting is documented on [https://lua-api.factorio.com/latest/index.html lua-api.factorio.com].&lt;br /&gt;
&lt;br /&gt;
=== Subfolders ===&lt;br /&gt;
Furthermore, the following folders inside the mod folder are recognized by the game:&lt;br /&gt;
* locale — Can contain up to one subfolder per language, identified with the language code, for example &amp;lt;code&amp;gt;en&amp;lt;/code&amp;gt; for English. The subfolder then has to contain at least one *.cfg file which defines the [[Tutorial:Localisation|translations]] for that language.&lt;br /&gt;
* scenarios — Custom [[scenario system|scenarios]] can be placed in subfolders of this folder.&lt;br /&gt;
* campaigns — Custom campaigns can be placed in subfolders of this folder.&lt;br /&gt;
* tutorials — Custom [[Prototype/Tutorial|tutorials]] can be placed in subfolders of this folder.&lt;br /&gt;
* migrations — [https://lua-api.factorio.com/latest/Migrations.html Migration files] are placed in this folder. They are a way to handle prototype changes and mod data structure changes between mod versions or game versions.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
Here is an example directory structure for a mod titled &amp;lt;code&amp;gt;my-armor-mod&amp;lt;/code&amp;gt; with a version number of &amp;lt;code&amp;gt;0.3.6&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
my-armor-mod_0.3.6.zip&lt;br /&gt;
|- aFolderName/&lt;br /&gt;
  |- control.lua&lt;br /&gt;
  |- data.lua&lt;br /&gt;
  |- info.json&lt;br /&gt;
  |- thumbnail.png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== info.json ==&lt;br /&gt;
&lt;br /&gt;
The info.json file identifies the mod and defines its version. If the game encounters a problem when parsing the file, the error message can be found in the [[log file]]. A minimal info.json file can look like this:&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;test-mod-thing&amp;quot;,&lt;br /&gt;
      &amp;quot;version&amp;quot;: &amp;quot;0.0.1&amp;quot;,&lt;br /&gt;
      &amp;quot;title&amp;quot;: &amp;quot;My best test mod&amp;quot;,&lt;br /&gt;
      &amp;quot;author&amp;quot;: &amp;quot;A very great tester&amp;quot;,&lt;br /&gt;
      &amp;quot;factorio_version&amp;quot;: &amp;quot;1.1&amp;quot;,&lt;br /&gt;
      &amp;quot;dependencies&amp;quot;: [&amp;quot;? optional-mod&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The info.json file supports the following fields:&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. The internal name of mod. The game accepts anything as a mod name, however the mod portal restricts mod names to only consist of alphanumeric characters, dashes and underscores. Note that the mod folder or mod zip file name has to contain the mod name, where the restrictions of the file system apply.&lt;br /&gt;
&lt;br /&gt;
: The game accepts mod names with a maximum length of 100 characters. The mod portal only accepts mods with names that are longer than 3 characters and shorter than 50 characters.&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. Defines the version of the mod in the format &amp;lt;code&amp;gt;&amp;quot;number.number.number&amp;quot;&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;&amp;quot;Major.Middle.Minor&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;0.6.4&amp;quot;&amp;lt;/code&amp;gt;. Each number can range from 0 to 65535.&lt;br /&gt;
&lt;br /&gt;
=== title === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. The display name of the mod, so it is not recommended to use someUgly_pRoGrAmMeR-name here. Can be overwritten with a locale entry in the &amp;lt;code&amp;gt;mod-name&amp;lt;/code&amp;gt; category, using the internal mod name as the key.&lt;br /&gt;
&lt;br /&gt;
: The game will reject a title field that is longer than 100 characters. However, this can be worked around by using the locale entry. The mod portal does not restrict mod title length.&lt;br /&gt;
&lt;br /&gt;
=== author === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. The author of the mod. This field does not have restrictions, it can also be a list of authors etc. The mod portal ignores this field, it will simply display the uploader&#039;s name as the author.&lt;br /&gt;
&lt;br /&gt;
=== contact === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Optional field. How the mod author can be contacted, for example an email address.&lt;br /&gt;
&lt;br /&gt;
=== homepage === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Optional field. Where the mod can be found on the internet. Note that the in-game mod browser shows the mod portal link additionally to this field. Please don&#039;t put &amp;quot;None&amp;quot; here, it makes the field on the mod portal website look ugly. Just leave the field empty if the mod doesn&#039;t have a website/forum thread/discord.&lt;br /&gt;
&lt;br /&gt;
=== description === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Optional field. A short description of what your mod does. This is all that people get to see in-game. Can be overwritten with a locale entry in the &amp;lt;code&amp;gt;mod-description&amp;lt;/code&amp;gt; category, using the internal mod name as the key.&lt;br /&gt;
&lt;br /&gt;
=== factorio_version ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;0.12&amp;quot;&lt;br /&gt;
&lt;br /&gt;
: Optional field. The Factorio version &amp;lt;code&amp;gt;Major.Middle&amp;lt;/code&amp;gt; that this mod supports. This can only be one Factorio version, not multiple. &#039;&#039;However&#039;&#039;, it includes all &amp;lt;code&amp;gt;.Minor&amp;lt;/code&amp;gt; versions. While the field is optional, usually mods are developed for versions higher than the default 0.12, so the field has to be added anyway.&lt;br /&gt;
&lt;br /&gt;
: Adding a Minor part, e.g. &amp;quot;0.18.&#039;&#039;&#039;27&#039;&#039;&#039;&amp;quot; will make the mod portal reject the mod and the game act weirdly. That means this shouldn&#039;t be done; use only the Major and Middle components &amp;lt;code&amp;gt;&amp;quot;Major.Middle&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;1.0&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: Mods with the factorio_version &amp;quot;0.18&amp;quot; can also be loaded in 1.0 and the mod portal will return them when queried for factorio_version 1.0 mods.&lt;br /&gt;
&lt;br /&gt;
=== dependencies ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: array of [[#Dependency]]&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Default&#039;&#039;&#039;: [&amp;quot;base&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
: Optional field. Mods that this mod depends on or is incompatible with. If this mod depends on another, the other mod will load first, see [https://lua-api.factorio.com/latest/Data-Lifecycle.html Data-Lifecycle]. An empty array allows get around the default and have no dependencies at all.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
: &amp;lt;pre&amp;gt;&amp;quot;dependencies&amp;quot;: [&amp;quot;mod-a&amp;quot;, &amp;quot;? mod-c &amp;gt; 0.4.3&amp;quot;, &amp;quot;! mod-g&amp;quot;]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;h4&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot; id=&amp;quot;Dependency&amp;quot;&amp;gt;Dependency&amp;lt;/span&amp;gt;&amp;lt;/h4&amp;gt;&lt;br /&gt;
: Each dependency is a string that consists of up to three parts: &amp;lt;code&amp;gt;&amp;quot;&amp;lt;prefix&amp;gt; internal-mod-name &amp;lt;equality-operator version&amp;gt;&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;? some-mod-everyone-loves &amp;gt;= 4.2.0&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:The equality operator (&amp;lt;code&amp;gt;&amp;lt;, &amp;lt;=, =, &amp;gt;= or &amp;gt;&amp;lt;/code&amp;gt;) combined with the version allows to define dependencies that require certain mod versions, but it is not required. Incompatibility does not support versions; if incompatibility is used, version is ignored.&lt;br /&gt;
&lt;br /&gt;
:The possible prefixes are:&lt;br /&gt;
::&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; for incompatibility&lt;br /&gt;
::&amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt; for an optional dependency&lt;br /&gt;
::&amp;lt;code&amp;gt;(?)&amp;lt;/code&amp;gt; for a hidden optional dependency&lt;br /&gt;
::&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt; for a dependency that does not affect load order, or no prefix for a hard requirement for the other mod.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Mod_structure&amp;diff=190322</id>
		<title>Tutorial:Mod structure</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Mod_structure&amp;diff=190322"/>
		<updated>2022-11-12T08:26:24Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* factorio_version */ Major Middle Minor naming for factorio_version, and some editing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}Mods are expected to have a certain structure in order to be loaded by the game. This page aims to explain that file structure and what each file is used for.&lt;br /&gt;
&lt;br /&gt;
== Mod folder and file structure ==&lt;br /&gt;
&lt;br /&gt;
The mod must either be in a folder, or in a folder inside a zip file. The mod folder (no zip file) must either be named in the pattern of &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt; or just &amp;lt;code&amp;gt;{mod-name}&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;test-mod-thing&amp;lt;/code&amp;gt;. The mod zip must be named in the pattern of &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;test-mod-thing_0.0.1&amp;lt;/code&amp;gt;. When using a zip file for the mod, the folder inside the zip file does not have any naming restrictions; only the zip file itself must be named with the &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt; pattern. The mod name and its version number are defined in the [[#info.json|info.json]] file.&lt;br /&gt;
&lt;br /&gt;
=== Files ===&lt;br /&gt;
Inside the mod folder, the game automatically reads the following files during load:&lt;br /&gt;
* info.json — The only mandatory file. The [[#info.json|info.json]] identifies the mod, defines its version and other general properties.&lt;br /&gt;
* changelog.txt — Version history of the mod, to be shown in the mod browser. The changelog file must follow the strict [[Tutorial:Mod changelog format|formatting requirements]].&lt;br /&gt;
* thumbnail.png — Thumbnail to be shown on the mod portal and in the mod browser in-game. Ideally a 144x144px image file.&lt;br /&gt;
* settings.lua — This and the next two files are used to set up mod [[Tutorial:Mod settings|configuration options]].&lt;br /&gt;
* settings-updates.lua&lt;br /&gt;
* settings-final-fixes.lua&lt;br /&gt;
* data.lua — This and the next two files are used to define [[Prototype definitions|prototypes]].&lt;br /&gt;
* data-updates.lua — The load order of the three data*.lua files is explained on [https://lua-api.factorio.com/latest/Data-Lifecycle.html Data-Lifecycle].&lt;br /&gt;
* data-final-fixes.lua&lt;br /&gt;
* control.lua — This file is used for runtime scripting. Runtime scripting is documented on [https://lua-api.factorio.com/latest/index.html lua-api.factorio.com].&lt;br /&gt;
&lt;br /&gt;
=== Subfolders ===&lt;br /&gt;
Furthermore, the following folders inside the mod folder are recognized by the game:&lt;br /&gt;
* locale — Can contain up to one subfolder per language, identified with the language code, for example &amp;lt;code&amp;gt;en&amp;lt;/code&amp;gt; for English. The subfolder then has to contain at least one *.cfg file which defines the [[Tutorial:Localisation|translations]] for that language.&lt;br /&gt;
* scenarios — Custom [[scenario system|scenarios]] can be placed in subfolders of this folder.&lt;br /&gt;
* campaigns — Custom campaigns can be placed in subfolders of this folder.&lt;br /&gt;
* tutorials — Custom [[Prototype/Tutorial|tutorials]] can be placed in subfolders of this folder.&lt;br /&gt;
* migrations — [https://lua-api.factorio.com/latest/Migrations.html Migration files] are placed in this folder. They are a way to handle prototype changes and mod data structure changes between mod versions or game versions.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
Here is an example directory structure for a mod titled &amp;lt;code&amp;gt;my-armor-mod&amp;lt;/code&amp;gt; with a version number of &amp;lt;code&amp;gt;0.3.6&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
my-armor-mod_0.3.6.zip&lt;br /&gt;
|- aFolderName/&lt;br /&gt;
  |- control.lua&lt;br /&gt;
  |- data.lua&lt;br /&gt;
  |- info.json&lt;br /&gt;
  |- thumbnail.png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== info.json ==&lt;br /&gt;
&lt;br /&gt;
The info.json file identifies the mod and defines its version. If the game encounters a problem when parsing the file, the error message can be found in the [[log file]]. A minimal info.json file can look like this:&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;test-mod-thing&amp;quot;,&lt;br /&gt;
      &amp;quot;version&amp;quot;: &amp;quot;0.0.1&amp;quot;,&lt;br /&gt;
      &amp;quot;title&amp;quot;: &amp;quot;My best test mod&amp;quot;,&lt;br /&gt;
      &amp;quot;author&amp;quot;: &amp;quot;A very great tester&amp;quot;,&lt;br /&gt;
      &amp;quot;factorio_version&amp;quot;: &amp;quot;1.1&amp;quot;,&lt;br /&gt;
      &amp;quot;dependencies&amp;quot;: [&amp;quot;? optional-mod&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The info.json file supports the following fields:&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. The internal name of mod. The game accepts anything as a mod name, however the mod portal restricts mod names to only consist of alphanumeric characters, dashes and underscores. Note that the mod folder or mod zip file name has to contain the mod name, where the restrictions of the file system apply.&lt;br /&gt;
&lt;br /&gt;
: The game accepts mod names with a maximum length of 100 characters. The mod portal only accepts mods with names that are longer than 3 characters and shorter than 50 characters.&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. Defines the version of the mod in the format &amp;lt;code&amp;gt;&amp;quot;number.number.number&amp;quot;&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;&amp;quot;Major.Middle.Minor&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;0.6.4&amp;quot;&amp;lt;/code&amp;gt;. Each number can range from 0 to 65535.&lt;br /&gt;
&lt;br /&gt;
=== title === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. The display name of the mod, so it is not recommended to use someUgly_pRoGrAmMeR-name here. Can be overwritten with a locale entry in the &amp;lt;code&amp;gt;mod-name&amp;lt;/code&amp;gt; category, using the internal mod name as the key.&lt;br /&gt;
&lt;br /&gt;
: The game will reject a title field that is longer than 100 characters. However, this can be worked around by using the locale entry. The mod portal does not restrict mod title length.&lt;br /&gt;
&lt;br /&gt;
=== author === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. The author of the mod. This field does not have restrictions, it can also be a list of authors etc. The mod portal ignores this field, it will simply display the uploader&#039;s name as the author.&lt;br /&gt;
&lt;br /&gt;
=== contact === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Optional field. How the mod author can be contacted, for example an email address.&lt;br /&gt;
&lt;br /&gt;
=== homepage === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Optional field. Where the mod can be found on the internet. Note that the in-game mod browser shows the mod portal link additionally to this field. Please don&#039;t put &amp;quot;None&amp;quot; here, it makes the field on the mod portal website look ugly. Just leave the field empty if the mod doesn&#039;t have a website/forum thread/discord.&lt;br /&gt;
&lt;br /&gt;
=== description === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Optional field. A short description of what your mod does. This is all that people get to see in-game. Can be overwritten with a locale entry in the &amp;lt;code&amp;gt;mod-description&amp;lt;/code&amp;gt; category, using the internal mod name as the key.&lt;br /&gt;
&lt;br /&gt;
=== factorio_version ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;0.12&amp;quot;&lt;br /&gt;
&lt;br /&gt;
: Optional field. The Factorio version &amp;lt;code&amp;gt;Major.Middle&amp;lt;/code&amp;gt; that this mod supports. This can only be one Factorio version, not multiple. &#039;&#039;However&#039;&#039;, it includes all &amp;lt;code&amp;gt;.Minor&amp;lt;/code&amp;gt; versions. While the field is optional, usually mods are developed for versions higher than the default 0.12, so the field has to be added anyway.&lt;br /&gt;
&lt;br /&gt;
: Adding a Minor part, e.g. &amp;quot;0.18.&#039;&#039;&#039;27&#039;&#039;&#039;&amp;quot; will make the mod portal reject the mod and the game act weirdly. That means this shouldn&#039;t be done; use only the Major and Middle components &amp;lt;code&amp;gt;&amp;quot;Major.Middle&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;1.0&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: Mods with the factorio_version &amp;quot;0.18&amp;quot; can also be loaded in 1.0 and the mod portal will return them when queried for factorio_version 1.0 mods.&lt;br /&gt;
&lt;br /&gt;
=== dependencies ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: array of [[#Dependency]]&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Default&#039;&#039;&#039;: [&amp;quot;base&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
: Optional field. Mods that this mod depends on or is incompatible with. If this mod depends on another, the other mod will load first, see [https://lua-api.factorio.com/latest/Data-Lifecycle.html Data-Lifecycle]. An empty array allows get around the default and have no dependencies at all.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
: &amp;lt;pre&amp;gt;&amp;quot;dependencies&amp;quot;: [&amp;quot;mod-a&amp;quot;, &amp;quot;? mod-c &amp;gt; 0.4.3&amp;quot;, &amp;quot;! mod-g&amp;quot;]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:: &amp;lt;h4&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot; id=&amp;quot;Dependency&amp;quot;&amp;gt;Dependency&amp;lt;/span&amp;gt;&amp;lt;/h4&amp;gt;&lt;br /&gt;
:: Each dependency is a string that consists of up to three parts: &amp;lt;code&amp;gt;&amp;quot;&amp;lt;prefix&amp;gt; internal-mod-name &amp;lt;equality-operator version&amp;gt;&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;? some-mod-everyone-loves &amp;gt;= 4.2.0&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
::The equality operator (&amp;lt;code&amp;gt;&amp;lt;, &amp;lt;=, =, &amp;gt;= or &amp;gt;&amp;lt;/code&amp;gt;) combined with the version allows to define dependencies that require certain mod versions, but it is not required. Incompatibility does not support versions; if incompatibility is used, version is ignored.&lt;br /&gt;
&lt;br /&gt;
::The possible prefixes are:&lt;br /&gt;
:::&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; for incompatibility&lt;br /&gt;
:::&amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt; for an optional dependency&lt;br /&gt;
:::&amp;lt;code&amp;gt;(?)&amp;lt;/code&amp;gt; for a hidden optional dependency&lt;br /&gt;
:::&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt; for a dependency that does not affect load order, or no prefix for a hard requirement for the other mod.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Prototype/Recipe&amp;diff=190286</id>
		<title>Prototype/Recipe</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Prototype/Recipe&amp;diff=190286"/>
		<updated>2022-11-09T09:54:35Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Recipe data */ text mistake&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Prototype parent|PrototypeBase}}&lt;br /&gt;
A recipe. It can be a crafting recipe, a smelting recipe, or a custom type of recipe (see [[Prototype/RecipeCategory]]).&lt;br /&gt;
&lt;br /&gt;
{{Prototype TOC|recipe}}&lt;br /&gt;
&lt;br /&gt;
== General properties ==&lt;br /&gt;
Inherits all properties from [[PrototypeBase]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|category|[[Types/string|string]]|&amp;quot;crafting&amp;quot;|optional=true}}&lt;br /&gt;
Optional. The category of this recipe. The built-in categories can be found [[Data.raw#recipe-category|here]]. See also [[Prototype/RecipeCategory]].&lt;br /&gt;
&lt;br /&gt;
The recipe category &amp;quot;crafting&amp;quot; cannot contain recipes with fluid ingredients or products.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|subgroup|[[Types/string|string]]||optional=true}}&lt;br /&gt;
Optional. The subgroup of this recipe. If not specified, defaults to the subgroup of the product if there is only 1, or main_product if multiple products exist. If multiple products exist and no main_product is specified, the subgroup is required.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|icons, icon,  icon_size (IconSpecification)|[[Types/IconSpecification|IconSpecification]]|optional=true}}&lt;br /&gt;
An icon is mandatory for recipe with more than 1 product and no main_product. Otherwise defaults to the icon of main_product/1 product.&lt;br /&gt;
&lt;br /&gt;
If given, it overwrites the icon of the main_product/1 product.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|crafting_machine_tint|[[Types/table|table]] of [[Types/Color|Color]]|optional=true}}&lt;br /&gt;
Optional. Used by crafting machine &amp;lt;code&amp;gt;[[Prototype/CraftingMachine#working_visualisations|working_visualisations]]&amp;lt;/code&amp;gt; to tint certain layers with the recipe color. [[Types/WorkingVisualisation#apply_recipe_tint|apply_recipe_tint]] on the working visualisation determines which of the 4 colors is used for that layer (if any).&lt;br /&gt;
&lt;br /&gt;
Format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;crafting_machine_tint = { primary = {r=0,g=0,b=0,a=0}, secondary = {r=0,g=0,b=0,a=0}, tertiary = {r=0,g=0,b=0,a=0}, quaternary = {r=0,g=0,b=0,a=0}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each key/value pair is optional and defaults to the above value.&lt;br /&gt;
&lt;br /&gt;
== Recipe data ==&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
Anchor and property for the TOC at the top --&amp;gt;&amp;lt;span id=&amp;quot;normal&amp;quot;&amp;gt;{{#subobject:normal&lt;br /&gt;
 |Prototype property name=normal&lt;br /&gt;
 |Prototype property type=[[Prototype/Recipe#Recipe_data|Recipe data]] or [[Types/bool|bool]]&lt;br /&gt;
 |Prototype property optional=true&lt;br /&gt;
 |Prototype property pagename={{FULLPAGENAME}}&lt;br /&gt;
}}&amp;lt;/span&amp;gt;&amp;lt;!-- &lt;br /&gt;
Anchor and property for the TOC at the top --&amp;gt;&amp;lt;span id=&amp;quot;expensive&amp;quot;&amp;gt;{{#subobject:expensive&lt;br /&gt;
 |Prototype property name=expensive&lt;br /&gt;
 |Prototype property type=[[Prototype/Recipe#Recipe_data|Recipe data]] or [[Types/bool|bool]]&lt;br /&gt;
 |Prototype property optional=true&lt;br /&gt;
 |Prototype property pagename={{FULLPAGENAME}}&lt;br /&gt;
}}&amp;lt;/span&amp;gt;&amp;lt;!-- &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
If the recipe does not have a difficulty, this is located directly in the prototype. Otherwise, if the &amp;quot;&#039;&#039;&#039;normal&#039;&#039;&#039;&amp;quot; or &amp;quot;&#039;&#039;&#039;expensive&#039;&#039;&#039;&amp;quot; property exists, the recipe has difficulty. Then, the recipe data has to be specified for each difficulty instead of directly in the prototype. If at least one difficulty has recipe data defined, the other difficulty can be set to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. This will disable the recipe for the difficulty, same as setting it &amp;lt;code&amp;gt;enabled = false&amp;lt;/code&amp;gt;. If it is enabled (by technologies etc), it will use the data from the other difficulty. Not setting a difficulty, e.g. &amp;lt;code&amp;gt;normal = nil&amp;lt;/code&amp;gt;, is possible and gives that difficulty the exact same properties as the difficulty that is defined. Setting one or both difficulties to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; is not valid and will produce an error. See below for examples of difficulty.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ingredients|[[Types/table|table]] of [[Types/IngredientPrototype|IngredientPrototype]]}}&lt;br /&gt;
A table containing ingredient names and counts. Can also contain information about fluid temperature and catalyst amounts. The catalyst amounts are automatically calculated from the recipe, or can be set manually in the [[Types/IngredientPrototype|IngredientPrototype]].&amp;lt;sup&amp;gt;[https://factorio.com/blog/post/fff-256]&amp;lt;/sup&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Maximum ingredient amount is 65535.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ingredients&amp;lt;/code&amp;gt; can be set to an empty table  to create a recipe that needs no ingredients.&amp;lt;br&amp;gt;&lt;br /&gt;
Duplicate ingredients, e.g. two entries for the &amp;quot;wood&amp;quot; item, are &#039;&#039;not&#039;&#039; allowed.&amp;lt;br&amp;gt;&lt;br /&gt;
In-game, the item ingredients are ordered by [[Prototype/ItemGroup#order_in_recipe|item group order_in_recipe]].&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{&amp;quot;iron-stick&amp;quot;, 2}, {&amp;quot;iron-plate&amp;quot;, 3}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The same with full format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-stick&amp;quot;, amount = 2}, {type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-plate&amp;quot;, amount = 3}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
For fluids, the full format always has to be used:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{type=&amp;quot;fluid&amp;quot;, name=&amp;quot;water&amp;quot;, amount=50}, {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;crude-oil&amp;quot;, amount=100}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|result|[[Types/string|string]]|optional=true}}&lt;br /&gt;
Can be replaced with the results parameter. The item created by this recipe. Must be the name of an item, such as &amp;quot;iron-gear-wheel&amp;quot;.&lt;br /&gt;
Note that &amp;lt;code&amp;gt;results&amp;lt;/code&amp;gt; takes priority over &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt;. So if a recipe has both keys set, &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt; will be ignored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|result_count|[[Types/uint32|uint32]]|1|optional=true}}&lt;br /&gt;
Optional. The number of items created by this recipe.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|results|[[Types/table|table]] of [[Types/ProductPrototype|ProductPrototype]]|optional=true}}&lt;br /&gt;
A table containing result names and counts. Can also contain information about fluid temperature and catalyst amounts. The catalyst amounts are automatically calculated from the recipe, or can be set manually in the [[Types/ProductPrototype|ProductPrototype]].&amp;lt;sup&amp;gt;[https://factorio.com/blog/post/fff-256]&amp;lt;/sup&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;results&amp;lt;/code&amp;gt; can be set to an empty table to create a recipe that produces nothing.&amp;lt;br&amp;gt;&lt;br /&gt;
Duplicate results, e.g. two entries for the &amp;quot;iron-plate&amp;quot; item, are allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results=&lt;br /&gt;
    {&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=3},&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;light-oil&amp;quot;, amount=3},&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;petroleum-gas&amp;quot;, amount=4}&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results = &lt;br /&gt;
    {&lt;br /&gt;
      {type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-nuggets&amp;quot;, amount = 9},&lt;br /&gt;
      {type = &amp;quot;item&amp;quot;, name = &amp;quot;gold-nuggets&amp;quot;, amount = 1}&lt;br /&gt;
     },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results = &lt;br /&gt;
    {&lt;br /&gt;
      {type = &amp;quot;fluid&amp;quot;, name = &amp;quot;steam&amp;quot;, amount = 1, temperature = 165}&lt;br /&gt;
     },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|energy_required|[[Types/double|double]]|0.5|optional=true}}&lt;br /&gt;
Optional. The amount of time it takes to make this recipe. Must be greater than 0.001.&lt;br /&gt;
&lt;br /&gt;
This is the number of seconds it takes to craft at crafting speed 1.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|emissions_multiplier|[[Types/double|double]]|1.0|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|requester_paste_multiplier|[[Types/uint32|uint32]]|30|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|overload_multiplier|[[Types/uint32|uint32]]|0|optional=true}}&lt;br /&gt;
Used to determine how many extra items are put into an assembling machine before it&#039;s considered &amp;quot;full enough&amp;quot;. See [[Inserters#Insertion_limits]].&lt;br /&gt;
&lt;br /&gt;
If set to 0, it instead uses the following formula: 1.166 / (energy_required / the assembler&#039;s crafting_speed), rounded up, and clamped between 2 and 100. The numbers used in this formula can be changed by the [[Prototype/UtilityConstants]] dynamic_recipe_overload_factor, minimum_recipe_overload_multiplier and maximum_recipe_overload_multiplier.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_inserter_overload|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
If the recipe is allowed to have the extra inserter overload bonus applied (4 * stack inserter stack size).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|enabled|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. This can be false to disable the recipe at the start of the game, or &amp;quot;true&amp;quot; to leave it enabled.&lt;br /&gt;
&lt;br /&gt;
If your recipe is unlocked by a technology, you should set this to &amp;quot;false&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hidden|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from crafting menus.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hide_from_stats|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from flow stats (item/fluid production statistics).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hide_from_player_crafting|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from the player&#039;s crafting screen. The recipe will still show up for selection in machines.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_decomposition|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether this recipe is allowed to be broken down for the recipe tooltip &amp;quot;Total raw&amp;quot; calculations.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_as_intermediate|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe can be used as an intermediate recipe in hand-crafting.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_intermediates|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe is allowed to use intermediate recipes when hand-crafting.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|always_show_made_in|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Whether the &amp;quot;Made in: {Machine}&amp;quot; part of the tool-tip should always be present, not only when the recipe can not be hand-crafted.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|show_amount_in_title|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe name should have the product amount in front of it, e.g. &amp;quot;2 [[transport belt]]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|always_show_products|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Whether the products are always shown in the recipe tool-tip.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|unlock_results|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether enabling this recipe unlocks its item products to show in selection lists (item filter, logistic request etc.).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|main_product|[[Types/string|string]]|optional=true}}&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
For recipes with more than one product: This defines of which result the icon, subgroup and name is used. If it is not set and the recipe has more than 1 result the recipe will use the recipe-name and recipe-description locale and its own subgroup and icon.&lt;br /&gt;
&lt;br /&gt;
For recipes with 1 result: The recipe uses the icon, subgroup and name of the result by default. If this property is set to an empty string, the recipe will use the properties of the recipe instead of the result.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;iron-plate&amp;quot; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-plate&amp;quot;,&lt;br /&gt;
    category = &amp;quot;smelting&amp;quot;,&lt;br /&gt;
    energy_required = 3.5,&lt;br /&gt;
    ingredients = {{&amp;quot;iron-ore&amp;quot;, 1}},&lt;br /&gt;
    result = &amp;quot;iron-plate&amp;quot;&lt;br /&gt;
  }&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;coal-liquefaction&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{&lt;br /&gt;
  type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
  name = &amp;quot;coal-liquefaction&amp;quot;,&lt;br /&gt;
  category = &amp;quot;oil-processing&amp;quot;,&lt;br /&gt;
  subgroup = &amp;quot;fluid-recipes&amp;quot;,&lt;br /&gt;
  order = &amp;quot;a[oil-processing]-c[coal-liquefaction]&amp;quot;,&lt;br /&gt;
  enabled = false,&lt;br /&gt;
  energy_required = 5,&lt;br /&gt;
  icon = &amp;quot;__base__/graphics/icons/fluid/coal-liquefaction.png&amp;quot;,&lt;br /&gt;
  icon_size = 32,&lt;br /&gt;
  ingredients =&lt;br /&gt;
  {&lt;br /&gt;
    {type=&amp;quot;item&amp;quot;, name=&amp;quot;coal&amp;quot;, amount=10},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=25},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;steam&amp;quot;, amount=50}&lt;br /&gt;
  },&lt;br /&gt;
  results=&lt;br /&gt;
  {&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=35},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;light-oil&amp;quot;, amount=15},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;petroleum-gas&amp;quot;, amount=20}&lt;br /&gt;
  },&lt;br /&gt;
  allow_decomposition = false&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;iron-gear-wheel&amp;quot; — recipe with difficulty ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 2}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modified so that it cannot be crafted in normal mode, unless unlocked via command/research ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal = false,&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modified so that the expensive recipe is always used, even in normal mode ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal = nil, --this line can be omitted&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Localisation&amp;diff=190277</id>
		<title>Tutorial:Localisation</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Localisation&amp;diff=190277"/>
		<updated>2022-11-06T18:42:11Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Default Behavior(s) for finding an Unspecified Localised String */ bad locale category [setting-description] -&amp;gt; [mod-setting-description]&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}Mods should define human readable names for prototypes that they add. They can also define descriptions for items or custom strings for usage in GUIs etc. This is called &#039;&#039;&#039;localisation&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
Translations are stored as .cfg files, with the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;welcome-message=Hello world&lt;br /&gt;
[category]&lt;br /&gt;
title=Category related title&lt;br /&gt;
# Comment&lt;br /&gt;
; Another comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
Any whitespace after or before &amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt; is included in the key or string, so &amp;lt;code&amp;gt;title =Category related title&amp;lt;/code&amp;gt; will give an unknown key error if you are looking for the &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; key, since it is the &amp;lt;code&amp;gt;title&amp;amp;nbsp;&amp;lt;/code&amp;gt; key.&lt;br /&gt;
&lt;br /&gt;
These files are located within the language code of the language in the locale folder of the mod, so as an English example &amp;lt;code&amp;gt;__mod__/locale/en/any_name_here.cfg&amp;lt;/code&amp;gt;. There can be more than 1 file per language, all of them will be read.&lt;br /&gt;
&lt;br /&gt;
== Localising simple strings ==&lt;br /&gt;
The simplest localisation is of items, entities etc. If we say the item is &amp;lt;code&amp;gt;iron-plate&amp;lt;/code&amp;gt;, the game will then search all loaded locale files for &amp;lt;code&amp;gt;item-name.iron-plate&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;item-description.iron-plate&amp;lt;/code&amp;gt;, which in the locale file looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[item-name]&lt;br /&gt;
iron-plate=Iron plate&lt;br /&gt;
[item-description]&lt;br /&gt;
iron-plate=A plate made of iron.&amp;lt;/pre&amp;gt;&lt;br /&gt;
If found in the locale, the label is set to this string. If not found, the game will instead show: &amp;lt;code&amp;gt;Unknown key: &amp;amp;quot;item-name.iron-plate&amp;amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In script, the localised string is formatted as &amp;lt;code&amp;gt;{&amp;amp;quot;category.name&amp;amp;quot;}&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;game.print({&amp;amp;quot;item-name.iron-plate&amp;amp;quot;})&amp;lt;/code&amp;gt; prints &#039;&#039;Iron plate&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It is possible to use [[rich text]] features in the localised text if the location where the text is shown supports it, e.g. in the chat, prototype names and prototype tooltips.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; can be used for line breaks if the location where the text is shown supports multiline text.&lt;br /&gt;
&lt;br /&gt;
== Localising with parameters ==&lt;br /&gt;
For more complex strings, localisation parameters can be used. For instance we want to show &#039;&#039;Time left: 10 minutes.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So a key with a placeholder is defined, which is replaced by the first parameter after the locale key.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;time-left=Time left: __1__ minutes.&amp;lt;/pre&amp;gt;&lt;br /&gt;
So it is used like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;time-left&amp;quot;, 10})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
It also works with multiple parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;time-left&amp;quot;, 10, 45})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;time-left=Time left: __1__ minutes and __2__ seconds.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Which results in &#039;&#039;Time left: 10 minutes and 45 seconds.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Built-in parameters ===&lt;br /&gt;
For some situations, we use localisation to show control schemes. For instance we want to say:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;technology-prompt=Use T to open the technology screen&amp;lt;/pre&amp;gt;&lt;br /&gt;
However the player may have rebound the key, but we can’t figure out which key as it would not be deterministic. So instead we use the built-in replacement functionality&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;technology-prompt=Use __CONTROL__open-technology-gui__ to open the technology screen.&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can also use this for items and entities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;big-iron-plate=Big __ITEM__iron-plate__&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;tiny-gun-turret=Tiny __ENTITY__gun-turret__&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== List of built-in parameters ====&lt;br /&gt;
&amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; is the name of a control or prototype, depending on context. &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; can be 1 or 2, it&#039;s used in parameters that control [[#Localising_alternate_input_names|alternate input names]]. &lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_MODIFIER__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_STYLE_BEGIN__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_STYLE_END__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_LEFT_CLICK__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-b&amp;lt;/code&amp;gt;[https://crowdin.com/project/factorio/discussions/214]&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_RIGHT_CLICK__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-2&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-x&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_KEY_SHIFT__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-2&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-x&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_KEY_CTRL__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-2&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-x&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL_LEFT_CLICK__n__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-1-alt-n&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-button-alt-n&amp;lt;/code&amp;gt; (with parameter &amp;lt;code&amp;gt;control-keys.controller-b&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL_RIGHT_CLICK__n__&amp;lt;/code&amp;gt; is replaced with &amp;lt;code&amp;gt;control-keys.mouse-button-2-alt-n&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;control-keys.controller-button-alt-n&amp;lt;/code&amp;gt; (with parameter &amp;lt;code&amp;gt;control-keys.controller-x&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;__REMARK_COLOR_BEGIN__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__REMARK_COLOR_END__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ALT_CONTROL__n__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__CONTROL_MOVE__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ENTITY__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__ITEM__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__TILE__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;__FLUID__name__&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plurals ===&lt;br /&gt;
Pluralization can be used in any string that uses a parameter (e.g. __1__) that is numeric, so something like an amount of minutes. It can be used multiple times per string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;format-days=__1__ __plural_for_parameter_1_{1=day|rest=days}__&amp;lt;/pre&amp;gt;&lt;br /&gt;
This results in &amp;quot;1 day&amp;quot; and &amp;quot;2 days&amp;quot; / &amp;quot;500 days&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
The number after &amp;lt;code&amp;gt;__plural_for_parameter_&amp;lt;/code&amp;gt; denotes which parameter is used to determine the plural. This is the parameter 1 in the above example. Anything inside the {} is used to make the plural. Each plural form is separated by a |.&lt;br /&gt;
The text in front of the = determines for what the plural form is used. Options for this are:&lt;br /&gt;
* a simple number, e.g. &amp;quot;1&amp;quot;.&lt;br /&gt;
* Multiple numbers, e.g. &amp;quot;2,3,4&amp;quot;.&lt;br /&gt;
* What the number ends with, e.g. &amp;quot;ends in 11&amp;quot; or &amp;quot;ends in 1&amp;quot;&lt;br /&gt;
* Multiple ends with, e.g. &amp;quot;ends in 1,ends in 2,ends in 12&amp;quot;.&lt;br /&gt;
* &amp;quot;rest&amp;quot; to give the default plural.&lt;br /&gt;
&lt;br /&gt;
Plural forms may be empty or contain other keys such as __1__ or spaces. This allows rather large plural forms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;__plural_for_parameter_1_{1=__1__ player is|rest=__1__ players are}__ connecting&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system chooses the first fitting plural that it encounters when multiple would fit:&lt;br /&gt;
&amp;lt;pre&amp;gt;__plural_for_parameter_1_{ends in 12=option 1|ends in 2=option 2|rest=option 3}__&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will result in &amp;quot;option 1&amp;quot; for 12 and in &amp;quot;option 2&amp;quot; for 22 and in &amp;quot;option 3&amp;quot; for numbers not ending with 2.&lt;br /&gt;
&lt;br /&gt;
=== Concatenating localised strings ===&lt;br /&gt;
The special locale key: &amp;lt;code&amp;gt;&amp;amp;quot;&amp;amp;quot;&amp;lt;/code&amp;gt; is used to concatenate, as the table format does not support concatenation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;game.print({&amp;quot;&amp;quot;, {&amp;quot;item-name.iron-plate&amp;quot;}, &amp;quot;: &amp;quot;, 60})&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Will result in: &#039;&#039;Iron plate: 60&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Localising alternate input names ===&lt;br /&gt;
&lt;br /&gt;
In the introduction campaign, a special locale system is used for informing players how to do certain actions with their mouse.&lt;br /&gt;
The normal form is to use eg:&lt;br /&gt;
&amp;lt;pre&amp;gt;how-to-build=Use __CONTROL__build__ to place a building&amp;lt;/pre&amp;gt;&lt;br /&gt;
which results in &amp;quot;Use Left mouse button to place a building&amp;quot;. A more natural phrasing would be &amp;quot;Left-click to place a building&amp;quot;, which can be achieved by using the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;how-to-build=__ALT_CONTROL__1__build__ to place a building&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These &amp;quot;alt&amp;quot; versions are controlled by a few special locale keys, mouse-button-X-alt-1 and mouse-button-X-alt-2. In English, form 1 produces eg &amp;quot;Left-click&amp;quot;, and form 2 produces eg &amp;quot;Left-clicking&amp;quot;.  Only two alt forms (&amp;quot;1&amp;quot; and &amp;quot;2&amp;quot;) are available at the moment, but if this a problem for some languages, more forms may be added in the future.&lt;br /&gt;
Extra mouse buttons, mouse scroll and keyboard keys are handled through the mouse-button-n-alt-1/2, mouse-wheel-alt-1/2 and keyboard-alt-1/2 keys, which just take the normal name and prepend something like &amp;quot;Press/Pressing&amp;quot;, or &amp;quot;Scroll/Scrolling&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When translating to another language, you can use whatever forms you want here, but the important part is that you are consistent when you use the alt-forms everywhere else. It does not necessarily make sense to just copy the usages of alt forms from the English locale, and for some languages it may be more natural to simply not use this system at all.&lt;br /&gt;
&lt;br /&gt;
== Accessing the localised result in code ==&lt;br /&gt;
While usually unneeded, it is possible to read the resulting localised text in code, for example to search in localised names. See [https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.request_translation LuaPlayer::request_translation] and  [https://lua-api.factorio.com/latest/events.html#on_string_translated on_string_translated event].&lt;br /&gt;
&lt;br /&gt;
== Default Behavior(s) for finding an Unspecified Localised String ==&lt;br /&gt;
If a localised_string is not defined in the prototype for certain prototype classes, e.g. entity, item, Factorio may have a default search behavior.&lt;br /&gt;
&lt;br /&gt;
Determining an item&#039;s localised name:&lt;br /&gt;
Note: the angle brackets are meant to mean a generic term, they are not part of the actual string. Also, place_result and placed_as_equipment_result are strings, and Factorio fetches the matching prototype to examine.&lt;br /&gt;
&lt;br /&gt;
# if localised_name is provided in the item prototype and it is not empty {}, use the provided value&lt;br /&gt;
# else if there is place_result and it has localised_name that is not an empty table: {}, use the localised_name of place_result&lt;br /&gt;
# else if there is place_result with an empty localised_name, use {&amp;quot;entity-name.&amp;lt;entity prototype name&amp;gt;&amp;quot;}&lt;br /&gt;
# else if there is placed_as_equipment_result and it has a localised_name that is not an empty table: {}, use the localised_name of placed_as_equipment_result&lt;br /&gt;
# else if there is placed_as_equipment_result with empty localised_name, use {&amp;quot;equipment-name.&amp;lt;equipment name&amp;gt;&amp;quot;}&lt;br /&gt;
# else use default {&amp;quot;item-name.&amp;lt;item name&amp;gt;&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Reference: [https://forums.factorio.com/viewtopic.php?p=494243#p494243]&lt;br /&gt;
&lt;br /&gt;
Example: The transport-belt item does not have a localised_name, so 1-&amp;gt;2. There is a place result, but not localised_name in the entity prototype. 2-&amp;gt;3. The place result lacks a localised_name. Use the localised string {&amp;quot;entity-name.transport-belt&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Such defaults often include a &amp;quot;leading key&amp;quot; using [&amp;lt;group&amp;gt;-name] or [&amp;lt;group&amp;gt;-description] (such as [recipe-name], [mod-setting-description]). However, each prototype may have a distinct search behavior before using those, based on presence/absence of values in the prototype. [[Prototype/Recipe]] for example may use the first product&#039;s localised_name, or the main_product&#039;s localised_name, or the localised string found in {&amp;quot;recipe-name.&amp;lt;recipe name&amp;gt;&amp;quot;], depending on values provided (and lacking) in the prototype.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Types/LocalisedString|LocalisedString data stage doc]]&lt;br /&gt;
* [https://lua-api.factorio.com/latest/Concepts.html#LocalisedString LocalisedString control stage doc]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Mod_structure&amp;diff=190242</id>
		<title>Tutorial:Mod structure</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Mod_structure&amp;diff=190242"/>
		<updated>2022-11-03T04:47:43Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* dependencies */ re-format text for readability. Minor rephrasing of incompatibility and versions.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}Mods are expected to have a certain structure in order to be loaded by the game. This page aims to explain that file structure and what each file is used for.&lt;br /&gt;
&lt;br /&gt;
== Mod folder and file structure ==&lt;br /&gt;
&lt;br /&gt;
The mod must either be in a folder, or in a folder inside a zip file. The mod folder (no zip file) must either be named in the pattern of &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt; or just &amp;lt;code&amp;gt;{mod-name}&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;test-mod-thing&amp;lt;/code&amp;gt;. The mod zip must be named in the pattern of &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;test-mod-thing_0.0.1&amp;lt;/code&amp;gt;. When using a zip file for the mod, the folder inside the zip file does not have any naming restrictions; only the zip file itself must be named with the &amp;lt;code&amp;gt;{mod-name}_{version-number}&amp;lt;/code&amp;gt; pattern. The mod name and its version number are defined in the [[#info.json|info.json]] file.&lt;br /&gt;
&lt;br /&gt;
=== Files ===&lt;br /&gt;
Inside the mod folder, the game automatically reads the following files during load:&lt;br /&gt;
* info.json — The only mandatory file. The [[#info.json|info.json]] identifies the mod, defines its version and other general properties.&lt;br /&gt;
* changelog.txt — Version history of the mod, to be shown in the mod browser. The changelog file must follow the strict [https://forums.factorio.com/viewtopic.php?t=67140 formatting requirements].&lt;br /&gt;
* thumbnail.png — Thumbnail to be shown on the mod portal and in the mod browser in-game. Ideally a 144x144px image file.&lt;br /&gt;
* settings.lua — This and the next two files are used to set up mod [[Tutorial:Mod settings|configuration options]].&lt;br /&gt;
* settings-updates.lua&lt;br /&gt;
* settings-final-fixes.lua&lt;br /&gt;
* data.lua — This and the next two files are used to define [[Prototype definitions|prototypes]].&lt;br /&gt;
* data-updates.lua — The load order of the three data*.lua files is explained on [https://lua-api.factorio.com/latest/Data-Lifecycle.html Data-Lifecycle].&lt;br /&gt;
* data-final-fixes.lua&lt;br /&gt;
* control.lua — This file is used for runtime scripting. Runtime scripting is documented on [https://lua-api.factorio.com/latest/index.html lua-api.factorio.com].&lt;br /&gt;
&lt;br /&gt;
=== Subfolders ===&lt;br /&gt;
Furthermore, the following folders inside the mod folder are recognized by the game:&lt;br /&gt;
* locale — Can contain up to one subfolder per language, identified with the language code, for example &amp;lt;code&amp;gt;en&amp;lt;/code&amp;gt; for English. The subfolder then has to contain at least one *.cfg file which defines the [[Tutorial:Localisation|translations]] for that language.&lt;br /&gt;
* scenarios — Custom [[scenario system|scenarios]] can be placed in subfolders of this folder.&lt;br /&gt;
* campaigns — Custom campaigns can be placed in subfolders of this folder.&lt;br /&gt;
* tutorials — Custom [[Prototype/Tutorial|tutorials]] can be placed in subfolders of this folder.&lt;br /&gt;
* migrations — [https://lua-api.factorio.com/latest/Migrations.html Migration files] are placed in this folder. They are a way to handle prototype changes and mod data structure changes between mod versions or game versions.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
Here is an example directory structure for a mod titled &amp;lt;code&amp;gt;my-armor-mod&amp;lt;/code&amp;gt; with a version number of &amp;lt;code&amp;gt;0.3.6&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
my-armor-mod_0.3.6.zip&lt;br /&gt;
|- aFolderName/&lt;br /&gt;
  |- control.lua&lt;br /&gt;
  |- data.lua&lt;br /&gt;
  |- info.json&lt;br /&gt;
  |- thumbnail.png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== info.json ==&lt;br /&gt;
&lt;br /&gt;
The info.json file identifies the mod and defines its version. If the game encounters a problem when parsing the file, the error message can be found in the [[log file]]. A minimal info.json file can look like this:&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;test-mod-thing&amp;quot;,&lt;br /&gt;
      &amp;quot;version&amp;quot;: &amp;quot;0.0.1&amp;quot;,&lt;br /&gt;
      &amp;quot;title&amp;quot;: &amp;quot;My best test mod&amp;quot;,&lt;br /&gt;
      &amp;quot;author&amp;quot;: &amp;quot;A very great tester&amp;quot;,&lt;br /&gt;
      &amp;quot;factorio_version&amp;quot;: &amp;quot;1.1&amp;quot;,&lt;br /&gt;
      &amp;quot;dependencies&amp;quot;: [&amp;quot;? optional-mod&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The info.json file supports the following fields:&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. The internal name of mod. The game accepts anything as a mod name, however the mod portal restricts mod names to only consist of alphanumeric characters, dashes and underscores. Note that the mod folder or mod zip file name has to contain the mod name, where the restrictions of the file system apply.&lt;br /&gt;
&lt;br /&gt;
: The game accepts mod names with a maximum length of 100 characters. The mod portal only accepts mods with names that are longer than 3 characters and shorter than 50 characters.&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. Defines the version of the mod in the format &amp;lt;code&amp;gt;&amp;quot;number.number.number&amp;quot;&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;&amp;quot;main.major.minor&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;0.6.4&amp;quot;&amp;lt;/code&amp;gt;. Each number can range from 0 to 65535.&lt;br /&gt;
&lt;br /&gt;
=== title === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. The display name of the mod, so it is not recommended to use someUgly_pRoGrAmMeR-name here. Can be overwritten with a locale entry in the &amp;lt;code&amp;gt;mod-name&amp;lt;/code&amp;gt; category, using the internal mod name as the key.&lt;br /&gt;
&lt;br /&gt;
: The game will reject a title field that is longer than 100 characters. However, this can be worked around by using the locale entry. The mod portal does not restrict mod title length.&lt;br /&gt;
&lt;br /&gt;
=== author === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Mandatory field. The author of the mod. This field does not have restrictions, it can also be a list of authors etc. The mod portal ignores this field, it will simply display the uploader&#039;s name as the author.&lt;br /&gt;
&lt;br /&gt;
=== contact === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Optional field. How the mod author can be contacted, for example an email address.&lt;br /&gt;
&lt;br /&gt;
=== homepage === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Optional field. Where the mod can be found on the internet. Note that the in-game mod browser shows the mod portal link additionally to this field. Please don&#039;t put &amp;quot;None&amp;quot; here, it makes the field on the mod portal website look ugly. Just leave the field empty if the mod doesn&#039;t have a website/forum thread/discord.&lt;br /&gt;
&lt;br /&gt;
=== description === &lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: Optional field. A short description of what your mod does. This is all that people get to see in-game. Can be overwritten with a locale entry in the &amp;lt;code&amp;gt;mod-description&amp;lt;/code&amp;gt; category, using the internal mod name as the key.&lt;br /&gt;
&lt;br /&gt;
=== factorio_version ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string|string]]&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;0.12&amp;quot;&lt;br /&gt;
&lt;br /&gt;
: Optional field. The major Factorio version that this mod supports. This can only be one version, not multiple. While the field is optional, usually mods are developed for major versions higher than the default 0.12, so the field has to be added anyway.&lt;br /&gt;
: Adding a minor version, e.g. &amp;quot;0.18.&#039;&#039;&#039;27&#039;&#039;&#039;&amp;quot; will make the mod portal reject the mod and the game act weirdly. That means this shouldn&#039;t be done; use only main and major version &amp;lt;code&amp;gt;&amp;quot;main.major&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;1.0&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
: Mods with the factorio_version &amp;quot;0.18&amp;quot; can also be loaded in 1.0 and the mod portal will return them when queried for factorio_version 1.0 mods.&lt;br /&gt;
&lt;br /&gt;
=== dependencies ===&lt;br /&gt;
: &#039;&#039;&#039;Type&#039;&#039;&#039;: array of [[#Dependency]]&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;Default&#039;&#039;&#039;: [&amp;quot;base&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
: Optional field. Mods that this mod depends on or is incompatible with. If this mod depends on another, the other mod will load first, see [https://lua-api.factorio.com/latest/Data-Lifecycle.html Data-Lifecycle]. An empty array allows get around the default and have no dependencies at all.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
: &amp;lt;pre&amp;gt;&amp;quot;dependencies&amp;quot;: [&amp;quot;mod-a&amp;quot;, &amp;quot;? mod-c &amp;gt; 0.4.3&amp;quot;, &amp;quot;! mod-g&amp;quot;]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:: &amp;lt;h4&amp;gt;&amp;lt;span class=&amp;quot;mw-headline&amp;quot; id=&amp;quot;Dependency&amp;quot;&amp;gt;Dependency&amp;lt;/span&amp;gt;&amp;lt;/h4&amp;gt;&lt;br /&gt;
:: Each dependency is a string that consists of up to three parts: &amp;lt;code&amp;gt;&amp;quot;&amp;lt;prefix&amp;gt; internal-mod-name &amp;lt;equality-operator version&amp;gt;&amp;quot;&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;&amp;quot;? some-mod-everyone-loves &amp;gt;= 4.2.0&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
::The equality operator (&amp;lt;code&amp;gt;&amp;lt;, &amp;lt;=, =, &amp;gt;= or &amp;gt;&amp;lt;/code&amp;gt;) combined with the version allows to define dependencies that require certain mod versions, but it is not required. Incompatibility does not support versions; if incompatibility is used, version is ignored.&lt;br /&gt;
&lt;br /&gt;
::The possible prefixes are:&lt;br /&gt;
:::&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; for incompatibility&lt;br /&gt;
:::&amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt; for an optional dependency&lt;br /&gt;
:::&amp;lt;code&amp;gt;(?)&amp;lt;/code&amp;gt; for a hidden optional dependency&lt;br /&gt;
:::&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt; for a dependency that does not affect load order, or no prefix for a hard requirement for the other mod.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/EnergySource&amp;diff=190240</id>
		<title>Types/EnergySource</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/EnergySource&amp;diff=190240"/>
		<updated>2022-11-03T02:11:23Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* output_flow_limit */ clarification&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basics ==&lt;br /&gt;
Specifies the way the entity gets its energy.&lt;br /&gt;
=== type ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory. Only valid values are &amp;quot;electric&amp;quot;, &amp;quot;burner&amp;quot;, &amp;quot;heat&amp;quot;, &amp;quot;fluid&amp;quot; or &amp;quot;void&amp;quot;, it specifies the type of the energy source to be used.&lt;br /&gt;
&lt;br /&gt;
=== emissions_per_minute ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional. The pollution an entity emits per minute at full energy consumption. &amp;lt;code&amp;gt;emissions_per_minute&amp;lt;/code&amp;gt; is exactly the value that is shown in the entity tooltip.&lt;br /&gt;
&lt;br /&gt;
=== render_no_power_icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. Whether to render the [[File:Electricity-icon-red.png|50px]] icon on the entity if it is low on power. Also applies to [[File:Fuel-icon-red.png|50px]] when using a burner energy source.&lt;br /&gt;
&lt;br /&gt;
=== render_no_network_icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. Whether to render the [[File:Electricity-icon-unplugged.png|50px]] icon on the entity if it is not connected to a electric network.&lt;br /&gt;
&lt;br /&gt;
== Electric energy source ==&lt;br /&gt;
=== buffer_capacity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Optional. How much energy the entity holds.&lt;br /&gt;
&lt;br /&gt;
=== usage_priority ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ElectricUsagePriority]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
=== input_flow_limit ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: max double&lt;br /&gt;
&lt;br /&gt;
Optional. The rate at which energy can be taken, from the network, to refill the energy buffer. 0 means 0.&lt;br /&gt;
&lt;br /&gt;
=== output_flow_limit ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: max double&lt;br /&gt;
&lt;br /&gt;
Optional. The rate at which energy can be provided, to the network, from the energy buffer. 0 means 0 0 means 0.&lt;br /&gt;
&lt;br /&gt;
=== drain ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Optional. How much energy (per second) will be continuously removed from the energy buffer. In game, this is shown in the tooltip as &amp;quot;Min. &#039;&#039;[Minimum]&#039;&#039; Consumption&amp;quot;. Applied as a constant consumption-per-tick, even when the entity has the property &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt; false.&lt;br /&gt;
&lt;br /&gt;
== Burner ==&lt;br /&gt;
=== fuel_inventory_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ItemStackIndex]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== burnt_inventory_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ItemStackIndex]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== smoke ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/SmokeSource]]&lt;br /&gt;
&lt;br /&gt;
Optional. Array of 1 or more smoke sources.&lt;br /&gt;
&lt;br /&gt;
=== light_flicker ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/LightFlickeringDefinition]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== effectivity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional. 1 means 100% effectivity. Must be greater than 0. Multiplier of the energy output.&lt;br /&gt;
&lt;br /&gt;
=== fuel_category ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;chemical&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Optional. The energy source can be used with fuel from this [[Prototype/FuelCategory|fuel category]]. For a list on built-in categories, see [[Data.raw#fuel-category]].&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;fuel_categories&amp;lt;/code&amp;gt; is defined, fuel_category is ignored.&lt;br /&gt;
&lt;br /&gt;
=== fuel_categories ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Optional. Same as above, only one of them can exist. For a list on built-in categories, see [[Data.raw#fuel-category]].&lt;br /&gt;
&lt;br /&gt;
Takes precedence over &amp;lt;code&amp;gt;fuel_category&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Heat energy source ==&lt;br /&gt;
=== max_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
Mandatory. max_temperature must be &amp;gt;= default_temperature.&lt;br /&gt;
&lt;br /&gt;
=== default_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 15&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== specific_heat ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== max_transfer ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== min_temperature_gradient ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== min_working_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 15&lt;br /&gt;
&lt;br /&gt;
Optional. min_working_temperature must be &amp;gt;= default_temperature. min_working_temperature must be &amp;lt;= max_temperature.&lt;br /&gt;
&lt;br /&gt;
=== minimum_glow_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/float]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
=== pipe_covers ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_pipe_covers ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_picture ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_glow ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== connections ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/HeatConnection]]&lt;br /&gt;
&lt;br /&gt;
Optional. The table may only contain up to 32 connections.&lt;br /&gt;
&lt;br /&gt;
== Void energy source ==&lt;br /&gt;
Void is free energy, there are no additional entries required.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
  energy_source = {type = &amp;quot;void&amp;quot;}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Fluid energy source ==&lt;br /&gt;
=== fluid_box ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/FluidBox]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
All standard fluid box configurations are acceptable, but the type must be &amp;quot;input&amp;quot; or &amp;quot;input-output&amp;quot; to function correctly.&lt;br /&gt;
Scale_fluid_usage, fluid_usage_per_tick or a filter on the fluidbox must be set to be able to calculate the fluid usage of the energy source.&lt;br /&gt;
&lt;br /&gt;
=== smoke ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/SmokeSource]]&lt;br /&gt;
&lt;br /&gt;
Optional. Array of 1 or more smoke sources.&lt;br /&gt;
&lt;br /&gt;
=== light_flicker ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/LightFlickeringDefinition]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== effectivity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional. 1 means 100% effectivity. Must be greater than 0. Multiplier of the energy output.&lt;br /&gt;
&lt;br /&gt;
=== burns_fluid ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: false&lt;br /&gt;
&lt;br /&gt;
Optional. If set to true, the energy source will calculate power based on the fluid&#039;s fuel_value entry, else it will calculate based on fluid temperature.&lt;br /&gt;
&lt;br /&gt;
=== scale_fluid_usage ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: false&lt;br /&gt;
&lt;br /&gt;
Optional. If set to true, the energy source will consume as much fluid as required to produce the desired power, if set to false it will consume as much as it is allowed to, wasting any excess.&lt;br /&gt;
&lt;br /&gt;
=== destroy_non_fuel_fluid ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. This property is used when:&lt;br /&gt;
* &amp;lt;code&amp;gt;burns_fluid&amp;lt;/code&amp;gt; is true and the fluid has a [[Prototype/Fluid#fuel_value|fuel_value]] of 0&lt;br /&gt;
* or &amp;lt;code&amp;gt;burns_fluid&amp;lt;/code&amp;gt; is false and the fluid is at default temperature&lt;br /&gt;
In these cases, this property determines whether the fluid should be destroyed, meaning that the fluid is consumed at the rate of &amp;lt;code&amp;gt;fluid_usage_per_tick&amp;lt;/code&amp;gt;, without producing any power.&lt;br /&gt;
&lt;br /&gt;
=== fluid_usage_per_tick ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional. The number of fluid units the energy source uses per tick.&lt;br /&gt;
If used with scale_fluid_usage, this specifies the maximum. If this value is not set, scale_energy_usage = false and a fluid box filter is set, the game will attempt to calculate this value from the fluid box filter&#039;s fluid&#039;s fuel_value or heat_capacity and the entity&#039;s energy_usage. If burns_fluid is false, maximum_temperature will also be used. If the attempt of the game to calculate this value fails ( scale_energy_usage = false and a fluid box filter is set), then scale_energy_usage will be forced to true, to prevent the energy source from being an infinite fluid sink.[https://forums.factorio.com/90613]&lt;br /&gt;
&lt;br /&gt;
=== maximum_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0, meaning unlimited&lt;br /&gt;
&lt;br /&gt;
If it is specified while scale_fluid_usage = false and fluid_usage_per_tick is not specified, the game will use this value to calculate fluid_usage_per_tick.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property type usage|{{FULLPAGENAME}}}}&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/EnergySource&amp;diff=190239</id>
		<title>Types/EnergySource</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/EnergySource&amp;diff=190239"/>
		<updated>2022-11-02T23:54:33Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* input_flow_limit */ clarification&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basics ==&lt;br /&gt;
Specifies the way the entity gets its energy.&lt;br /&gt;
=== type ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory. Only valid values are &amp;quot;electric&amp;quot;, &amp;quot;burner&amp;quot;, &amp;quot;heat&amp;quot;, &amp;quot;fluid&amp;quot; or &amp;quot;void&amp;quot;, it specifies the type of the energy source to be used.&lt;br /&gt;
&lt;br /&gt;
=== emissions_per_minute ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional. The pollution an entity emits per minute at full energy consumption. &amp;lt;code&amp;gt;emissions_per_minute&amp;lt;/code&amp;gt; is exactly the value that is shown in the entity tooltip.&lt;br /&gt;
&lt;br /&gt;
=== render_no_power_icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. Whether to render the [[File:Electricity-icon-red.png|50px]] icon on the entity if it is low on power. Also applies to [[File:Fuel-icon-red.png|50px]] when using a burner energy source.&lt;br /&gt;
&lt;br /&gt;
=== render_no_network_icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. Whether to render the [[File:Electricity-icon-unplugged.png|50px]] icon on the entity if it is not connected to a electric network.&lt;br /&gt;
&lt;br /&gt;
== Electric energy source ==&lt;br /&gt;
=== buffer_capacity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Optional. How much energy the entity holds.&lt;br /&gt;
&lt;br /&gt;
=== usage_priority ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ElectricUsagePriority]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
=== input_flow_limit ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: max double&lt;br /&gt;
&lt;br /&gt;
Optional. The rate at which energy can be taken, from the network, to refill the energy buffer. 0 means 0.&lt;br /&gt;
&lt;br /&gt;
=== output_flow_limit ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: max double&lt;br /&gt;
&lt;br /&gt;
Optional. How fast the energy can flow out of the entity. 0 means 0.&lt;br /&gt;
&lt;br /&gt;
=== drain ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Optional. How much energy (per second) will be continuously removed from the energy buffer. In game, this is shown in the tooltip as &amp;quot;Min. &#039;&#039;[Minimum]&#039;&#039; Consumption&amp;quot;. Applied as a constant consumption-per-tick, even when the entity has the property &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt; false.&lt;br /&gt;
&lt;br /&gt;
== Burner ==&lt;br /&gt;
=== fuel_inventory_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ItemStackIndex]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== burnt_inventory_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ItemStackIndex]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== smoke ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/SmokeSource]]&lt;br /&gt;
&lt;br /&gt;
Optional. Array of 1 or more smoke sources.&lt;br /&gt;
&lt;br /&gt;
=== light_flicker ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/LightFlickeringDefinition]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== effectivity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional. 1 means 100% effectivity. Must be greater than 0. Multiplier of the energy output.&lt;br /&gt;
&lt;br /&gt;
=== fuel_category ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;chemical&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Optional. The energy source can be used with fuel from this [[Prototype/FuelCategory|fuel category]]. For a list on built-in categories, see [[Data.raw#fuel-category]].&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;fuel_categories&amp;lt;/code&amp;gt; is defined, fuel_category is ignored.&lt;br /&gt;
&lt;br /&gt;
=== fuel_categories ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Optional. Same as above, only one of them can exist. For a list on built-in categories, see [[Data.raw#fuel-category]].&lt;br /&gt;
&lt;br /&gt;
Takes precedence over &amp;lt;code&amp;gt;fuel_category&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Heat energy source ==&lt;br /&gt;
=== max_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
Mandatory. max_temperature must be &amp;gt;= default_temperature.&lt;br /&gt;
&lt;br /&gt;
=== default_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 15&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== specific_heat ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== max_transfer ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== min_temperature_gradient ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== min_working_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 15&lt;br /&gt;
&lt;br /&gt;
Optional. min_working_temperature must be &amp;gt;= default_temperature. min_working_temperature must be &amp;lt;= max_temperature.&lt;br /&gt;
&lt;br /&gt;
=== minimum_glow_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/float]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
=== pipe_covers ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_pipe_covers ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_picture ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_glow ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== connections ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/HeatConnection]]&lt;br /&gt;
&lt;br /&gt;
Optional. The table may only contain up to 32 connections.&lt;br /&gt;
&lt;br /&gt;
== Void energy source ==&lt;br /&gt;
Void is free energy, there are no additional entries required.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
  energy_source = {type = &amp;quot;void&amp;quot;}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Fluid energy source ==&lt;br /&gt;
=== fluid_box ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/FluidBox]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
All standard fluid box configurations are acceptable, but the type must be &amp;quot;input&amp;quot; or &amp;quot;input-output&amp;quot; to function correctly.&lt;br /&gt;
Scale_fluid_usage, fluid_usage_per_tick or a filter on the fluidbox must be set to be able to calculate the fluid usage of the energy source.&lt;br /&gt;
&lt;br /&gt;
=== smoke ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/SmokeSource]]&lt;br /&gt;
&lt;br /&gt;
Optional. Array of 1 or more smoke sources.&lt;br /&gt;
&lt;br /&gt;
=== light_flicker ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/LightFlickeringDefinition]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== effectivity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional. 1 means 100% effectivity. Must be greater than 0. Multiplier of the energy output.&lt;br /&gt;
&lt;br /&gt;
=== burns_fluid ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: false&lt;br /&gt;
&lt;br /&gt;
Optional. If set to true, the energy source will calculate power based on the fluid&#039;s fuel_value entry, else it will calculate based on fluid temperature.&lt;br /&gt;
&lt;br /&gt;
=== scale_fluid_usage ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: false&lt;br /&gt;
&lt;br /&gt;
Optional. If set to true, the energy source will consume as much fluid as required to produce the desired power, if set to false it will consume as much as it is allowed to, wasting any excess.&lt;br /&gt;
&lt;br /&gt;
=== destroy_non_fuel_fluid ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. This property is used when:&lt;br /&gt;
* &amp;lt;code&amp;gt;burns_fluid&amp;lt;/code&amp;gt; is true and the fluid has a [[Prototype/Fluid#fuel_value|fuel_value]] of 0&lt;br /&gt;
* or &amp;lt;code&amp;gt;burns_fluid&amp;lt;/code&amp;gt; is false and the fluid is at default temperature&lt;br /&gt;
In these cases, this property determines whether the fluid should be destroyed, meaning that the fluid is consumed at the rate of &amp;lt;code&amp;gt;fluid_usage_per_tick&amp;lt;/code&amp;gt;, without producing any power.&lt;br /&gt;
&lt;br /&gt;
=== fluid_usage_per_tick ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional. The number of fluid units the energy source uses per tick.&lt;br /&gt;
If used with scale_fluid_usage, this specifies the maximum. If this value is not set, scale_energy_usage = false and a fluid box filter is set, the game will attempt to calculate this value from the fluid box filter&#039;s fluid&#039;s fuel_value or heat_capacity and the entity&#039;s energy_usage. If burns_fluid is false, maximum_temperature will also be used. If the attempt of the game to calculate this value fails ( scale_energy_usage = false and a fluid box filter is set), then scale_energy_usage will be forced to true, to prevent the energy source from being an infinite fluid sink.[https://forums.factorio.com/90613]&lt;br /&gt;
&lt;br /&gt;
=== maximum_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0, meaning unlimited&lt;br /&gt;
&lt;br /&gt;
If it is specified while scale_fluid_usage = false and fluid_usage_per_tick is not specified, the game will use this value to calculate fluid_usage_per_tick.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property type usage|{{FULLPAGENAME}}}}&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/EnergySource&amp;diff=190238</id>
		<title>Types/EnergySource</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/EnergySource&amp;diff=190238"/>
		<updated>2022-11-02T23:50:03Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* drain */ clarification of drain&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basics ==&lt;br /&gt;
Specifies the way the entity gets its energy.&lt;br /&gt;
=== type ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Mandatory. Only valid values are &amp;quot;electric&amp;quot;, &amp;quot;burner&amp;quot;, &amp;quot;heat&amp;quot;, &amp;quot;fluid&amp;quot; or &amp;quot;void&amp;quot;, it specifies the type of the energy source to be used.&lt;br /&gt;
&lt;br /&gt;
=== emissions_per_minute ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional. The pollution an entity emits per minute at full energy consumption. &amp;lt;code&amp;gt;emissions_per_minute&amp;lt;/code&amp;gt; is exactly the value that is shown in the entity tooltip.&lt;br /&gt;
&lt;br /&gt;
=== render_no_power_icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. Whether to render the [[File:Electricity-icon-red.png|50px]] icon on the entity if it is low on power. Also applies to [[File:Fuel-icon-red.png|50px]] when using a burner energy source.&lt;br /&gt;
&lt;br /&gt;
=== render_no_network_icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. Whether to render the [[File:Electricity-icon-unplugged.png|50px]] icon on the entity if it is not connected to a electric network.&lt;br /&gt;
&lt;br /&gt;
== Electric energy source ==&lt;br /&gt;
=== buffer_capacity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Optional. How much energy the entity holds.&lt;br /&gt;
&lt;br /&gt;
=== usage_priority ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ElectricUsagePriority]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
=== input_flow_limit ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: max double&lt;br /&gt;
&lt;br /&gt;
Optional. How fast the energy can flow into the entity. 0 means 0.&lt;br /&gt;
=== output_flow_limit ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: max double&lt;br /&gt;
&lt;br /&gt;
Optional. How fast the energy can flow out of the entity. 0 means 0.&lt;br /&gt;
&lt;br /&gt;
=== drain ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Optional. How much energy (per second) will be continuously removed from the energy buffer. In game, this is shown in the tooltip as &amp;quot;Min. &#039;&#039;[Minimum]&#039;&#039; Consumption&amp;quot;. Applied as a constant consumption-per-tick, even when the entity has the property &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt; false.&lt;br /&gt;
&lt;br /&gt;
== Burner ==&lt;br /&gt;
=== fuel_inventory_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ItemStackIndex]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== burnt_inventory_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/ItemStackIndex]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== smoke ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/SmokeSource]]&lt;br /&gt;
&lt;br /&gt;
Optional. Array of 1 or more smoke sources.&lt;br /&gt;
&lt;br /&gt;
=== light_flicker ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/LightFlickeringDefinition]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== effectivity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional. 1 means 100% effectivity. Must be greater than 0. Multiplier of the energy output.&lt;br /&gt;
&lt;br /&gt;
=== fuel_category ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;quot;chemical&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Optional. The energy source can be used with fuel from this [[Prototype/FuelCategory|fuel category]]. For a list on built-in categories, see [[Data.raw#fuel-category]].&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;fuel_categories&amp;lt;/code&amp;gt; is defined, fuel_category is ignored.&lt;br /&gt;
&lt;br /&gt;
=== fuel_categories ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Optional. Same as above, only one of them can exist. For a list on built-in categories, see [[Data.raw#fuel-category]].&lt;br /&gt;
&lt;br /&gt;
Takes precedence over &amp;lt;code&amp;gt;fuel_category&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Heat energy source ==&lt;br /&gt;
=== max_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
Mandatory. max_temperature must be &amp;gt;= default_temperature.&lt;br /&gt;
&lt;br /&gt;
=== default_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 15&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== specific_heat ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== max_transfer ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Energy]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
&lt;br /&gt;
=== min_temperature_gradient ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== min_working_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 15&lt;br /&gt;
&lt;br /&gt;
Optional. min_working_temperature must be &amp;gt;= default_temperature. min_working_temperature must be &amp;lt;= max_temperature.&lt;br /&gt;
&lt;br /&gt;
=== minimum_glow_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/float]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
=== pipe_covers ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_pipe_covers ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_picture ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== heat_glow ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Sprite4Way]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== connections ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/HeatConnection]]&lt;br /&gt;
&lt;br /&gt;
Optional. The table may only contain up to 32 connections.&lt;br /&gt;
&lt;br /&gt;
== Void energy source ==&lt;br /&gt;
Void is free energy, there are no additional entries required.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
  energy_source = {type = &amp;quot;void&amp;quot;}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Fluid energy source ==&lt;br /&gt;
=== fluid_box ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/FluidBox]]&lt;br /&gt;
&lt;br /&gt;
Mandatory.&lt;br /&gt;
All standard fluid box configurations are acceptable, but the type must be &amp;quot;input&amp;quot; or &amp;quot;input-output&amp;quot; to function correctly.&lt;br /&gt;
Scale_fluid_usage, fluid_usage_per_tick or a filter on the fluidbox must be set to be able to calculate the fluid usage of the energy source.&lt;br /&gt;
&lt;br /&gt;
=== smoke ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/SmokeSource]]&lt;br /&gt;
&lt;br /&gt;
Optional. Array of 1 or more smoke sources.&lt;br /&gt;
&lt;br /&gt;
=== light_flicker ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/LightFlickeringDefinition]]&lt;br /&gt;
&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
=== effectivity ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Optional. 1 means 100% effectivity. Must be greater than 0. Multiplier of the energy output.&lt;br /&gt;
&lt;br /&gt;
=== burns_fluid ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: false&lt;br /&gt;
&lt;br /&gt;
Optional. If set to true, the energy source will calculate power based on the fluid&#039;s fuel_value entry, else it will calculate based on fluid temperature.&lt;br /&gt;
&lt;br /&gt;
=== scale_fluid_usage ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: false&lt;br /&gt;
&lt;br /&gt;
Optional. If set to true, the energy source will consume as much fluid as required to produce the desired power, if set to false it will consume as much as it is allowed to, wasting any excess.&lt;br /&gt;
&lt;br /&gt;
=== destroy_non_fuel_fluid ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/bool]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: true&lt;br /&gt;
&lt;br /&gt;
Optional. This property is used when:&lt;br /&gt;
* &amp;lt;code&amp;gt;burns_fluid&amp;lt;/code&amp;gt; is true and the fluid has a [[Prototype/Fluid#fuel_value|fuel_value]] of 0&lt;br /&gt;
* or &amp;lt;code&amp;gt;burns_fluid&amp;lt;/code&amp;gt; is false and the fluid is at default temperature&lt;br /&gt;
In these cases, this property determines whether the fluid should be destroyed, meaning that the fluid is consumed at the rate of &amp;lt;code&amp;gt;fluid_usage_per_tick&amp;lt;/code&amp;gt;, without producing any power.&lt;br /&gt;
&lt;br /&gt;
=== fluid_usage_per_tick ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Optional. The number of fluid units the energy source uses per tick.&lt;br /&gt;
If used with scale_fluid_usage, this specifies the maximum. If this value is not set, scale_energy_usage = false and a fluid box filter is set, the game will attempt to calculate this value from the fluid box filter&#039;s fluid&#039;s fuel_value or heat_capacity and the entity&#039;s energy_usage. If burns_fluid is false, maximum_temperature will also be used. If the attempt of the game to calculate this value fails ( scale_energy_usage = false and a fluid box filter is set), then scale_energy_usage will be forced to true, to prevent the energy source from being an infinite fluid sink.[https://forums.factorio.com/90613]&lt;br /&gt;
&lt;br /&gt;
=== maximum_temperature ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0, meaning unlimited&lt;br /&gt;
&lt;br /&gt;
If it is specified while scale_fluid_usage = false and fluid_usage_per_tick is not specified, the game will use this value to calculate fluid_usage_per_tick.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property type usage|{{FULLPAGENAME}}}}&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Talk:Types/ProjectileTriggerDelivery&amp;diff=190232</id>
		<title>Talk:Types/ProjectileTriggerDelivery</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Talk:Types/ProjectileTriggerDelivery&amp;diff=190232"/>
		<updated>2022-10-31T07:43:36Z</updated>

		<summary type="html">&lt;p&gt;Honktown: start of discussion, added range_deviation topic&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=range_deviation questions=&lt;br /&gt;
After it was discovered range_deviation is *not* in tiles, here is an example of a &amp;quot;fragmentation grenade&amp;quot; action:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;		{&lt;br /&gt;
			type = &amp;quot;area&amp;quot;,&lt;br /&gt;
			repeat_count = 1200,&lt;br /&gt;
			radius = 30,&lt;br /&gt;
			trigger_from_target = true,&lt;br /&gt;
			target_entities = false,&lt;br /&gt;
			action_delivery =&lt;br /&gt;
			{&lt;br /&gt;
				type = &amp;quot;projectile&amp;quot;,&lt;br /&gt;
				projectile = &amp;quot;shotgun-pellet&amp;quot;,&lt;br /&gt;
				starting_speed = 1,&lt;br /&gt;
				starting_speed_deviation = 0.3,&lt;br /&gt;
				min_range = 50,&lt;br /&gt;
				max_range = 100,&lt;br /&gt;
				range_deviation = .5&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In game, the farthest a projectile travels is ~125 from the origin of the capsule (ok, so range_deviation / 2, add 1, * max range). However, for the least distance traveled of the projectiles, I find ~17.5. I do not understand and think the values could use some clarifying from a developer. [[User:Honktown|Honktown]] ([[User talk:Honktown|talk]]) 07:43, 31 October 2022 (UTC)&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/ProjectileTriggerDelivery&amp;diff=190231</id>
		<title>Types/ProjectileTriggerDelivery</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/ProjectileTriggerDelivery&amp;diff=190231"/>
		<updated>2022-10-31T07:35:38Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* range_deviation */ range_deviation is weird. 1/2 multiplier against max. cont. on discussion pages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Extends [[Types/TriggerDelivery]].&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
&lt;br /&gt;
=== projectile ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
Name of a [[Prototype/Projectile]].&lt;br /&gt;
&lt;br /&gt;
=== starting_speed ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/float]]&lt;br /&gt;
&lt;br /&gt;
Starting speed in tiles per tick.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
Inherits &amp;quot;source_effects&amp;quot; and &amp;quot;target_effects&amp;quot; properties from [[Types/TriggerDelivery]].&lt;br /&gt;
&lt;br /&gt;
=== starting_speed_deviation ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/float]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
=== direction_deviation ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/float]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Maximum deviation of the projectile from source orientation, in +/- ( x radians / 2). Example: 3.14 radians -&amp;gt; +/- (180° / 2), meaning up to 90° deviation in either direction of rotation.&lt;br /&gt;
&lt;br /&gt;
=== range_deviation ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/float]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Multiplied against 1/2 max range. A deviation of .5 will appear as a maximum of .25 (25%) deviation of an initial range goal. Post-deviation range may exceed max_range or be less than min_range.&lt;br /&gt;
&lt;br /&gt;
=== max_range ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1000&lt;br /&gt;
&lt;br /&gt;
=== min_range ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Prototype/Recipe&amp;diff=190204</id>
		<title>Prototype/Recipe</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Prototype/Recipe&amp;diff=190204"/>
		<updated>2022-10-25T15:31:50Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Recipe data */ difficulty = true is an error&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Prototype parent|PrototypeBase}}&lt;br /&gt;
A recipe. It can be a crafting recipe, a smelting recipe, or a custom type of recipe (see [[Prototype/RecipeCategory]]).&lt;br /&gt;
&lt;br /&gt;
{{Prototype TOC|recipe}}&lt;br /&gt;
&lt;br /&gt;
== General properties ==&lt;br /&gt;
Inherits all properties from [[PrototypeBase]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|category|[[Types/string|string]]|&amp;quot;crafting&amp;quot;|optional=true}}&lt;br /&gt;
Optional. The category of this recipe. The built-in categories can be found [[Data.raw#recipe-category|here]]. See also [[Prototype/RecipeCategory]].&lt;br /&gt;
&lt;br /&gt;
The recipe category &amp;quot;crafting&amp;quot; cannot contain recipes with fluid ingredients or products.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|subgroup|[[Types/string|string]]||optional=true}}&lt;br /&gt;
Optional. The subgroup of this recipe. If not specified, defaults to the subgroup of the product if there is only 1, or main_product if multiple products exist. If multiple products exist and no main_product is specified, the subgroup is required.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|icons, icon,  icon_size (IconSpecification)|[[Types/IconSpecification|IconSpecification]]|optional=true}}&lt;br /&gt;
An icon is mandatory for recipe with more than 1 product and no main_product. Otherwise defaults to the icon of main_product/1 product.&lt;br /&gt;
&lt;br /&gt;
If given, it overwrites the icon of the main_product/1 product.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|crafting_machine_tint|[[Types/table|table]] of [[Types/Color|Color]]|optional=true}}&lt;br /&gt;
Optional. Used by crafting machine &amp;lt;code&amp;gt;[[Prototype/CraftingMachine#working_visualisations|working_visualisations]]&amp;lt;/code&amp;gt; to tint certain layers with the recipe color. [[Types/WorkingVisualisation#apply_recipe_tint|apply_recipe_tint]] on the working visualisation determines which of the 4 colors is used for that layer (if any).&lt;br /&gt;
&lt;br /&gt;
Format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;crafting_machine_tint = { primary = {r=0,g=0,b=0,a=0}, secondary = {r=0,g=0,b=0,a=0}, tertiary = {r=0,g=0,b=0,a=0}, quaternary = {r=0,g=0,b=0,a=0}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each key/value pair is optional and defaults to the above value.&lt;br /&gt;
&lt;br /&gt;
== Recipe data ==&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
Anchor and property for the TOC at the top --&amp;gt;&amp;lt;span id=&amp;quot;normal&amp;quot;&amp;gt;{{#subobject:normal&lt;br /&gt;
 |Prototype property name=normal&lt;br /&gt;
 |Prototype property type=[[Prototype/Recipe#Recipe_data|Recipe data]] or [[Types/bool|bool]]&lt;br /&gt;
 |Prototype property optional=true&lt;br /&gt;
 |Prototype property pagename={{FULLPAGENAME}}&lt;br /&gt;
}}&amp;lt;/span&amp;gt;&amp;lt;!-- &lt;br /&gt;
Anchor and property for the TOC at the top --&amp;gt;&amp;lt;span id=&amp;quot;expensive&amp;quot;&amp;gt;{{#subobject:expensive&lt;br /&gt;
 |Prototype property name=expensive&lt;br /&gt;
 |Prototype property type=[[Prototype/Recipe#Recipe_data|Recipe data]] or [[Types/bool|bool]]&lt;br /&gt;
 |Prototype property optional=true&lt;br /&gt;
 |Prototype property pagename={{FULLPAGENAME}}&lt;br /&gt;
}}&amp;lt;/span&amp;gt;&amp;lt;!-- &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
If the recipe does not have a difficulty, this is located directly in the prototype. Otherwise, if the &amp;quot;&#039;&#039;&#039;normal&#039;&#039;&#039;&amp;quot; or &amp;quot;&#039;&#039;&#039;expensive&#039;&#039;&#039;&amp;quot; property exists, the recipe has difficulty. Then, the recipe data has to be specified for each difficulty instead of directly in the prototype. If at least one difficulty has recipe data defined, the other difficulty can be set to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. This will disable the recipe for the difficulty, same as setting it &amp;lt;code&amp;gt;enabled = false&amp;lt;/code&amp;gt;. If it is enabled (by technologies etc), it will use the data from the other difficulty. Not setting a difficulty, e.g. &amp;lt;code&amp;gt;normal = nil&amp;lt;/code&amp;gt;, is possible and gives that difficulty the exact same properties as the difficulty that is defined. Setting one or both difficulties to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; is not valid and will produce an error. See below for examples of difficulty.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|ingredients|[[Types/table|table]] of [[Types/IngredientPrototype|IngredientPrototype]]}}&lt;br /&gt;
A table containing ingredient names and counts. Can also contain information about fluid temperature and catalyst amounts. The catalyst amounts are automatically calculated from the recipe, or can be set manually in the [[Types/IngredientPrototype|IngredientPrototype]].&amp;lt;sup&amp;gt;[https://factorio.com/blog/post/fff-256]&amp;lt;/sup&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Maximum ingredient amount is 65535.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ingredients&amp;lt;/code&amp;gt; can be set to an empty table  to create a recipe that needs no ingredients.&amp;lt;br&amp;gt;&lt;br /&gt;
Duplicate ingredients, e.g. two entries for the &amp;quot;wood&amp;quot; item, are &#039;&#039;not&#039;&#039; allowed.&amp;lt;br&amp;gt;&lt;br /&gt;
In-game, the item ingredients are ordered by [[Prototype/ItemGroup#order_in_recipe|item group order_in_recipe]].&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{&amp;quot;iron-stick&amp;quot;, 2}, {&amp;quot;iron-plate&amp;quot;, 3}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The same with full format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-stick&amp;quot;, amount = 2}, {type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-plate&amp;quot;, amount = 3}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
For fluids, the full format always has to be used:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ingredients = {{type=&amp;quot;fluid&amp;quot;, name=&amp;quot;water&amp;quot;, amount=50}, {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;crude-oil&amp;quot;, amount=100}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|result|[[Types/string|string]]|optional=true}}&lt;br /&gt;
Can be replaced with the results parameter. The item created by this recipe. Must be the name of an item, such as &amp;quot;iron-gear-wheel&amp;quot;.&lt;br /&gt;
Note that &amp;lt;code&amp;gt;results&amp;lt;/code&amp;gt; takes priority over &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt;. So if a recipe has both keys set, &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt; will be ignored.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|result_count|[[Types/uint32|uint32]]|1|optional=true}}&lt;br /&gt;
Optional. The number of items created by this recipe.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|results|[[Types/table|table]] of [[Types/ProductPrototype|ProductPrototype]]|optional=true}}&lt;br /&gt;
A table containing result names and counts. Can also contain information about fluid temperature and catalyst amounts. The catalyst amounts are automatically calculated from the recipe, or can be set manually in the [[Types/ProductPrototype|ProductPrototype]].&amp;lt;sup&amp;gt;[https://factorio.com/blog/post/fff-256]&amp;lt;/sup&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;results&amp;lt;/code&amp;gt; can be set to an empty table to create a recipe that produces nothing.&amp;lt;br&amp;gt;&lt;br /&gt;
Duplicate results, e.g. two entries for the &amp;quot;iron-plate&amp;quot; item, are allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results=&lt;br /&gt;
    {&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=3},&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;light-oil&amp;quot;, amount=3},&lt;br /&gt;
      {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;petroleum-gas&amp;quot;, amount=4}&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results = &lt;br /&gt;
    {&lt;br /&gt;
      {type = &amp;quot;item&amp;quot;, name = &amp;quot;iron-nuggets&amp;quot;, amount = 9},&lt;br /&gt;
      {type = &amp;quot;item&amp;quot;, name = &amp;quot;gold-nuggets&amp;quot;, amount = 1}&lt;br /&gt;
     },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
results = &lt;br /&gt;
    {&lt;br /&gt;
      {type = &amp;quot;fluid&amp;quot;, name = &amp;quot;steam&amp;quot;, amount = 1, temperature = 165}&lt;br /&gt;
     },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|energy_required|[[Types/double|double]]|0.5|optional=true}}&lt;br /&gt;
Optional. The amount of time it takes to make this recipe. Must be greater than 0.001.&lt;br /&gt;
&lt;br /&gt;
This is the number of seconds it takes to craft at crafting speed 1.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|emissions_multiplier|[[Types/double|double]]|1.0|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|requester_paste_multiplier|[[Types/uint32|uint32]]|30|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|overload_multiplier|[[Types/uint32|uint32]]|0|optional=true}}&lt;br /&gt;
Used to determine how many extra items are put into an assembling machine before it&#039;s considered &amp;quot;full enough&amp;quot;. See [[Inserters#Insertion_limits]].&lt;br /&gt;
&lt;br /&gt;
If set to 0, it instead uses the following formula: 1.166 / (energy_required / the assembler&#039;s crafting_speed), rounded up, and clamped between 2 and 100. The numbers used in this formula can be changed by the [[Prototype/UtilityConstants]] dynamic_recipe_overload_factor, minimum_recipe_overload_multiplier and maximum_recipe_overload_multiplier.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_inserter_overload|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
If the recipe is allowed to have the extra inserter overload bonus applied (4 * stack inserter stack size).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|enabled|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. This can be false to disable the recipe at the start of the game, or &amp;quot;true&amp;quot; to leave it enabled.&lt;br /&gt;
&lt;br /&gt;
If your recipe is unlocked by a technology, you should set this to &amp;quot;false&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hidden|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from crafting menus.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hide_from_stats|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from flow stats (item/fluid production statistics).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|hide_from_player_crafting|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Hides the recipe from the player&#039;s crafting screen. The recipe will still show up for selection in machines.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_decomposition|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether this recipe is allowed to be broken down for the recipe tooltip &amp;quot;Total raw&amp;quot; calculations.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_as_intermediate|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe can be used as an intermediate recipe in hand-crafting.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|allow_intermediates|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe is allowed to use intermediate recipes when hand-crafting.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|always_show_made_in|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Whether the &amp;quot;Made in: {Machine}&amp;quot; part of the tool-tip should always be present, not only when the recipe can not be hand-crafted.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|show_amount_in_title|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether the recipe name should have the product amount in front of it, e.g. &amp;quot;2 [[transport belt]]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|always_show_products|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
Optional. Whether the products are always shown in the recipe tool-tip.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|unlock_results|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
Optional. Whether enabling this recipe unlocks its item products to show in selection lists (item filter, logistic request etc.).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|main_product|[[Types/string|string]]|optional=true}}&lt;br /&gt;
Optional.&lt;br /&gt;
&lt;br /&gt;
For recipes with more than one product: This defines of which result the icon, subgroup and name is used. If it is not set and the recipe has more than 1 result the recipe will use the recipe-name and recipe-description locale and its own subgroup and icon.&lt;br /&gt;
&lt;br /&gt;
For recipes with 1 result: The recipe uses the icon, subgroup and name of the result by default. If set this property is set to an empty string, the recipe will use the properties of the recipe instead of the result.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;iron-plate&amp;quot; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-plate&amp;quot;,&lt;br /&gt;
    category = &amp;quot;smelting&amp;quot;,&lt;br /&gt;
    energy_required = 3.5,&lt;br /&gt;
    ingredients = {{&amp;quot;iron-ore&amp;quot;, 1}},&lt;br /&gt;
    result = &amp;quot;iron-plate&amp;quot;&lt;br /&gt;
  }&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;coal-liquefaction&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{&lt;br /&gt;
  type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
  name = &amp;quot;coal-liquefaction&amp;quot;,&lt;br /&gt;
  category = &amp;quot;oil-processing&amp;quot;,&lt;br /&gt;
  subgroup = &amp;quot;fluid-recipes&amp;quot;,&lt;br /&gt;
  order = &amp;quot;a[oil-processing]-c[coal-liquefaction]&amp;quot;,&lt;br /&gt;
  enabled = false,&lt;br /&gt;
  energy_required = 5,&lt;br /&gt;
  icon = &amp;quot;__base__/graphics/icons/fluid/coal-liquefaction.png&amp;quot;,&lt;br /&gt;
  icon_size = 32,&lt;br /&gt;
  ingredients =&lt;br /&gt;
  {&lt;br /&gt;
    {type=&amp;quot;item&amp;quot;, name=&amp;quot;coal&amp;quot;, amount=10},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=25},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;steam&amp;quot;, amount=50}&lt;br /&gt;
  },&lt;br /&gt;
  results=&lt;br /&gt;
  {&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;heavy-oil&amp;quot;, amount=35},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;light-oil&amp;quot;, amount=15},&lt;br /&gt;
    {type=&amp;quot;fluid&amp;quot;, name=&amp;quot;petroleum-gas&amp;quot;, amount=20}&lt;br /&gt;
  },&lt;br /&gt;
  allow_decomposition = false&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;iron-gear-wheel&amp;quot; — recipe with difficulty ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 2}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modified so that it cannot be crafted in normal mode, unless unlocked via command/research ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal = false,&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modified so that the expensive recipe is always used, even in normal mode ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  {&lt;br /&gt;
    type = &amp;quot;recipe&amp;quot;,&lt;br /&gt;
    name = &amp;quot;iron-gear-wheel&amp;quot;,&lt;br /&gt;
    normal = nil, --this line can be omitted&lt;br /&gt;
    expensive =&lt;br /&gt;
    {&lt;br /&gt;
      ingredients = {{&amp;quot;iron-plate&amp;quot;, 4}},&lt;br /&gt;
      result = &amp;quot;iron-gear-wheel&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  },&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/ItemProductPrototype&amp;diff=190202</id>
		<title>Types/ItemProductPrototype</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/ItemProductPrototype&amp;diff=190202"/>
		<updated>2022-10-23T21:05:49Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* probability */ effect and outcome of using probability (as it appears in game)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__An item product definition, for example for a [[Prototype/Recipe]]. Its loading is triggered by the &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; of a [[Types/ProductPrototype]] being &amp;quot;item&amp;quot;. It can be specified as a table with named or numbered keys, but not a mix of both.&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
&lt;br /&gt;
=== name or 1 ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/string]]&lt;br /&gt;
&lt;br /&gt;
The name of a [[Prototype/Item]].&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
&lt;br /&gt;
=== amount or 2 ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint16]]&lt;br /&gt;
&lt;br /&gt;
Mandatory when using numbered keys (an array).&amp;lt;br&amp;gt;&lt;br /&gt;
If &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; is present, &amp;lt;code&amp;gt;amount_min&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;amount_max&amp;lt;/code&amp;gt; are not loaded.&lt;br /&gt;
&lt;br /&gt;
=== probability ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 1&lt;br /&gt;
&lt;br /&gt;
Value between 0 and 1, 0 for 0% chance and 1 for 100% chance.&lt;br /&gt;
&lt;br /&gt;
The effect of probability is no product, or, a linear distribution on [min, max]. For a recipe with probability p, amount_min min, and amount_max max, the Expected Value of this &#039;&#039;&#039;product&#039;&#039;&#039; can be expressed as &amp;lt;code&amp;gt;p * (0.5 * (max + min))&amp;lt;/code&amp;gt;. This is what will be shown in a recipe tooltip. The effect of &amp;lt;code&amp;gt;catalyst_amount&amp;lt;/code&amp;gt; on the product is not shown.&lt;br /&gt;
&lt;br /&gt;
=== amount_min ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint16]]&lt;br /&gt;
&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; is not specified and named keys are being used.&lt;br /&gt;
&lt;br /&gt;
=== amount_max ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint16]]&lt;br /&gt;
&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; is not specified and named keys are being used.&lt;br /&gt;
&lt;br /&gt;
If set to a number that is less than &amp;lt;code&amp;gt;amount_min&amp;lt;/code&amp;gt;, the game will use &amp;lt;code&amp;gt;amount_min&amp;lt;/code&amp;gt; internally.&lt;br /&gt;
&lt;br /&gt;
=== catalyst_amount ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint16]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
Amount that should not be affected by productivity modules (not yielded from bonus production) and should not be included in the item production statistics.&lt;br /&gt;
&lt;br /&gt;
If this ItemProductPrototype is used in a recipe, the catalyst amount is calculated automatically based on the [[Prototype/Recipe#ingredients|ingredients]] and [[Prototype/Recipe#results|results]].[https://factorio.com/blog/post/fff-256]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Types/ProductPrototype]]&lt;br /&gt;
* [[Types/FluidProductPrototype]]&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Prototype/Container&amp;diff=190168</id>
		<title>Prototype/Container</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Prototype/Container&amp;diff=190168"/>
		<updated>2022-10-15T02:29:21Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* Optional properties */ clarified behavior of enable_inventory_bar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Prototype parent|Prototype/EntityWithOwner}}&lt;br /&gt;
A generic container, such as a chest. Can not be rotated.&lt;br /&gt;
&lt;br /&gt;
{{Prototype TOC|container}}&lt;br /&gt;
&lt;br /&gt;
== Extensions ==&lt;br /&gt;
* [[Prototype/LogisticContainer]] &#039;&#039;&#039;logistic-container&#039;&#039;&#039;&lt;br /&gt;
** [[Prototype/InfinityContainer]] &#039;&#039;&#039;infinity-container&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
This prototype inherits all the properties from [[Prototype/EntityWithOwner]].&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|inventory_size|[[Types/uint16|uint16]]}}&lt;br /&gt;
The number of slots in this container.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|picture|[[Types/Sprite|Sprite]]}}&lt;br /&gt;
The picture displayed for this entity.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|inventory_type|[[Types/string|string]]|&amp;quot;with_bar&amp;quot;|optional=true}}&lt;br /&gt;
One of &amp;quot;with_bar&amp;quot; and &amp;quot;with_filters_and_bar&amp;quot;. Whether the inventory of this container can be filtered (like cargo wagons) or not.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|enable_inventory_bar|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
If the inventory limiter (red X) is visible. This does not change the inventory itself ([https://lua-api.factorio.com/latest/LuaInventory.html#LuaInventory.supports_bar LuaInventory.supports_bar()] will not change and the bar can still be modified by script).&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|scale_info_icons|[[Types/bool|bool]]|false|optional=true}}&lt;br /&gt;
If the icons of items shown in alt-mode should be scaled to the containers size.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|circuit_wire_connection_point|[[Types/WireConnectionPoint|WireConnectionPoint]]|optional=true}}&lt;br /&gt;
Defines how wires visually connect to this container.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|circuit_wire_max_distance|[[Types/double|double]]|0|optional=true}}&lt;br /&gt;
The maximum circuit wire distance for this container.&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|draw_copper_wires|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|draw_circuit_wires|[[Types/bool|bool]]|true|optional=true}}&lt;br /&gt;
&lt;br /&gt;
{{Prototype property|circuit_connector_sprites|[[Types/CircuitConnectorSprites|CircuitConnectorSprites]]|optional=true}}&lt;br /&gt;
The pictures displayed for circuit connections to this container.&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/IconData&amp;diff=190090</id>
		<title>Types/IconData</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/IconData&amp;diff=190090"/>
		<updated>2022-10-04T08:43:07Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* icon_mipmaps */ tiniest inconsistency. changing comma to x between resolution example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basics ==&lt;br /&gt;
Data of one icon &amp;quot;layer&amp;quot; for the &amp;lt;code&amp;gt;icons&amp;lt;/code&amp;gt; property of the [[Types/IconSpecification]].&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
=== icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/FileName]]&lt;br /&gt;
&lt;br /&gt;
The path to the icon.&lt;br /&gt;
&lt;br /&gt;
=== icon_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/SpriteSizeType]]&lt;br /&gt;
&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;icon_size&amp;lt;/code&amp;gt; is not specified outside of &amp;lt;code&amp;gt;icons&amp;lt;/code&amp;gt;. The size of the square icon, in pixels, e.g. 32 for a 32px by 32px icon.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
=== tint ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Color]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;lt;nowiki&amp;gt;{r=1, g=1, b=1, a=1} (white)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tint of the icon.&lt;br /&gt;
&lt;br /&gt;
=== shift ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/vector]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: {0, 0}&lt;br /&gt;
&lt;br /&gt;
Used to offset the icon &amp;quot;layer&amp;quot; from the overall icon.&amp;lt;br&amp;gt;&lt;br /&gt;
The shift is applied from the center (so negative shifts are left and up, respectively). Shift uses the unit &amp;quot;pixels after scaling&amp;quot;, see [[#Notes]].&lt;br /&gt;
&lt;br /&gt;
=== scale ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default for items/recipes&#039;&#039;&#039;: (32/icon_size)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default for technologies&#039;&#039;&#039;: (256/icon_size)&lt;br /&gt;
&lt;br /&gt;
When set, specifies the scale of the icon on the GUI scale.&amp;lt;br&amp;gt;&lt;br /&gt;
Scale 2 means that the icon will be 2 times bigger on screen (and more pixelated).&lt;br /&gt;
&lt;br /&gt;
=== icon_mipmaps ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint8]]&lt;br /&gt;
&lt;br /&gt;
Icons of reduced size will be used at decreased scale. 0 or 1 mipmaps is a single image. The file must contain 1/2 size images with a geometric-ratio, for each mipmap level. Each next level is aligned to the upper-left corner. Example sequence: 128x128@(0,0), 64x64@(128,0), 32x32@(196,0) is 3 mipmaps.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&lt;br /&gt;
* Only the first icon layer will display a shadow.&lt;br /&gt;
* The final combination of icons will always be resized in GUI based on the first icon layer&#039;s size, but won&#039;t be resized when displayed on machines in alt-mode.&lt;br /&gt;
: (example: recipe first icon layer is size 128, scale 1, the icon group will be displayed at resolution /4 to fit the 32px GUI boxes, but will be displayed 4 times as large on buildings)&lt;br /&gt;
* Shift values are based on final size (icon_size * scale) of the first icon.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{&lt;br /&gt;
  icon = &amp;quot;__base__/graphics/icons/fluid/heavy-oil.png&amp;quot;,&lt;br /&gt;
  icon_size = 64,&lt;br /&gt;
  scale = 0.5,&lt;br /&gt;
  shift = {4, -8}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Multiplayer&amp;diff=190044</id>
		<title>Multiplayer</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Multiplayer&amp;diff=190044"/>
		<updated>2022-09-25T23:38:05Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* How to list a server-hosted game on the matching server */ server description increased to 5000 characters some time ago, noting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
[[File:players_colored_preview.png|190px|right]]In addition to being a single-player game, Factorio also supports multiplayer, allowing many [[player]]s to cooperate and assist each other, or work against each other in pvp. This page documents how to set up a multiplayer game, how to join one, and the Multiplayer Admin features for managing other users and the server. By default, multiplayer games run the CO-OP [[Game modes and options|freeplay scenario]] where all players work together to launch a rocket with a satellite into space. Other scenarios, including PvP maps, are available for download from the [https://forums.factorio.com/viewforum.php?f=36&amp;amp;sid=93d1fbe9336d31d6bac60847b6c97985 Maps and Scenarios forum].&lt;br /&gt;
&lt;br /&gt;
== Setting Up a Multiplayer Game ==&lt;br /&gt;
&lt;br /&gt;
[[File:multiplayer_game_night.png|thumb|250px|A multiplayer game.]]Multiplayer games can be joined, hosted while playing, or hosted by a dedicated server.  Multiplayer games can be advertised to other players on the same LAN or worldwide.&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;Multiplayer&#039;&#039; button in the &#039;&#039;Play&#039;&#039; menu to start playing a multiplayer game, choose &#039;&#039;New&#039;&#039; or &#039;&#039;Load&#039;&#039; or &#039;&#039;Scenarios&#039;&#039; to host and play, or &#039;&#039;Browse&#039;&#039; or &#039;&#039;Play on LAN&#039;&#039; to connect to an already-running game. The host can also choose not to advertise the game at all, in which case you&#039;ll need the server&#039;s (public or otherwise reachable) IP address; you can then &#039;&#039;Connect&#039;&#039; directly to that to join the game.&lt;br /&gt;
&lt;br /&gt;
Notes and tips:&lt;br /&gt;
&lt;br /&gt;
* All game instances need the installation of &#039;&#039;exactly the same&#039;&#039; game-versions and mods.&lt;br /&gt;
* Factorio servers use port &#039;&#039;&#039;34197&#039;&#039;&#039;. The port can be changed in the [[Application directory|config]] file.&lt;br /&gt;
* Factorio uses &#039;&#039;&#039;UDP only&#039;&#039;&#039;. The game builds its own &amp;quot;reliable delivery&amp;quot; layer built on UDP to deal with packet loss and reordering issues.&lt;br /&gt;
** Make sure you configure your router&#039;s port forwarding correctly for port &#039;&#039;&#039;34197&#039;&#039;&#039;.&lt;br /&gt;
** Make sure your router does not [https://doc.pfsense.org/index.php/Static_Port randomize the source port] on packets outbound from &#039;&#039;&#039;34197&#039;&#039;&#039;.  Some routers do this and require [https://forum.pfsense.org/index.php?PHPSESSID=3k4h9n5o2tksgqv910fknf7qt7&amp;amp;topic=142188.msg798594#msg798594 additional configuration] to prevent it.&lt;br /&gt;
** Make sure there is no firewall or anti-virus blocking the UDP-packets.&lt;br /&gt;
* The hard limit for the number of players is [https://forums.factorio.com/viewtopic.php?f=53&amp;amp;t=6481&amp;amp;p=50661#p50586 65,535]. However, practical limit for this is much lower, popular streamers have managed to get well over a hundred players.&lt;br /&gt;
&lt;br /&gt;
=== Dedicated/Headless server ===&lt;br /&gt;
&lt;br /&gt;
As of Factorio version 0.12.0 onwards, a dedicated (or headless) server can be started using the --start-server command line option. You can run factorio --help to get a list of all command-line arguments that Factorio accepts.&lt;br /&gt;
&lt;br /&gt;
In the headless mode:&lt;br /&gt;
* Graphics are not initialized (faster start up, less memory usage, works on completely headless servers)&lt;br /&gt;
* Game starts immediately and loads a save given as a parameter to the command&lt;br /&gt;
* The server has no character in game&lt;br /&gt;
* Game is paused while there are no players connected (though this can be overridden using the no-auto-pause option in the server-settings.json)&lt;br /&gt;
* Saves the game on exit (and autosaves normally)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;0.13 onwards expects --start-server to be followed by a path to a save file.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will need to create your save file before you start the server, as the dedicated server REQUIRES a save file to be provided. This can easily be done using the --create command-line argument. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./bin/x64/factorio --create ./saves/my-save.zip       # This creates a new save, as if by clicking the New Game button in the GUI&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./bin/x64/factorio --start-server ./saves/my-save.zip # This starts a server that will host the file created on the previous line&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several JSON configuration files that factorio can make use of to change the server and map settings:&lt;br /&gt;
* &#039;&#039;&#039;map-gen-settings&#039;&#039;&#039; to set parameters used by the map generator such as width and height, ore patch frequency and size, etc. (Added in 0.13)&lt;br /&gt;
* &#039;&#039;&#039;map-settings&#039;&#039;&#039; to control pollution spread, biter expansion and evolution, and more (Added in 0.15)&lt;br /&gt;
* &#039;&#039;&#039;server-settings&#039;&#039;&#039; which consolidated several command-line options into a single file (Added in 0.14.12)&lt;br /&gt;
Example files for each of these parameters are included in the data subdirectory.&lt;br /&gt;
&lt;br /&gt;
The --map-gen-settings and --map-settings options must be used with the --create option when you create a new map.  For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;./bin/x64/factorio --create saves/my-save.zip --map-gen-settings my-map-gen-settings.json --map-settings my-map-settings.json&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting the factorio server requires you to specify the location of the server-settings.json file. By default this is in the factorio data folder. For example to start factorio using the most recent saved map, you would run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./bin/x64/factorio --start-server-load-latest --server-settings ./data/server-settings.json&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On windows, it may be useful to start the server with a .bat file. The bat file should have the following content:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;start /wait .\bin\x64\factorio.exe --start-server-load-latest --server-settings .\data\server-settings.json&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;See [[Command_line_parameters]] for more command line parameters.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Setting up a Linux Factorio server ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Factorio now requires &amp;lt;tt&amp;gt;glibc&amp;lt;/tt&amp;gt; version 2.18, but CentOS/RHEL 7 only ship with version 2.17 so this guide will no longer work without [https://forums.factorio.com/viewtopic.php?t=54654#p324493 manually compiling &amp;lt;tt&amp;gt;glibc&amp;lt;/tt&amp;gt; 2.18].&lt;br /&gt;
&lt;br /&gt;
This step-by-step guide has been verified on fresh CentOS 7 and RHEL 7 installs but should be applicable with little to no changes on most distributions.&lt;br /&gt;
&lt;br /&gt;
The guide assumes you will install the headless server under &#039;&#039;&#039;/opt/factorio&#039;&#039;&#039;, adjust paths according to your own setup. We will also suggest that you run the Factorio server as a separate user to harden security of your setup.&lt;br /&gt;
&lt;br /&gt;
Note that there are two distinct packages for Linux that can be used to run a headless server. First is the usual Linux download, that contains the full game. The other is the special  [https://www.factorio.com/download headless package]. The headless package does not contain any files irrelevant for a pure server, such as graphics and sounds. It is also not linked against libraries that may not be present on a server machine, such as Xlib, libGL or libasound. This option should be selected if running in a 3rd party hosted server.&lt;br /&gt;
&lt;br /&gt;
This guide does not handle firewall/port forwarding since this can be done in various ways on Linux (make sure to read up how this is done as a Linux admin on your particular distribution)&lt;br /&gt;
&lt;br /&gt;
==== Basic installation ====&lt;br /&gt;
&lt;br /&gt;
* Download the selected package -- either full game or the headless package -- and upload the Linux tar.gz or tar.xz package to your server /tmp&lt;br /&gt;
* Extract the package in /tmp to /opt/factorio&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$cd /opt/&lt;br /&gt;
&lt;br /&gt;
$sudo tar -xzf /tmp/factorio.tar.gz # Use the correct file name. It includes the factorio version number&lt;br /&gt;
$sudo tar -xJf /tmp/factorio.tar.xz # if you downloaded a .tar.xz file (ver 0.15.x)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Add a new user to your system and assign ownership of the factorio dir to it (please, do not run as the root user, sudo may be needed)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$useradd factorio&lt;br /&gt;
$chown -R factorio:factorio /opt/factorio&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Try the binary&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$su factorio&lt;br /&gt;
$/opt/factorio/bin/x64/factorio --start-server savename&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As long as it fails saying it cannot find/open the savename.zip you are set! Just upload a save from your own computer and put it in the /opt/factorio/saves directory, or use the --create ./saves/newgame.zip argument.&lt;br /&gt;
&lt;br /&gt;
=== How to list a server-hosted game on the matching server ===&lt;br /&gt;
&lt;br /&gt;
In order to publish the game to the matching server, Factorio needs to be given some more information than just the save file location. These information are provided in a &#039;&#039;server settings file&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To create a server settings file, look at the example file located in &#039;&#039;&#039;data/server-settings.example.json&#039;&#039;&#039; in the Factorio [[Application directory]]. The recommended way is to make a copy of this example file and edit the copy.&lt;br /&gt;
&lt;br /&gt;
The following values can be changed:&lt;br /&gt;
; Name: This will be the name under which the server will be listed in the server browser&lt;br /&gt;
; Description: A description of your server. May contain up to 5000 characters. [https://factorio.com/blog/post/fff-304 MP server description]&lt;br /&gt;
; Tags: A list of game tags&lt;br /&gt;
; Max Players: Allows you to limit the number of players that can be connected to the server at the same time. If you want no limit, just set max_players to 0.&lt;br /&gt;
* Visibility for server browser: May be either public, LAN or hidden.&lt;br /&gt;
** Public: The server will appear in the public server list. This requires the login credentials below to be filled in.&lt;br /&gt;
** LAN: The server will not appear in the public server list, but will be available through the Play On LAN button&lt;br /&gt;
** Hidden: Clients will have to connect using the server&#039;s IP address&lt;br /&gt;
* User credentials using a username and password or authentication token (found on the factorio website or in the player-data.json): These are necessary if you wish to make the server public. Otherwise, they can be left empty.&lt;br /&gt;
** For security reasons it is recommended to use authentication token as this document is stored as plain text. Though it should be noted that an authentication token is a sensitive piece of information as well, and you are well-advised to keep it secret.&lt;br /&gt;
* Server Password&lt;br /&gt;
** Field name is game_password&lt;br /&gt;
* Whether to verify user identity&lt;br /&gt;
(There are additional values in v0.14 of factorio.)&lt;br /&gt;
&lt;br /&gt;
=== Technical Implementation Details ===&lt;br /&gt;
&lt;br /&gt;
Notes about some technical details surrounding multiplayer have been published by the development team in several Friday Facts blog posts:&lt;br /&gt;
&lt;br /&gt;
* [http://www.factorio.com/blog/post/fff-76 Lock step architecture]&lt;br /&gt;
* [http://www.factorio.com/blog/post/fff-99 Client-server connections]&lt;br /&gt;
* [http://www.factorio.com/blog/post/fff-143 NAT punching, introduced in 0.13]&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous Tips ===&lt;br /&gt;
* The key for [[Console|console commands]] is also used initiate chat in multiplayer. To execute a command instead of chatting, you need to type &#039;&#039;/c&#039;&#039; before the command. Commands executed are &#039;&#039;visible to all players&#039;&#039;. Additionally, the multiplayer game must have been started with commands allowable for commands to work.&lt;br /&gt;
* Set the player&#039;s color using the command&lt;br /&gt;
 /color r g b&lt;br /&gt;
r, g and b are for red, green and blue respectively (possible values are between 0 and 1, use [https://www.w3schools.com/colors/colors_converter.asp this site] to convert colors to rgb numbers).&lt;br /&gt;
* To give yourself admin access, you need to create a server-adminlist.json in the same directory as factorio-current.log. The file should contain a list of admins, like so: &amp;lt;code&amp;gt;[ &amp;quot;user1&amp;quot;, &amp;quot;user2&amp;quot; ]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This file will be created if you promote a player through the console.&lt;br /&gt;
&lt;br /&gt;
== Joining a Multiplayer game ==&lt;br /&gt;
&lt;br /&gt;
As of version 0.13, players no longer necessarily have to port-forward to play with others. Players may join each other through Steam, or by just the port-forwarded host.&lt;br /&gt;
&lt;br /&gt;
Players wishing to join a game may do so in multiple ways:&lt;br /&gt;
&lt;br /&gt;
* Joining by directly inputting a public IP and port into Factorio.&lt;br /&gt;
* Selecting the server from the active public server menu.&lt;br /&gt;
* Joining through Steam&#039;s services.&lt;br /&gt;
* Playing a local LAN game.&lt;br /&gt;
&lt;br /&gt;
=== Joining by IP ===&lt;br /&gt;
&lt;br /&gt;
To join a multiplayer game by IP, you will need to know the public IP of a valid server. You can find this through social media, websites, or by word of mouth. After acquiring the IP and port, simply go to play -&amp;gt; Multiplayer -&amp;gt; Connect to server, and provide all the information it asks for.&lt;br /&gt;
&lt;br /&gt;
If the server has been set up correctly to accept public connections, you should be able to join the game.&lt;br /&gt;
&lt;br /&gt;
=== Joining via server list ===&lt;br /&gt;
&lt;br /&gt;
Factorio&#039;s devs keep a list of all public servers that declare themselves to the service, allowing players to join directly through Factorio. Most of these servers will be password-requiring, but many completely public servers can be connected to. To join via server list, go to Play -&amp;gt; Multiplayer -&amp;gt; Browse public games. Provide your Factorio.com login if asked, and a list of public servers will appear. Simply select one.&lt;br /&gt;
&lt;br /&gt;
=== Joining through Steam ===&lt;br /&gt;
&lt;br /&gt;
Steam provides a &amp;quot;game invite&amp;quot; system, simply use that to join. You can find more info about how to use steam in it&#039;s documentation. &#039;&#039;This is the most recommended way for the average player to use multiplayer with their friends, as it allows Steam to handle everything&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Joining a local LAN game ===&lt;br /&gt;
&lt;br /&gt;
If you have some friends on the same internet connection as you (in the same building or network), you may play a LAN game. Simply go to Play -&amp;gt; Multiplayer -&amp;gt; Play on LAN.&lt;br /&gt;
&lt;br /&gt;
=== Connecting to a Server Behind NAT ===&lt;br /&gt;
&lt;br /&gt;
Factorio requires that the server (in client-server mode) have a publicly accessible IP address or that all players are on the same LAN. If you are behind NAT, you must set up port forwarding ([[Multiplayer#Playing_over_LAN_.2F_Internet|see above]] for port number) or use virtual LAN software such as Hamachi or Evolve.&lt;br /&gt;
&lt;br /&gt;
Multiplayer games will be launched in client-server mode (also [http://www.factorio.com/blog/post/fff-99 multiplayer forwarding] mode). In this mode, all clients send their network traffic to the server and the server forwards the traffic to the other clients. The advantage of this is that it allows games where some players are inside a LAN and others are outside. The disadvantage may be slightly more lag as packets must travel an extra hop (through the server).&lt;br /&gt;
&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?f=53&amp;amp;t=6393 Forwarding ports without logging into your router]&lt;br /&gt;
* [https://forums.factorio.com/viewtopic.php?f=53&amp;amp;t=7714 A guide for connecting with Evolve]&lt;br /&gt;
* [http://steamcommunity.com/sharedfiles/filedetails/?id=653628496 A guide for connecting with Hamachi]&lt;br /&gt;
&lt;br /&gt;
== PvP ==&lt;br /&gt;
&lt;br /&gt;
In PvP mode, players can be on different forces. Each force can have one (free-for-all) or more players (teams). Each force has its own independent research progression. Additionally, each force&#039;s [[Military units and structures]] will attack other players as enemies, unless a cease fire is set. Note that, depending on the scenario, cease fires may be unidirectional — setting a cease fire with an opposing force does not guarantee a cease fire from them in return.&lt;br /&gt;
&lt;br /&gt;
To start a PvP game, you can select the &#039;PvP&#039; scenario from the &#039;Play&#039; menu, or download a custom scenario which also supports PvP.&lt;br /&gt;
&lt;br /&gt;
After downloading a PvP scenario, you need to move it to your application directory, and create the multiplayer game using the scenario.&lt;br /&gt;
&lt;br /&gt;
# Download the scenario and place the scenario directory in the &#039;&#039;scenarios&#039;&#039; directory within your [[Application_directory#Directory_locations_by_OS_and_installation_method|user data directory]].&lt;br /&gt;
# Launch Factorio&lt;br /&gt;
# Click &#039;&#039;Play&#039;&#039;&lt;br /&gt;
# Click &#039;&#039;Multiplayer&#039;&#039;&lt;br /&gt;
# Click &#039;&#039;Scenario&#039;&#039;&lt;br /&gt;
# Choose the PvP scenario you want and click &#039;&#039;Create&#039;&#039;&lt;br /&gt;
# Choose latency and other settings, then click &#039;&#039;Play&#039;&#039;&lt;br /&gt;
# Other players can now join the game&lt;br /&gt;
&lt;br /&gt;
=== Forces ===&lt;br /&gt;
&lt;br /&gt;
Forces can be manually created via the console. This allows any map/scenario to be used for PvP. This may not be as convenient as a pre-made PvP scenario, as there will be no way for players to turn on/off cease fires other than through the console.&lt;br /&gt;
&lt;br /&gt;
Each created force has its own research progression and different forces may attack each other.&lt;br /&gt;
&lt;br /&gt;
The console commands for setting up and controlling forces are below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
game.create_force(&amp;quot;Name&amp;quot;)&lt;br /&gt;
--Creates the force &amp;quot;Name&amp;quot;&lt;br /&gt;
&lt;br /&gt;
game.players[&amp;quot;Player_name&amp;quot;].force = game.forces[&amp;quot;Name&amp;quot;]&lt;br /&gt;
--Sets this player to the new force&lt;br /&gt;
&lt;br /&gt;
game.forces[&amp;quot;Name&amp;quot;].set_cease_fire(&amp;quot;Other_force_name&amp;quot;, true)&lt;br /&gt;
--Sets the new force ceasefire to the &amp;quot;other force&amp;quot;&lt;br /&gt;
&lt;br /&gt;
game.forces[&amp;quot;Name&amp;quot;].set_spawn_position({x = 10, y = 20}, game.surfaces[1])&lt;br /&gt;
--Sets the spawn position of the force&lt;br /&gt;
&lt;br /&gt;
game.print(#game.forces)&lt;br /&gt;
--Prints the number of forces&lt;br /&gt;
&lt;br /&gt;
for name, force in pairs (game.forces) do&lt;br /&gt;
   game.print(name)&lt;br /&gt;
end&lt;br /&gt;
--Prints the name of all the forces&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ability of players and entities belonging to one force to interact with structures belonging to another, non-friendly force is limited. However, some types of interactions are still possible:&lt;br /&gt;
&lt;br /&gt;
;Manual pickup from belts&lt;br /&gt;
: Players can pick up items traveling along a transport belt that belongs to an opposing force. Note however that this can&#039;t be automated: Inserters will &#039;&#039;not&#039;&#039; take items from an opposing force&#039;s belts.&lt;br /&gt;
;Belt network connection&lt;br /&gt;
: Belts will connect to each other regardless of force membership, so it&#039;s possible to extend an opposing force&#039;s belt line, and items will flow to them. It is also possible to side-load into, and place items onto (with inserters) an opposing force&#039;s belt line.&lt;br /&gt;
;Fluid network connection&lt;br /&gt;
: Pipes (and storage tanks, and pumps, &amp;amp;c) will connect to each other regardless of force membership. For example, it&#039;s possible to pump fluids out of or into a storage tank belonging to an opposing force.&lt;br /&gt;
;Power leeching&lt;br /&gt;
: Players can draw power from an opposing force&#039;s electric network, by building structures inside the coverage area of a power pole belonging to an opposing force. Power poles that you build next to a power pole belonging to an opposing force will automatically connect to it, but will be impossible to connect or disconnect manually.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
=== Narrative history ===&lt;br /&gt;
&lt;br /&gt;
Because of the potentially immense amount of activity on a map, the game engine utilizes a [https://www.factorio.com/blog/post/fff-76 lock step architecture]. All instances of the game run full simulations of the entire world and only player actions are transferred across the network.&lt;br /&gt;
&lt;br /&gt;
Multiplayer games were introduced to Factorio with version 0.11.0. The only connection method available was peer-to-peer mode which meant every player had to be able to directly communicate with every other player. In version 0.12.4, a client-server mode of communication was introduced in which the server (either a dedicated one or the player who hosted the game) relays messages to all peers. This means that direct connection between all players is no longer necessary. As of version 0.13, P2P connecting is completely removed.&lt;br /&gt;
&lt;br /&gt;
As of version 0.12.0, the game features &amp;quot;latency hiding&amp;quot; mechanics where the game simulates some of the player&#039;s actions locally to make some common interactions (such as moving the player&#039;s character) more fluid.  Not every action is a part of latency hiding – most notably, car or train driving and shooting are not a part of it.&lt;br /&gt;
&lt;br /&gt;
=== Version history ===&lt;br /&gt;
&lt;br /&gt;
Maintainer note: The following history may not be fully up to date, or comprehensive. Factorio&#039;s multiplayer has undergone a great deal of small changes since its inception, however this history will provide a rough overview.&lt;br /&gt;
&lt;br /&gt;
{{history|0.14.14|&lt;br /&gt;
* Added multiplayer server option &amp;quot;Autosave only on server&amp;quot;.&lt;br /&gt;
* Deconstructing/canceling deconstruction sets the &amp;quot;last user&amp;quot; on an entity.&lt;br /&gt;
* Decreased the size of connection accept message with lot of mod which could help some people with 50+ mod multiplayer games.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.14.13|&lt;br /&gt;
* Reconnecting to multiplayer game that the player is already in (due to being dropped, most often) instantly closes the previous connection and connects the player.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.14.11|&lt;br /&gt;
* Multiplayer user names can only consist of letters, and &amp;lt;code&amp;gt; -_. &amp;lt;/code&amp;gt; characters.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.14.10|&lt;br /&gt;
* Disabled 32bit (x86) multiplayer. All hosts and members must be running the 64bit (x86_64) version of the game.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.14.8|&lt;br /&gt;
* More than 10 players in one game will reduce the rate the game is saved to the server.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.14.6|&lt;br /&gt;
* Username is now set to username setting, not email.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.14.5|&lt;br /&gt;
* Added AFK Auto kick interval to multiplayer host settings (with never as default).}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.14.3|&lt;br /&gt;
* When save of scenario is loaded in multiplayer, it&#039;s scenario is saved in user scenarios.&lt;br /&gt;
* Added &amp;lt;code&amp;gt;/time&amp;lt;/code&amp;gt; command to print the current map age.&lt;br /&gt;
* Added option to host multiplayer game with scenario (it only had new game/load game there).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.14.2|&lt;br /&gt;
* Can specify limit of upload speed when hosting.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.14.0|&lt;br /&gt;
* Server doesn&#039;t stop/slow down the game when some client is too slow, stops communicating or saves the game longer than the server.&lt;br /&gt;
* Players automatically quit game after 3 desyncs.&lt;br /&gt;
* Removed the option to enable/disable latency hiding, it is always on on clients (and off on the server).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.13.10|&lt;br /&gt;
* Server stdout messages now contain time stamps and message-type tags}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.13.2|&lt;br /&gt;
* Limit multiplayer player name to 60 characters.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.13.0|&lt;br /&gt;
* Improved Multiplayer game UX&lt;br /&gt;
* Server games are published to the server and clients can browse existing games.&lt;br /&gt;
* Removed multiplayer peer-to-peer mode.&lt;br /&gt;
* Building sound is played also for other players in multiplayer.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.12.31|&lt;br /&gt;
* Human readable error notice when multiplayer connection wasn&#039;t successful. (https://forums.factorio.com/23132)&lt;br /&gt;
* Improved map download speed when connecting to multiplayer game.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.12.30|&lt;br /&gt;
* Mod checksums are calculated when the game starts and are compared with other peers when joining a multiplayer game. This is to ensure everyone has exactly the same mod in order to prevent desyncs caused by local changes made to mod files.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.12.28|&lt;br /&gt;
* Added --port to specify which network port the game should use, when hosting with --start-server or --mp-load-game.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.12.27|&lt;br /&gt;
* The report of different mods when trying to connect to multiplayer game is now scroll-able when needed.&lt;br /&gt;
* Better message when the server leaves a multiplayer game}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.12.11|&lt;br /&gt;
* Added --no-auto-pause: When running as a server, --no-auto-pause will prevent stopping the game when no players are connected.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.12.9|&lt;br /&gt;
* Added resume button to multiplayer game menu}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.12.7|&lt;br /&gt;
*New command line options for the headless server: --disallow-commands and --peer-to-peer}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.12.5|&lt;br /&gt;
* Multiplayer broadcast (heartbeats) is done via a single message when not using peer2peer.&lt;br /&gt;
* Further optimizations in size of the Multiplayer heartbeat (message sent every tick).&lt;br /&gt;
* LatencyState is suspended when player is killed (and waiting for respawn) in Multiplayer.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.12.4|&lt;br /&gt;
* Simple mechanism for multiplayer relaying via the server.&lt;br /&gt;
* Less annoying glitches when running and shooting in multiplayer with latency hiding.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.12.0|&lt;br /&gt;
* Multiplayer latency hiding (gives impression that some common tasks are performed immediately)&lt;br /&gt;
* Factorio can run as a dedicated server without graphics.&lt;br /&gt;
* Basic PvP: New forces can now be created and merged back together; a cease-fire can be agreed upon between forces&lt;br /&gt;
* IPv6 support for multiplayer.&lt;br /&gt;
* DNS names can be used when connecting to multiplayer game.&lt;br /&gt;
* Player&#039;s logistic filters are now remembered after respawn in multiplayer&lt;br /&gt;
* Smaller multiplayer heartbeat packet size.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.11.19|&lt;br /&gt;
* Multiplayer dropping threshold is doubled during map upload / download.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.11.17|&lt;br /&gt;
* Autosaves in multiplayer are performed at the same time by all clients (interval is set by hosting player).&lt;br /&gt;
* Progress bar is shown when non-responsive peers are about to be dropped from the game in the Multiplayer.&lt;br /&gt;
* Progress bar is shown when other peers in multiplayer are saving map.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.11.16|&lt;br /&gt;
* Revived character (after dying in multiplayer) are placed on the spawn point instead of the center of the map.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.11.2|&lt;br /&gt;
*  Mods that don&#039;t affect game state are not needed to be synchronized when playing multiplayer game or replaying game.}}&lt;br /&gt;
&lt;br /&gt;
{{history|0.11.0|&lt;br /&gt;
* Introduced}}&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/IconSpecification&amp;diff=190043</id>
		<title>Types/IconSpecification</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/IconSpecification&amp;diff=190043"/>
		<updated>2022-09-24T02:48:59Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* icon_mipmaps */ description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basics ==&lt;br /&gt;
Specifies the icon of an entity/item/technology/recipe etc. The properties are specified directly in the prototype, not in another sub-property.&lt;br /&gt;
&lt;br /&gt;
Either &amp;lt;code&amp;gt;icons&amp;lt;/code&amp;gt; and optionally &amp;lt;code&amp;gt;icon_size&amp;lt;/code&amp;gt;, or both &amp;lt;code&amp;gt;icon&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;icon_size&amp;lt;/code&amp;gt; have to be specified. If both &amp;lt;code&amp;gt;icons&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;icon&amp;lt;/code&amp;gt; are defined, &amp;lt;code&amp;gt;icon&amp;lt;/code&amp;gt; is ignored.&lt;br /&gt;
== Prototype properties: Option 1 ==&lt;br /&gt;
=== icons ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/table]] of [[Types/IconData]]&lt;br /&gt;
&lt;br /&gt;
The rendering order of the individual icons follows the table (array) order: Later added icons (higher index) get drawn on top of previously added icons (lower index). Can&#039;t be an empty table.&lt;br /&gt;
&lt;br /&gt;
=== icon_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/SpriteSizeType]]&lt;br /&gt;
&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;icon_size&amp;lt;/code&amp;gt; is not specified inside all instances of [[Types/IconData]] inside &amp;lt;code&amp;gt;icons&amp;lt;/code&amp;gt;. The size of the square icon, in pixels, e.g. 32 for a 32px by 32px icon.&lt;br /&gt;
&lt;br /&gt;
=== icon_mipmaps ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint8]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
== Prototype properties: Option 2 ==&lt;br /&gt;
=== icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/FileName]]&lt;br /&gt;
&lt;br /&gt;
Path to the icon file.&lt;br /&gt;
=== icon_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/SpriteSizeType]]&lt;br /&gt;
&lt;br /&gt;
Mandatory. The size of the square icon, in pixels, e.g. 32 for a 32px by 32px icon.&lt;br /&gt;
&lt;br /&gt;
=== icon_mipmaps ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint8]]&lt;br /&gt;
&lt;br /&gt;
Icons of reduced size will be used at decreased scale. 0 or 1 mipmaps is a single image. The file must contain 1/2 size images with a geometric-ratio, for each mipmap level. Each next level is aligned to the upper-left corner. Example sequence: 128x128@(0,0), 64,64@(128,0), 32x32@(196,0) is 3 mipmaps.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
Simple icon with size:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
  icon = &amp;quot;__base__/graphics/icons/fluid/heavy-oil.png&amp;quot;,&lt;br /&gt;
  icon_size = 32,&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Layered icon, size defined outside of layers:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;icon_size = 32,&lt;br /&gt;
icons = {&lt;br /&gt;
  {&lt;br /&gt;
    icon = &amp;quot;__base__/graphics/icons/fluid/barreling/empty-barrel.png&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    icon = &amp;quot;__base__/graphics/icons/fluid/barreling/barrel-side-mask.png&amp;quot;,&lt;br /&gt;
    tint = { a = 0.75,  b = 0, g = 0, r = 0 }&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    icon = &amp;quot;__base__/graphics/icons/fluid/barreling/barrel-hoop-top-mask.png&amp;quot;,&lt;br /&gt;
    tint = { a = 0.75, b = 0.5, g = 0.5, r = 0.5 }&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Layered icon, size defined per layer:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;icons = {&lt;br /&gt;
  {&lt;br /&gt;
    icon = &amp;quot;__base__/graphics/icons/fluid/barreling/barrel-empty.png&amp;quot;,&lt;br /&gt;
    icon_size = 32&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    icon = &amp;quot;__base__/graphics/icons/fluid/barreling/barrel-empty-side-mask.png&amp;quot;,&lt;br /&gt;
    icon_size = 32,&lt;br /&gt;
    tint = { a = 0.75, b = 0, g = 0, r = 0 }&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    icon = &amp;quot;__base__/graphics/icons/fluid/barreling/barrel-empty-top-mask.png&amp;quot;,&lt;br /&gt;
    icon_size = 32,&lt;br /&gt;
    tint = { a = 0.75, b = 0.5, g = 0.5, r = 0.5 }&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    icon = &amp;quot;__base__/graphics/icons/fluid/crude-oil.png&amp;quot;,&lt;br /&gt;
    icon_size = 32,&lt;br /&gt;
    scale = 0.5,&lt;br /&gt;
    shift = {7, 8 }&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Types/IconData&amp;diff=190042</id>
		<title>Types/IconData</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Types/IconData&amp;diff=190042"/>
		<updated>2022-09-24T02:46:18Z</updated>

		<summary type="html">&lt;p&gt;Honktown: /* icon_mipmaps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basics ==&lt;br /&gt;
Data of one icon &amp;quot;layer&amp;quot; for the &amp;lt;code&amp;gt;icons&amp;lt;/code&amp;gt; property of the [[Types/IconSpecification]].&lt;br /&gt;
&lt;br /&gt;
== Mandatory properties ==&lt;br /&gt;
=== icon ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/FileName]]&lt;br /&gt;
&lt;br /&gt;
The path to the icon.&lt;br /&gt;
&lt;br /&gt;
=== icon_size ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/SpriteSizeType]]&lt;br /&gt;
&lt;br /&gt;
Mandatory if &amp;lt;code&amp;gt;icon_size&amp;lt;/code&amp;gt; is not specified outside of &amp;lt;code&amp;gt;icons&amp;lt;/code&amp;gt;. The size of the square icon, in pixels, e.g. 32 for a 32px by 32px icon.&lt;br /&gt;
&lt;br /&gt;
== Optional properties ==&lt;br /&gt;
=== tint ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/Color]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: &amp;lt;nowiki&amp;gt;{r=1, g=1, b=1, a=1} (white)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tint of the icon.&lt;br /&gt;
&lt;br /&gt;
=== shift ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/vector]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: {0, 0}&lt;br /&gt;
&lt;br /&gt;
Used to offset the icon &amp;quot;layer&amp;quot; from the overall icon.&amp;lt;br&amp;gt;&lt;br /&gt;
The shift is applied from the center (so negative shifts are left and up, respectively). Shift uses the unit &amp;quot;pixels after scaling&amp;quot;, see [[#Notes]].&lt;br /&gt;
&lt;br /&gt;
=== scale ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/double]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default for items/recipes&#039;&#039;&#039;: (32/icon_size)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default for technologies&#039;&#039;&#039;: (256/icon_size)&lt;br /&gt;
&lt;br /&gt;
When set, specifies the scale of the icon on the GUI scale.&amp;lt;br&amp;gt;&lt;br /&gt;
Scale 2 means that the icon will be 2 times bigger on screen (and more pixelated).&lt;br /&gt;
&lt;br /&gt;
=== icon_mipmaps ===&lt;br /&gt;
&#039;&#039;&#039;Type&#039;&#039;&#039;: [[Types/uint8]]&lt;br /&gt;
&lt;br /&gt;
Icons of reduced size will be used at decreased scale. 0 or 1 mipmaps is a single image. The file must contain 1/2 size images with a geometric-ratio, for each mipmap level. Each next level is aligned to the upper-left corner. Example sequence: 128x128@(0,0), 64,64@(128,0), 32x32@(196,0) is 3 mipmaps.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default&#039;&#039;&#039;: 0&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&lt;br /&gt;
* Only the first icon layer will display a shadow.&lt;br /&gt;
* The final combination of icons will always be resized in GUI based on the first icon layer&#039;s size, but won&#039;t be resized when displayed on machines in alt-mode.&lt;br /&gt;
: (example: recipe first icon layer is size 128, scale 1, the icon group will be displayed at resolution /4 to fit the 32px GUI boxes, but will be displayed 4 times as large on buildings)&lt;br /&gt;
* Shift values are based on final size (icon_size * scale) of the first icon.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;{&lt;br /&gt;
  icon = &amp;quot;__base__/graphics/icons/fluid/heavy-oil.png&amp;quot;,&lt;br /&gt;
  icon_size = 64,&lt;br /&gt;
  scale = 0.5,&lt;br /&gt;
  shift = {4, -8}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Honktown</name></author>
	</entry>
</feed>