https://wiki.factorio.com/api.php?action=feedcontributions&user=Klonan&feedformat=atomOfficial Factorio Wiki - User contributions [en]2024-03-29T12:43:18ZUser contributionsMediaWiki 1.38.2https://wiki.factorio.com/index.php?title=Prototype/Lab&diff=173231Prototype/Lab2019-05-13T07:52:21Z<p>Klonan: Typo</p>
<hr />
<div>== Basics ==<br />
Prototype type: '''lab'''<br />
<br />
A [[lab]]. Based on [[Prototype/EntityWithHealth]].<br />
<br />
== Mandatory properties ==<br />
This prototype inherits all the properties from [[Prototype/EntityWithHealth]].<br />
<br />
=== energy_usage ===<br />
'''Type''': [[Types/Energy]]<br />
<br />
The amount of energy this lab uses.<br />
<br />
=== energy_source ===<br />
'''Type''': [[Types/EnergySource]]<br />
<br />
Defines how this lab gets energy.<br />
<br />
=== on_animation ===<br />
'''Type''': [[Types/Animation]]<br />
<br />
The animation that plays when the lab is active.<br />
<br />
=== off_animation ===<br />
'''Type''': [[Types/Animation]]<br />
<br />
The animation that plays when the lab is idle.<br />
<br />
=== inputs ===<br />
'''Type''': [[Types/table]] of [[Types/string]]<br />
<br />
A list of the names of science packs that cane be used in this lab.<br />
<br />
e.g. for the default lab, this is:<br />
<syntaxhighlight lang="lua"><br />
inputs = {"automation-science-pack", "logistic-science-pack", "chemical-science-pack", "military-science-pack", "production-science-pack", "utility-science-pack", "space-science-pack"}</syntaxhighlight><br />
<br />
If a technology requires other types of science packs, it cannot be researched in this lab.<br />
<br />
== Optional properties ==<br />
<br />
=== researching_speed ===<br />
'''Type''': [[Types/double]]<br />
<br />
'''Default''': 1<br />
<br />
=== light ===<br />
'''Type''': [[Types/LightDefinition]]<br />
<br />
<br />
=== module_specification ===<br />
'''Type''': [[Types/ModuleSpecification]]<br />
<br />
The number of module slots.</div>Klonanhttps://wiki.factorio.com/index.php?title=Prototype/Unit&diff=164945Prototype/Unit2018-10-20T12:44:39Z<p>Klonan: Note on vision distance greater than 50.</p>
<hr />
<div>==Basics==<br />
Entity that attacks player based on pollution value. Extends the [[Prototype/EntityWithHealth]]<br />
<br />
== Usage in base==<br />
*[[Enemies|biters/spitters]]<br />
== Mandatory properties ==<br />
This prototype inherits all the properties from [[Prototype/EntityWithHealth]].<br />
<br />
=== run_animation ===<br />
'''Type''': [[Types/RotatedAnimation]]<br />
<br />
=== attack_parameters ===<br />
'''Type''': [[Types/AttackParameters]]<br />
<br />
Requires animation in attack_parameters. Requires ammo_type in attack_parameters.<br />
<br />
=== movement_speed ===<br />
'''Type''': [[Types/float]]<br />
<br />
=== distance_per_frame ===<br />
'''Type''': [[Types/float]]<br />
<br />
=== pollution_to_join_attack ===<br />
'''Type''': [[Types/float]]<br />
<br />
Pollution level required before entity will leave it's spawner and attack the source of the pollution.<br />
<br />
=== distraction_cooldown ===<br />
'''Type''': [[Types/uint32]]<br />
<br />
=== vision_distance ===<br />
'''Type''': [[Types/double]]<br />
<br />
Max is 100.<br />
<br />
Note: Setting to 50 or above can lead to undocumented behavior of individual units creating groups on their own when attacking or being attacked.<br />
<br />
== Optional properties ==<br />
<br />
=== dying_sound ===<br />
'''Type''': [[Types/Sound]]<br />
<br />
The sound file to play when entity dies.<br />
<br />
=== min_persue_time ===<br />
'''Type''': [[Types/uint32]]<br />
<br />
'''Default''': 10 * 60<br />
<br />
=== has_belt_immunity ===<br />
'''Type''': [[Types/bool]]<br />
<br />
'''Default''': false<br />
<br />
If the unit is immune to movement by belts.<br />
<br />
=== spawning_time_modifier ===<br />
'''Type''': [[Types/double]]<br />
<br />
'''Default''': 1<br />
<br />
=== max_pursue_distance ===<br />
'''Type''': [[Types/double]]<br />
<br />
'''Default''': 50</div>Klonanhttps://wiki.factorio.com/index.php?title=Scenario_system&diff=164844Scenario system2018-10-13T17:51:24Z<p>Klonan: /* Playing a scenario */</p>
<hr />
<div>{{Languages}}<br />
<br />
The scenario system allows save-based mods to be created, so that installing mods separately is not necessary. This allows for server side scripting, or to provide a separate objective than the vanilla freeplay (which is actually a scenario, just like the [[campaign]]).<br />
<br />
== Creation ==<br />
<br />
Creation of a scenario starts in the world editor. The world editor allows an author to save a world that they have created as a scenario. This allows players to add special scripting to the scenario.<br />
<br />
There are two ways to create a scenario:<br />
<br />
* Via the [[Map editor]].<br />
* Creating a new folder in the scenarios folder, and adding a control.lua.<br />
<br />
== Differences between scenarios, saves, and mods ==<br />
<br />
There are a few differences between a scenario, a save, and a mod. In a way, a scenario takes parts from both.<br />
<br />
* Scenarios, unlike mods, cannot add anything to the game. The only type of scripting allowed in a scenario is scripting that would occur in control.lua.<br />
* Scenarios can have premade maps, such as the supply scenario, or can have maps made with the world generator, such as freeplay.<br />
* Scenarios do not need to be installed client side, unlike mods. This allows servers to implement small changes to gameplay on their end, such as displaying a MOTD to joining players.<br />
* Scenarios, unlike normal saves, are stored in a different folder.<br />
* Scenarios can be used to create a bit of a story, as the campaign does.<br />
<br />
== Limitations of Scenarios ==<br />
<br />
* Scenarios must be packaged into a mod to be distributed on the mod portal.<br />
* Scenarios cannot add anything to the game (Namely, they may not make calls to data:extend()).<br />
* Scenarios count as mods for the purpose of isolating [[achievements]].<br />
<br />
== Playing a scenario ==<br />
<br />
There are several scenarios included into the game by default. To play a scenario, click Play->Scenarios, and choose either a user scenario, or a scenario from the base game or mod. The Freeplay scenario is the same as the basic game, where the objective is to launch a rocket.<br />
<br />
Upon choosing a scenario to play and saving the game, a normal save will be created that encompasses the map itself, and the control.Lua scripting that was provided by the scenario. This can be removed by deleting the script.dat and control.Lua files from the save, turning it into a normal save. Do this at your own risk, as it may break the save depending on how intertwined the scenario is with the save.<br />
<br />
== Installing scenarios ==<br />
<br />
Scenarios made by other players can be installed into a folder called scenarios in the player's [[application directory#User_data_directory|user data directory]]. It can then be played from the scenarios menu.<br />
<br />
Scenarios added by mods are also shown in the Scenarios menu.<br />
<br />
== See also ==<br />
<br />
* [[Campaign]]<br />
* [[Map editor]]<br />
* [[World generator]]</div>Klonanhttps://wiki.factorio.com/index.php?title=Scenario_system&diff=164843Scenario system2018-10-13T17:50:00Z<p>Klonan: /* Installing scenarios */</p>
<hr />
<div>{{Languages}}<br />
<br />
The scenario system allows save-based mods to be created, so that installing mods separately is not necessary. This allows for server side scripting, or to provide a separate objective than the vanilla freeplay (which is actually a scenario, just like the [[campaign]]).<br />
<br />
== Creation ==<br />
<br />
Creation of a scenario starts in the world editor. The world editor allows an author to save a world that they have created as a scenario. This allows players to add special scripting to the scenario.<br />
<br />
There are two ways to create a scenario:<br />
<br />
* Via the [[Map editor]].<br />
* Creating a new folder in the scenarios folder, and adding a control.lua.<br />
<br />
== Differences between scenarios, saves, and mods ==<br />
<br />
There are a few differences between a scenario, a save, and a mod. In a way, a scenario takes parts from both.<br />
<br />
* Scenarios, unlike mods, cannot add anything to the game. The only type of scripting allowed in a scenario is scripting that would occur in control.lua.<br />
* Scenarios can have premade maps, such as the supply scenario, or can have maps made with the world generator, such as freeplay.<br />
* Scenarios do not need to be installed client side, unlike mods. This allows servers to implement small changes to gameplay on their end, such as displaying a MOTD to joining players.<br />
* Scenarios, unlike normal saves, are stored in a different folder.<br />
* Scenarios can be used to create a bit of a story, as the campaign does.<br />
<br />
== Limitations of Scenarios ==<br />
<br />
* Scenarios must be packaged into a mod to be distributed on the mod portal.<br />
* Scenarios cannot add anything to the game (Namely, they may not make calls to data:extend()).<br />
* Scenarios count as mods for the purpose of isolating [[achievements]].<br />
<br />
== Playing a scenario ==<br />
<br />
There are several scenarios included into the game by default. To play a scenario, click Play->Scenarios, and choose either a user scenario, or a scenario from the base game. The Freeplay scenario is the same as the basic game, where the objective is to launch a rocket.<br />
<br />
Upon choosing a scenario to play and saving the game, a normal save will be created that encompasses the map itself, and the control.Lua scripting that was provided by the scenario. This can be removed by deleting the script.dat and control.Lua files from the save, turning it into a normal save. Do this at your own risk, as it may break the save depending on how intertwined the scenario is with the save.<br />
<br />
== Installing scenarios ==<br />
<br />
Scenarios made by other players can be installed into a folder called scenarios in the player's [[application directory#User_data_directory|user data directory]]. It can then be played from the scenarios menu.<br />
<br />
Scenarios added by mods are also shown in the Scenarios menu.<br />
<br />
== See also ==<br />
<br />
* [[Campaign]]<br />
* [[Map editor]]<br />
* [[World generator]]</div>Klonanhttps://wiki.factorio.com/index.php?title=Scenario_system&diff=164842Scenario system2018-10-13T17:49:15Z<p>Klonan: /* Creation */</p>
<hr />
<div>{{Languages}}<br />
<br />
The scenario system allows save-based mods to be created, so that installing mods separately is not necessary. This allows for server side scripting, or to provide a separate objective than the vanilla freeplay (which is actually a scenario, just like the [[campaign]]).<br />
<br />
== Creation ==<br />
<br />
Creation of a scenario starts in the world editor. The world editor allows an author to save a world that they have created as a scenario. This allows players to add special scripting to the scenario.<br />
<br />
There are two ways to create a scenario:<br />
<br />
* Via the [[Map editor]].<br />
* Creating a new folder in the scenarios folder, and adding a control.lua.<br />
<br />
== Differences between scenarios, saves, and mods ==<br />
<br />
There are a few differences between a scenario, a save, and a mod. In a way, a scenario takes parts from both.<br />
<br />
* Scenarios, unlike mods, cannot add anything to the game. The only type of scripting allowed in a scenario is scripting that would occur in control.lua.<br />
* Scenarios can have premade maps, such as the supply scenario, or can have maps made with the world generator, such as freeplay.<br />
* Scenarios do not need to be installed client side, unlike mods. This allows servers to implement small changes to gameplay on their end, such as displaying a MOTD to joining players.<br />
* Scenarios, unlike normal saves, are stored in a different folder.<br />
* Scenarios can be used to create a bit of a story, as the campaign does.<br />
<br />
== Limitations of Scenarios ==<br />
<br />
* Scenarios must be packaged into a mod to be distributed on the mod portal.<br />
* Scenarios cannot add anything to the game (Namely, they may not make calls to data:extend()).<br />
* Scenarios count as mods for the purpose of isolating [[achievements]].<br />
<br />
== Playing a scenario ==<br />
<br />
There are several scenarios included into the game by default. To play a scenario, click Play->Scenarios, and choose either a user scenario, or a scenario from the base game. The Freeplay scenario is the same as the basic game, where the objective is to launch a rocket.<br />
<br />
Upon choosing a scenario to play and saving the game, a normal save will be created that encompasses the map itself, and the control.Lua scripting that was provided by the scenario. This can be removed by deleting the script.dat and control.Lua files from the save, turning it into a normal save. Do this at your own risk, as it may break the save depending on how intertwined the scenario is with the save.<br />
<br />
== Installing scenarios ==<br />
<br />
Scenarios made by other players can be installed into a folder called scenarios in the player's [[application directory#User_data_directory|user data directory]]. It can then be played from the scenarios menu.<br />
<br />
== See also ==<br />
<br />
* [[Campaign]]<br />
* [[Map editor]]<br />
* [[World generator]]</div>Klonanhttps://wiki.factorio.com/index.php?title=Scenario_system&diff=164839Scenario system2018-10-13T17:47:09Z<p>Klonan: /* Limitations of Scenarios */</p>
<hr />
<div>{{Languages}}<br />
<br />
The scenario system allows save-based mods to be created, so that installing mods separately is not necessary. This allows for server side scripting, or to provide a separate objective than the vanilla freeplay (which is actually a scenario, just like the [[campaign]]).<br />
<br />
== Creation ==<br />
<br />
Creation of a scenario starts in the world editor. The world editor allows an author to save a world that they have created as a scenario. This allows players to add special scripting to the scenario.<br />
<br />
There are two ways to create a scenario:<br />
<br />
* Running Factorio with the --map2scenario [[Console#Command_Line_Parameters|runtime flag]], which allows specifying a save to transform into a scenario. It is possible to turn a scenario back into a normal save with the --scenario2map runtime flag.<br />
* Via the [[Map editor]].<br />
<br />
== Differences between scenarios, saves, and mods ==<br />
<br />
There are a few differences between a scenario, a save, and a mod. In a way, a scenario takes parts from both.<br />
<br />
* Scenarios, unlike mods, cannot add anything to the game. The only type of scripting allowed in a scenario is scripting that would occur in control.lua.<br />
* Scenarios can have premade maps, such as the supply scenario, or can have maps made with the world generator, such as freeplay.<br />
* Scenarios do not need to be installed client side, unlike mods. This allows servers to implement small changes to gameplay on their end, such as displaying a MOTD to joining players.<br />
* Scenarios, unlike normal saves, are stored in a different folder.<br />
* Scenarios can be used to create a bit of a story, as the campaign does.<br />
<br />
== Limitations of Scenarios ==<br />
<br />
* Scenarios must be packaged into a mod to be distributed on the mod portal.<br />
* Scenarios cannot add anything to the game (Namely, they may not make calls to data:extend()).<br />
* Scenarios count as mods for the purpose of isolating [[achievements]].<br />
<br />
== Playing a scenario ==<br />
<br />
There are several scenarios included into the game by default. To play a scenario, click Play->Scenarios, and choose either a user scenario, or a scenario from the base game. The Freeplay scenario is the same as the basic game, where the objective is to launch a rocket.<br />
<br />
Upon choosing a scenario to play and saving the game, a normal save will be created that encompasses the map itself, and the control.Lua scripting that was provided by the scenario. This can be removed by deleting the script.dat and control.Lua files from the save, turning it into a normal save. Do this at your own risk, as it may break the save depending on how intertwined the scenario is with the save.<br />
<br />
== Installing scenarios ==<br />
<br />
Scenarios made by other players can be installed into a folder called scenarios in the player's [[application directory#User_data_directory|user data directory]]. It can then be played from the scenarios menu.<br />
<br />
== See also ==<br />
<br />
* [[Campaign]]<br />
* [[Map editor]]<br />
* [[World generator]]</div>Klonanhttps://wiki.factorio.com/index.php?title=Scenario_system&diff=164838Scenario system2018-10-13T17:46:29Z<p>Klonan: Just making things more up to date</p>
<hr />
<div>{{Languages}}<br />
<br />
The scenario system allows save-based mods to be created, so that installing mods separately is not necessary. This allows for server side scripting, or to provide a separate objective than the vanilla freeplay (which is actually a scenario, just like the [[campaign]]).<br />
<br />
== Creation ==<br />
<br />
Creation of a scenario starts in the world editor. The world editor allows an author to save a world that they have created as a scenario. This allows players to add special scripting to the scenario.<br />
<br />
There are two ways to create a scenario:<br />
<br />
* Running Factorio with the --map2scenario [[Console#Command_Line_Parameters|runtime flag]], which allows specifying a save to transform into a scenario. It is possible to turn a scenario back into a normal save with the --scenario2map runtime flag.<br />
* Via the [[Map editor]].<br />
<br />
== Differences between scenarios, saves, and mods ==<br />
<br />
There are a few differences between a scenario, a save, and a mod. In a way, a scenario takes parts from both.<br />
<br />
* Scenarios, unlike mods, cannot add anything to the game. The only type of scripting allowed in a scenario is scripting that would occur in control.lua.<br />
* Scenarios can have premade maps, such as the supply scenario, or can have maps made with the world generator, such as freeplay.<br />
* Scenarios do not need to be installed client side, unlike mods. This allows servers to implement small changes to gameplay on their end, such as displaying a MOTD to joining players.<br />
* Scenarios, unlike normal saves, are stored in a different folder.<br />
* Scenarios can be used to create a bit of a story, as the campaign does.<br />
<br />
== Limitations of Scenarios ==<br />
<br />
* Currently, scenarios cannot be uploaded to the official mod portal, they must be shared on other community websites.<br />
* Scenarios cannot add anything to the game (Namely, they may not make calls to data:extend()).<br />
* Scenarios count as mods for the purpose of isolating [[achievements]].<br />
<br />
== Playing a scenario ==<br />
<br />
There are several scenarios included into the game by default. To play a scenario, click Play->Scenarios, and choose either a user scenario, or a scenario from the base game. The Freeplay scenario is the same as the basic game, where the objective is to launch a rocket.<br />
<br />
Upon choosing a scenario to play and saving the game, a normal save will be created that encompasses the map itself, and the control.Lua scripting that was provided by the scenario. This can be removed by deleting the script.dat and control.Lua files from the save, turning it into a normal save. Do this at your own risk, as it may break the save depending on how intertwined the scenario is with the save.<br />
<br />
== Installing scenarios ==<br />
<br />
Scenarios made by other players can be installed into a folder called scenarios in the player's [[application directory#User_data_directory|user data directory]]. It can then be played from the scenarios menu.<br />
<br />
== See also ==<br />
<br />
* [[Campaign]]<br />
* [[Map editor]]<br />
* [[World generator]]</div>Klonanhttps://wiki.factorio.com/index.php?title=Fuel&diff=163713Fuel2018-08-20T10:24:02Z<p>Klonan: </p>
<hr />
<div>{{Languages}}<br />
'''Fuel''' can be inserted into [[burner devices]] and burned to power them. Different types of fuel provide different amounts of energy, measured in megajoules (MJ).<br />
<br />
== Types ==<br />
<br />
This is a list of all items usable as fuel in burner devices, ordered by fuel value:<br />
{| class="wikitable"<br />
! Item !! Fuel value !! Fuel value per raw total !! Fuel value<br>per stack !! Vehicle<br>acceleration !! Vehicle<br>speed !! Train max speed<br />
|-<br />
| {{imagelink|Wood}} || 2 MJ || 4 MJ per raw wood || 100 MJ || 100% || 100% || 259.2 km/h<br />
|-<br />
| {{imagelink|Raw wood}} || 4 MJ || 4 MJ per raw wood || 400 MJ || 100% || 100% || 259.2 km/h<br />
|-<br />
| {{imagelink|Small electric pole}} || 4 MJ || 8 MJ per raw wood || 200 MJ || 100% || 100% || 259.2 km/h<br />
|-<br />
| {{imagelink|Wooden chest}} || 4 MJ || 2 MJ per raw wood || 200 MJ || 100% || 100% || 259.2 km/h<br />
|-<br />
| {{imagelink|Coal}} || 8 MJ || 8 MJ per coal || 400 MJ || 100% || 100% || 259.2 km/h<br />
|-<br />
| {{imagelink|Solid fuel}} || 25 MJ || 2 MJ per unit of [[crude oil]]<sup>1</sup> || 1.25 GJ || 120% || 105% || 272.2 km/h<br />
|-<br />
| {{imagelink|Rocket fuel}} || 225 MJ || 1.8 MJ per unit of [[crude oil]]<sup>1</sup> || 2.25 GJ || 180% || 115% || 298.1 km/h<br />
|-<br />
| {{imagelink|Nuclear fuel}} || 1.21 GJ || 9.68 MJ per unit of [[crude oil]]<sup>1</sup><br/>1.21 GJ per [[Uranium-235]] || 1.21 GJ || 250% || 115% || 298.1 km/h<br />
|-<br />
| {{imagelink|Uranium fuel cell}} || 8 GJ<sup>2</sup> || 507 MJ per [[uranium ore]]<sup>3</sup> || 400 GJ || Unusable || Unusable || Unusable<br />
|}<br />
<br />
(1) This assumes the crude oil is processed completely into solid fuel using [[advanced oil processing]] and [[heavy oil cracking]] as intermediate steps, but not [[light oil cracking]]. More efficient methods are possible. In practice, the [[petroleum gas]] is more likely to be used for something other than solid fuel.<br />
<br />
(2) This fuel type can only be used in a [[nuclear reactor]]. Unlike other fuel types, it cannot be placed into standard burners.<br />
<br />
(3) Assuming that all U-238 is enriched, all used up cells are reprocessed, and there is no reactor neighbor bonus.<br />
<br />
== Consumption ==<br />
<br />
The following formula can be used to find how long a fuel will last in a device:<br />
<code>Burn time (s) = Fuel value (MJ) ÷ Energy consumption (MW)</code><br />
<br />
== History ==<br />
<br />
{{history|0.15.0|<br />
* Fuel type affects vehicle acceleration and top speed.}}<br />
<br />
== See also ==<br />
* [[Burner devices]]<br />
** {{Imagelink|Burner inserter}} {{Imagelink|Burner mining drill}} {{Imagelink|Boiler}} {{Imagelink|Stone furnace}} {{Imagelink|Steel furnace}} {{Imagelink|Locomotive}} {{Imagelink|Car}} {{Imagelink|Tank}} <br />
* [[Electric system]]<br />
* [https://www.reddit.com/r/factorio/comments/67xgge/nuclear_ratios/ Nuclear Ratios]</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Klonan/Designs&diff=159261User:Klonan/Designs2018-05-15T21:06:39Z<p>Klonan: </p>
<hr />
<div>The following is a page of personal designs and blueprints I want to preserve more effectively.<br />
I have a problem in that when I change builds and branches and go from dev build to normal, all my blueprint libraries die.<br />
<br />
<br />
== Smelting ==<br />
<br />
=== Simple setup with burner inserters ===<br />
<br />
[https://i.imgur.com/gm5FMmF.png Image]<br />
<br />
This uses burner inserters to insert the coal and iron on one side, and normal inserters to take the plates out the other side.<br />
<br />
If coal runs low, the burner inserters can run out of fuel while picking up ore, leading to the whole system stalling and requiring manual fixing.<br />
<br />
{{BlueprintString|bp-string=0eNqVl+tugyAYhu+F39oIiqdbWZZFLVtILBrEZU3jvQ/r1nar4ssv4+F7eFA+83IhdTuKXktlSHkhsunUQMqXCxnkh6ra+Zo594KURBpxIgFR1Wk+M7pSQ99pE9aiNWQKiFRH8UVKOgW7xYPplAjfR62qRjzUsuk1IEIZaaRYLK4n5zc1nmqhLfyGGG2F/tCdPS4GAem7wRZ2ah7WwkIekLM9xJZ/lFo0yz0W/Dp1o+nHWf1pGLY1zedB4vVBVqAxDk1gaIJDKQzlOJTB0BSG4qIZzIxgZg4z8U9fwEz8fdIIhnIcSmEovkYp22j8lW46/LhGBz6toe5NVFuI0KFUg9DG3ttsTbYKSmAnuufEPZyoyylFnaI9pQxXchrlqBHbMypwI9d3YxFqlOwYMYobcZfRfXXvrkW6Criv6eFUtW0oWttNWjZh37Vi85+7zkoQGeoAcADgqk/9JuOaSwaouN5rDtRzR33hN5V0GxVH/rmF/f2xprfYItVGaompb2z5P8YalPnGFgQa+8YWBJr4xhYEyj1jC8JMPWMLwsw8YwvCzD1jC8IsPFMLwEwiz9DyxLS7jusGpXzYDAXkU+hheSDPGC0iytN8mr4B71Nf/Q== }}<br />
<br />
{| class="wikitable"<br />
|-<br />
! Advantages !! Disadvantages<br />
|-<br />
| Input works without electricity || Input can stall on low coal input<br />
|-<br />
| Only requires one side of electric poles || Only outputs to 1 side<br />
|-<br />
| || Only uses half the belt for ore<br />
|-<br />
|}<br />
<br />
=== The classsic JGGames / Arumba one, with the 2 splitters ===<br />
<br />
{{BlueprintString|bp-string=0eNqdm9tu20gMht9F13Ix54NfpSgKJ1ELAY5syPJigyDvXnm9dd2WtP5fV3Gc+BPJITlDcvzePO3P3XHsh6nZvjf982E4NdvP782p/z7s9pf3prdj12ybfupem7YZdq+X36ZxN5yOh3HaPHX7qflom3546f5ttvajXfzwaeq6/ebbeRx2z93dZ93Hl7bphqmf+u4qxX+/vH0dzq9P3TjDFUTbHA+n+VOH4fLMmbRxn2LbvM0v7Pzq4yLTHyiHohZJXjPK31LdSBIn3Dj9cOrGaX7vb0K4EdrmpR+75+sfk8CLDM8u8xKvp5X0zCsW0cimL4iKFjdZhVU0MjQIUGsYKYGFsJYW0wJiOkBMxZZO4nmCZwFe4CNWcRuLhEYgREsEDzFdhhf4YUaxheaIEWt/xcXpdbffb7r9LP7YP2+Oh333IKsYMfMaOpFUkWP5hCQL5PiMVJRdxbOhWZcj0wU63g1AjeSi2oc2THR0aibMnFyPfY2PAJlTWY7osp53/SJyeNfPIscRZ4SyvDN5T/AywAt8ZCbllBbZICrLMeQTsbUj9ssED7FfYZXOgNIV39jL8mYXDI7LAM7SiUjxmODwXR3R0+M4RM/AZiQxk4TIYsREEtK6E4Js+ExntyRyCs2R5al8FgqyT0XDBmRcDshI1wMJgLp1xwNZbU8HpWbAsOp0ILNo35cxicWI3hp5rw8ipxB7sAfaCJXgBaCNwJ+BvKRnWtEMUjo4yRHbLqKiJ3jAEiS6APDLAZ7oA1EAoHwZoK1Jxo8Ffnm7TAXHBQBX8c0cwGWD4wBls2UzkphJsmMxYqDmFQ1SkRNojtgVyZFPHEojKSe6Ml+OoZxZKNCEzIUOTE1nuhQWV6EYujIXMXQlLGMcixHbBIWof4FGbyFGAgbA8Y5vlb47UfcigrEeD0RRIWYDyFKwowGgA1fxytcsJ/1qYRrQ0q70fExxlYqXvYhYAaYhJmMLADF3VPb8L6aOmldV0GJurXThK2MqixH3f2sMnXe8MrgxbKnrkfnculJXHrkYdgIATRDp2ZdqwLimflZUZR1fwbDTLsXLaKdXLETUuxEZ1hqcFxAefeIRD/fW8lOvqDiVJepdyGRsvQtUptay9W5EoMRBCFrczAa6uiZ4wQsUqNbiTf8I4Bxe8CLSOQvjIOnYwldeAmIY/ChQHV33JpkTWU6WOet6/QqMvw2UFY+/m/Uy27giF3veBwZn1rPd/4RA6YGXZkDv1pwNZPt51vdln/XslEuRhrgLV4E0jc19r7yC8Ojef5H1pM9AVebwE6+qOFUgbr8hpgoW5yFLGRwZk8C1AHs36z0PL934fTzMPx9i/7wH1N6uzg7H8+WCrfCUAO/JFblfF2FcQXD0KEB1oQzv7pCeBcZBerL9UDl0I9sPlSM38v1Q+cpfpDui8s0pG5lY2LifMv1u+Fs0HM6TFg73o+Hjvp8edvwuze3ltY1szWANQk10dtANoqeHu4Gybg/7KYoPENNaxLcXK5pDplbCHH69f9wNnpefE1abPbHDNyUAE1uEKPGXiPHb/1oDN+VtoqsS5Y4yMYfeeEI+4usKjsDSowqISpzbLIGtfKLx2jnkQWTdja+BTCO374iZtbxc8kV6x2YsxK7ERDsQsuIR5QkqPeOYw/RLe/3G1vbu22Ft8083nq5GKdm5ObHky//+AJni3Dk= }}<br />
<br />
=== Steel smelting ===<br />
<br />
{{BlueprintString|bp-string=0eNqdWllu2zAUvIu+rYCkuPoqRVHYDpsKUCRDkosGge9eOYvjNqPojb4Sx854SM28hY/Pxb455WNft2OxfS7qQ9cOxfbbczHUD+2uufxtfDrmYlvUY34sNkW7e7y8GvtdOxy7fiz3uRmL86ao2/v8p9jq8/dNkduxHuv8ivTy4ulHe3rc5376wBVjGLs2lz9Pfbs75An62A3Tf3Xt5UsnpFLduU3xNP2iqzt3Pm8+QZkr1H4CyX1Zt0Pux+mtT2D6DclOTO/rPh9e3zMAtZpb5CdQcwUFMFYMU30F48Qw5TuO+XeNFqB6HrVaRg1X1PkHURqMh55E/JDK465pytxMn+7rQ3nsGiQYfd0AAJYE5JR8B7WiZVIhWlrTOHB52tB6w3wqGgfzsbzElGDbV/hBC2D9iqikcFTSHzZouvah/LWbIuO9IDbpZUfoyIc8JYBNtAg1DMi8KRTE0bQIMR/eFJhPRasuLovO8BZJAlRHROG4rA2zwhpxJl8HWr1JQDCyokuQHO2BiGAqxUoOsqloB2A2hpaYX5ZYxdshCFDtunQf4MKdPN1LuK0wgcMmqFamBy+oXGkn4L2jneBhAUw7AbKxtBMwG94JdlkXlneCE6BaXm0zLZJ1dMgVtEjW06hOgBpY3eEl0y7A/VtidQfZONoFuA3UtNAETYzjTSFoA11FVCCCNtCtTAywL3FEYpDsoGfFBrsuR0sfLy6yYsNsaOlDNl6x6hI0gJ43gqD/84aPuDPtn69Wtn/LRvCWDbuC3s87umeDy2aNABstH+iGDcKwPsBkEis1QcAItCkE8g1aHnHNsiQC7waNzRAqVrECGwRLSg1qJLC6hzEueFJpmAsre8wlstISVLiBNoGgQohqVUaHySpqcUKXMOOlb7H047o8IKi+I6t/vG+s/mFdGln9Yy6s/jEXWv+Cs45I61/Q4CVFq8xjlSXNBlhBI5YMKQ1MjR2kwb490TWP4KAkOVJveIGs9vECAyswwdFyoq0gOARLSV5lBMHQQa3LAvCgUyt5GoiS6R5rgYBZsR6YWRw7TJ5hw8p+hg09PRZN9hRthCRBjXSoTTNzPcWeiyY88FWrCgPBJERrOhuIpoM3s+XTxLV/6Lvp59cl9wX37eZIdxqPp8sdEYDMTptntpT1Bx7zaX66LBoua94wkhsIN4NmUfzU74whGHtqKhpX04PlucsN7CnqzCpvBsvDsalH6IzqvaeVPARixPyWGiU3XzQ/cZbByo2iCFTCNpqA9UTYmcG9BqG6nYtBN1NpcXSzZwkwbSl8I8ewx7H/74K/3Ml7ub+3vbnutyl+5354/UAMxphkQ5waq7/DBkUd= }}</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Klonan/Designs&diff=158898User:Klonan/Designs2018-05-05T17:59:39Z<p>Klonan: /* Simple setup with burner inserters */</p>
<hr />
<div>The following is a page of personal designs and blueprints I want to preserve more effectively.<br />
I have a problem in that when I change builds and branches and go from dev build to normal, all my blueprint libraries die.<br />
<br />
<br />
== Smelting ==<br />
<br />
=== Simple setup with burner inserters ===<br />
<br />
[https://i.imgur.com/gm5FMmF.png Image]<br />
<br />
This uses burner inserters to insert the coal and iron on one side, and normal inserters to take the plates out the other side.<br />
<br />
If coal runs low, the burner inserters can run out of fuel while picking up ore, leading to the whole system stalling and requiring manual fixing.<br />
<br />
{{BlueprintString|bp-string=0eNqVl+tugyAYhu+F39oIiqdbWZZFLVtILBrEZU3jvQ/r1nar4ssv4+F7eFA+83IhdTuKXktlSHkhsunUQMqXCxnkh6ra+Zo594KURBpxIgFR1Wk+M7pSQ99pE9aiNWQKiFRH8UVKOgW7xYPplAjfR62qRjzUsuk1IEIZaaRYLK4n5zc1nmqhLfyGGG2F/tCdPS4GAem7wRZ2ah7WwkIekLM9xJZ/lFo0yz0W/Dp1o+nHWf1pGLY1zedB4vVBVqAxDk1gaIJDKQzlOJTB0BSG4qIZzIxgZg4z8U9fwEz8fdIIhnIcSmEovkYp22j8lW46/LhGBz6toe5NVFuI0KFUg9DG3ttsTbYKSmAnuufEPZyoyylFnaI9pQxXchrlqBHbMypwI9d3YxFqlOwYMYobcZfRfXXvrkW6Criv6eFUtW0oWttNWjZh37Vi85+7zkoQGeoAcADgqk/9JuOaSwaouN5rDtRzR33hN5V0GxVH/rmF/f2xprfYItVGaompb2z5P8YalPnGFgQa+8YWBJr4xhYEyj1jC8JMPWMLwsw8YwvCzD1jC8IsPFMLwEwiz9DyxLS7jusGpXzYDAXkU+hheSDPGC0iytN8mr4B71Nf/Q== }}<br />
<br />
{| class="wikitable"<br />
|-<br />
! Advantages !! Disadvantages<br />
|-<br />
| Input works without electricity || Input can stall on low coal input<br />
|-<br />
| Only requires one side of electric poles || Only outputs to 1 side<br />
|-<br />
| || Only uses half the belt for ore<br />
|-<br />
|}<br />
<br />
=== The classsic JGGames / Arumba one, with the 2 splitters ===<br />
<br />
{{BlueprintString|bp-string=0eNqdm9tu20gMht9F13Ix54NfpSgKJ1ELAY5syPJigyDvXnm9dd2WtP5fV3Gc+BPJITlDcvzePO3P3XHsh6nZvjf982E4NdvP782p/z7s9pf3prdj12ybfupem7YZdq+X36ZxN5yOh3HaPHX7qflom3546f5ttvajXfzwaeq6/ebbeRx2z93dZ93Hl7bphqmf+u4qxX+/vH0dzq9P3TjDFUTbHA+n+VOH4fLMmbRxn2LbvM0v7Pzq4yLTHyiHohZJXjPK31LdSBIn3Dj9cOrGaX7vb0K4EdrmpR+75+sfk8CLDM8u8xKvp5X0zCsW0cimL4iKFjdZhVU0MjQIUGsYKYGFsJYW0wJiOkBMxZZO4nmCZwFe4CNWcRuLhEYgREsEDzFdhhf4YUaxheaIEWt/xcXpdbffb7r9LP7YP2+Oh333IKsYMfMaOpFUkWP5hCQL5PiMVJRdxbOhWZcj0wU63g1AjeSi2oc2THR0aibMnFyPfY2PAJlTWY7osp53/SJyeNfPIscRZ4SyvDN5T/AywAt8ZCbllBbZICrLMeQTsbUj9ssED7FfYZXOgNIV39jL8mYXDI7LAM7SiUjxmODwXR3R0+M4RM/AZiQxk4TIYsREEtK6E4Js+ExntyRyCs2R5al8FgqyT0XDBmRcDshI1wMJgLp1xwNZbU8HpWbAsOp0ILNo35cxicWI3hp5rw8ipxB7sAfaCJXgBaCNwJ+BvKRnWtEMUjo4yRHbLqKiJ3jAEiS6APDLAZ7oA1EAoHwZoK1Jxo8Ffnm7TAXHBQBX8c0cwGWD4wBls2UzkphJsmMxYqDmFQ1SkRNojtgVyZFPHEojKSe6Ml+OoZxZKNCEzIUOTE1nuhQWV6EYujIXMXQlLGMcixHbBIWof4FGbyFGAgbA8Y5vlb47UfcigrEeD0RRIWYDyFKwowGgA1fxytcsJ/1qYRrQ0q70fExxlYqXvYhYAaYhJmMLADF3VPb8L6aOmldV0GJurXThK2MqixH3f2sMnXe8MrgxbKnrkfnculJXHrkYdgIATRDp2ZdqwLimflZUZR1fwbDTLsXLaKdXLETUuxEZ1hqcFxAefeIRD/fW8lOvqDiVJepdyGRsvQtUptay9W5EoMRBCFrczAa6uiZ4wQsUqNbiTf8I4Bxe8CLSOQvjIOnYwldeAmIY/ChQHV33JpkTWU6WOet6/QqMvw2UFY+/m/Uy27giF3veBwZn1rPd/4RA6YGXZkDv1pwNZPt51vdln/XslEuRhrgLV4E0jc19r7yC8Ojef5H1pM9AVebwE6+qOFUgbr8hpgoW5yFLGRwZk8C1AHs36z0PL934fTzMPx9i/7wH1N6uzg7H8+WCrfCUAO/JFblfF2FcQXD0KEB1oQzv7pCeBcZBerL9UDl0I9sPlSM38v1Q+cpfpDui8s0pG5lY2LifMv1u+Fs0HM6TFg73o+Hjvp8edvwuze3ltY1szWANQk10dtANoqeHu4Gybg/7KYoPENNaxLcXK5pDplbCHH69f9wNnpefE1abPbHDNyUAE1uEKPGXiPHb/1oDN+VtoqsS5Y4yMYfeeEI+4usKjsDSowqISpzbLIGtfKLx2jnkQWTdja+BTCO374iZtbxc8kV6x2YsxK7ERDsQsuIR5QkqPeOYw/RLe/3G1vbu22Ft8083nq5GKdm5ObHky//+AJni3Dk= }}</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Klonan/Designs&diff=158897User:Klonan/Designs2018-05-05T17:59:29Z<p>Klonan: Add the classic JG games one stole from some PvP guy</p>
<hr />
<div>The following is a page of personal designs and blueprints I want to preserve more effectively.<br />
I have a problem in that when I change builds and branches and go from dev build to normal, all my blueprint libraries die.<br />
<br />
<br />
== Smelting ==<br />
<br />
=== Simple setup with burner inserters ===<br />
<br />
[https://i.imgur.com/gm5FMmF.png Image]<br />
<br />
This uses burner inserters to insert the coal and iron on one side, and normal inserters to take the plates out the other side.<br />
<br />
If coal runs low, the burner inserters can run out of fuel while picking up ore, leading to the whole system stalling and requiring manual fixing.<br />
<br />
{{BlueprintString|bp-string=0eNqVl+tugyAYhu+F39oIiqdbWZZFLVtILBrEZU3jvQ/r1nar4ssv4+F7eFA+83IhdTuKXktlSHkhsunUQMqXCxnkh6ra+Zo594KURBpxIgFR1Wk+M7pSQ99pE9aiNWQKiFRH8UVKOgW7xYPplAjfR62qRjzUsuk1IEIZaaRYLK4n5zc1nmqhLfyGGG2F/tCdPS4GAem7wRZ2ah7WwkIekLM9xJZ/lFo0yz0W/Dp1o+nHWf1pGLY1zedB4vVBVqAxDk1gaIJDKQzlOJTB0BSG4qIZzIxgZg4z8U9fwEz8fdIIhnIcSmEovkYp22j8lW46/LhGBz6toe5NVFuI0KFUg9DG3ttsTbYKSmAnuufEPZyoyylFnaI9pQxXchrlqBHbMypwI9d3YxFqlOwYMYobcZfRfXXvrkW6Criv6eFUtW0oWttNWjZh37Vi85+7zkoQGeoAcADgqk/9JuOaSwaouN5rDtRzR33hN5V0GxVH/rmF/f2xprfYItVGaompb2z5P8YalPnGFgQa+8YWBJr4xhYEyj1jC8JMPWMLwsw8YwvCzD1jC8IsPFMLwEwiz9DyxLS7jusGpXzYDAXkU+hheSDPGC0iytN8mr4B71Nf/Q== }}<br />
<br />
{| class="wikitable"<br />
|-<br />
! Advantages !! Disadvantages<br />
|-<br />
| Input works without electricity || Input can stall on low coal input<br />
|-<br />
| Only requires one side of electric poles || Only outputs to 1 side<br />
|-<br />
| || Only uses half the belt for ore<br />
|-<br />
|}<br />
<br />
=== The classsic JGGames / Arumba one, with the 2 splitters<br />
<br />
{{BlueprintString|bp-string=0eNqdm9tu20gMht9F13Ix54NfpSgKJ1ELAY5syPJigyDvXnm9dd2WtP5fV3Gc+BPJITlDcvzePO3P3XHsh6nZvjf982E4NdvP782p/z7s9pf3prdj12ybfupem7YZdq+X36ZxN5yOh3HaPHX7qflom3546f5ttvajXfzwaeq6/ebbeRx2z93dZ93Hl7bphqmf+u4qxX+/vH0dzq9P3TjDFUTbHA+n+VOH4fLMmbRxn2LbvM0v7Pzq4yLTHyiHohZJXjPK31LdSBIn3Dj9cOrGaX7vb0K4EdrmpR+75+sfk8CLDM8u8xKvp5X0zCsW0cimL4iKFjdZhVU0MjQIUGsYKYGFsJYW0wJiOkBMxZZO4nmCZwFe4CNWcRuLhEYgREsEDzFdhhf4YUaxheaIEWt/xcXpdbffb7r9LP7YP2+Oh333IKsYMfMaOpFUkWP5hCQL5PiMVJRdxbOhWZcj0wU63g1AjeSi2oc2THR0aibMnFyPfY2PAJlTWY7osp53/SJyeNfPIscRZ4SyvDN5T/AywAt8ZCbllBbZICrLMeQTsbUj9ssED7FfYZXOgNIV39jL8mYXDI7LAM7SiUjxmODwXR3R0+M4RM/AZiQxk4TIYsREEtK6E4Js+ExntyRyCs2R5al8FgqyT0XDBmRcDshI1wMJgLp1xwNZbU8HpWbAsOp0ILNo35cxicWI3hp5rw8ipxB7sAfaCJXgBaCNwJ+BvKRnWtEMUjo4yRHbLqKiJ3jAEiS6APDLAZ7oA1EAoHwZoK1Jxo8Ffnm7TAXHBQBX8c0cwGWD4wBls2UzkphJsmMxYqDmFQ1SkRNojtgVyZFPHEojKSe6Ml+OoZxZKNCEzIUOTE1nuhQWV6EYujIXMXQlLGMcixHbBIWof4FGbyFGAgbA8Y5vlb47UfcigrEeD0RRIWYDyFKwowGgA1fxytcsJ/1qYRrQ0q70fExxlYqXvYhYAaYhJmMLADF3VPb8L6aOmldV0GJurXThK2MqixH3f2sMnXe8MrgxbKnrkfnculJXHrkYdgIATRDp2ZdqwLimflZUZR1fwbDTLsXLaKdXLETUuxEZ1hqcFxAefeIRD/fW8lOvqDiVJepdyGRsvQtUptay9W5EoMRBCFrczAa6uiZ4wQsUqNbiTf8I4Bxe8CLSOQvjIOnYwldeAmIY/ChQHV33JpkTWU6WOet6/QqMvw2UFY+/m/Uy27giF3veBwZn1rPd/4RA6YGXZkDv1pwNZPt51vdln/XslEuRhrgLV4E0jc19r7yC8Ojef5H1pM9AVebwE6+qOFUgbr8hpgoW5yFLGRwZk8C1AHs36z0PL934fTzMPx9i/7wH1N6uzg7H8+WCrfCUAO/JFblfF2FcQXD0KEB1oQzv7pCeBcZBerL9UDl0I9sPlSM38v1Q+cpfpDui8s0pG5lY2LifMv1u+Fs0HM6TFg73o+Hjvp8edvwuze3ltY1szWANQk10dtANoqeHu4Gybg/7KYoPENNaxLcXK5pDplbCHH69f9wNnpefE1abPbHDNyUAE1uEKPGXiPHb/1oDN+VtoqsS5Y4yMYfeeEI+4usKjsDSowqISpzbLIGtfKLx2jnkQWTdja+BTCO374iZtbxc8kV6x2YsxK7ERDsQsuIR5QkqPeOYw/RLe/3G1vbu22Ft8083nq5GKdm5ObHky//+AJni3Dk= }}</div>Klonanhttps://wiki.factorio.com/index.php?title=Tutorial:Scripting&diff=158761Tutorial:Scripting2018-04-30T16:37:12Z<p>Klonan: </p>
<hr />
<div>== What is a script? ==<br />
<br />
In general, you can learn the definition of a script [https://en.wikipedia.org/wiki/Scripting_language here]. Within the context of Factorio, a script refers to a Lua script, packaged with a mod or scenario.<br />
<br />
There are 2 usages of scripts, loading of prototype data, and runtime scripting of the game and its entities.<br />
<br />
This guide only covers usages of runtime scripts. To be more specific, we call these runtime scripts 'control scripts', as they assert direct control on the game as it runs.<br />
<br />
== Loading a script ==<br />
<br />
When you load a game, scenario and mod scripts are loaded. The game looks for a file called 'control.lua', in the mod directory or the scenario directory. If found, the game will then load that script, and any other scripts required in the control script.<br />
<br />
== Factorio specifics ==<br />
<br />
Factorio uses Lua version 5.2<br />
<br />
Factorio uses Serpent for serialization - This comes with some big drawbacks:<br />
<br />
* Serpent is relatively slow and inefficient<br />
* Serpent cannot serialize a lot of Lua objects, such as functions, metatables and coroutines.<br />
<br />
The full scripting API is generated and updated each release, and is available [http://lua-api.factorio.com/latest/index.html here]. This is the number 1 resource for scripting in the game.<br />
<br />
== [http://lua-api.factorio.com/latest/LuaBootstrap.html Script events] ==<br />
<br />
The Lua script has some special functions it runs outside of events: <br />
* <code>script.on_init()</code><br />
* <code>script.on_configuration_changed()</code><br />
* <code>script.on_load()</code><br />
<br />
<code>on_init()</code> will run when the game starts (or in mod cases, when you add it to an existing save). It is used to initialize global variables you will need, changing game parameters, for instance:<br />
<br />
<source lang="lua">script.on_init(function()<br />
global.ticker = 0<br />
global.level = 1<br />
global.teams = {default_team = "johns-lads"}<br />
game.create_surface("Scenario Surface"<br />
game.map_settings.pollution.enabled = false<br />
--etc.<br />
end)</source><br />
<br />
[http://lua-api.factorio.com/latest/LuaGameScript.html <code>game</code>] namespace is available during on_init<br />
<br />
<code>on_configuration_changed(data)</code> will run when some configuration about this save game changes, such as a mod being added, changed or removed. This function is used to account for changes to game or prototype changes. <code>data</code> will contain information on what has changed.<br />
<br />
So if you are dependant on some prototype for your script to work, you should check here that it still exists:<br />
<br />
<source lang="lua">script.on_configuration_changed(function(data)<br />
local turret_name = "gun-turret"<br />
if not game.entity_prototypes[turret_name] then<br />
log("Gun turret isn't here, some mod or something has changed it")<br />
global.do_turret_logic = false<br />
end<br />
end)</source><br />
<br />
The contents of the <code>data</code> parameter is defined [http://lua-api.factorio.com/latest/Concepts.html#ConfigurationChangedData here].<br />
<br />
<code>on_load()</code> will run everytime the script loads. <code>game</code> will not be available during <code>on_load</code>. This should only be used to handle resetting up metatables, making local references to variables in <code>global</code>, and setting up conditional event handlers.<br />
<br />
<source lang="lua">local variable<br />
script.on_load(function()<br />
--Resetting metatables<br />
for k, v in (global.objects_with_metatable) do<br />
setmetatable(v, object_metatable)<br />
end<br />
<br />
--Setting local reference to global variable<br />
variable = global.variable<br />
<br />
--Conditional event handler<br />
if global.trees then<br />
script.on_event(defines.events.on_tick, handle_tree_function)<br />
end<br />
end)</source><br />
It is quite easy to generate desyncs doing overly complex things with on_load, so we recommend only doing things with it if absolutely nescessary.<br />
<br />
== [http://lua-api.factorio.com/latest/events.html Game events] ==<br />
<br />
The scripts all run based off events. These events are sent by the game after certain actions are performed. For instance <code>on_player_crafted_item</code>. To ''do'' something with an event, you will need to assign an event handler:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_player_crafted_item, player_crafted_function)</source><br />
When the event is triggered, it will then call the function with <code>event</code> as its parameter. <code>event</code> is a table that contains varying information about the event. More specific info on them [http://lua-api.factorio.com/latest/events.html here]. You then process the event using your own function:<br />
<br />
<source lang="lua">function player_crafted_function(event)<br />
game.print("A player crafted an item on tick "..event.tick)<br />
end</source><br />
This also works with anonymous functions:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)</source><br />
Note that only one event handler can be assigned for each event, such that:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)<br />
<br />
script.on_event(defines.events.on_tick, function(event)<br />
game.print("tock")<br />
end)</source><br />
The second handler will overwrite the first.<br />
<br />
If you want to do multiple things on the same event, a simple way is as follows:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
this_on_tick(event)<br />
that_on_tick(event)<br />
end)</source><br />
== Saving data &amp; the <code>global</code> table ==<br />
<br />
Save/Load stability is very important to preserve the determinism of the game. In Lua, all values are global by default. This isn’t good news in Factorio, as it can make it seem as though things are working correctly, but will lead to desyncs in MP.<br />
<br />
To preserve data between load and save, we have the <code>global</code> table. If there is some variable that you need to use between events, this is where it should live.<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
global.ticker = (global.ticker or 0) + 1<br />
end)</source><br />
Now when the player saves the game, the value of <code>global.ticker</code> will be saved. When it is loaded again, its value will be restored. This important, because in MP, players joining the game will load the value from the save.<br />
<br />
The way this can cause desyncs is quite clear, if one player has their Lua state, with a ticker value of 100, and another has a value of 50, and you then create ticker number of biters, it would create 100 for player 1, and 50 for player 2.<br />
<br />
However it is not often this easy. The case is often as follows:<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
This will be fine, we are using the variable, but not changing it. When a new player loads the game, <code>tick_to_print</code> will be <code>10</code>, same as the other players.<br />
<br />
Problem comes if we adjust <code>tick_to_print</code>, either by purpose or intentionally.<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
tick_to_print = tick_to_print + 100 --Say we want it to print again in 100 ticks<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
Now when you test the script, it will work perfectly. Every 100 ticks it will print “hello”. The problem occurs when you save, and load the game. When you save, the value of <code>tick_to_print</code> is not saved anywhere, And thus, when you load, it just uses the value its told to at the top of the script: <code>10</code>.<br />
<br />
Now it is clear that the value of <code>tick_to_print</code> has changed by saving and loading, thus we say it is not save/load stable. If a players joins a MP game with this script, they would desync as soon as one of the scripts prints as the result of a comparison against <code>tick_to_print</code>.<br />
<br />
So TL;DR - If you want to use something between ticks, then store it in <code>global</code>. This will prevent 99% of possible desyncs.<br />
<br />
== Story script ==<br />
<br />
Story script is a Lua library designed to facilitate the scripting and flow of a story. It has some simple structure and supporting function to help things move along.<br />
<br />
<source lang="lua">--Initialize the story info<br />
script.on_init(function()<br />
global.story = story_init()<br />
end)<br />
<br />
--Register to update the story on events<br />
script.on_event(defines.events, function(event)<br />
story_update(global.story, event)<br />
end)<br />
<br />
--Story table is where the 'story' is all defined.<br />
story_table =<br />
{<br />
{<br />
--branch 1<br />
{<br />
--First story event<br />
<br />
--Initialise this event<br />
init = function(event, story)<br />
game.print("First init of first story event")<br />
end,<br />
<br />
--Update function that will run on all events<br />
update = function(event, story)<br />
log("updating")<br />
end,<br />
<br />
--Condition to move on. If the return value is 'true', the story will continue.<br />
condition = function(event, story)<br />
if event.tick > 100 then<br />
return true<br />
end<br />
end,<br />
<br />
--Action to perform after condition is met<br />
action = function(event, story)<br />
game.print("You completed the objective!")<br />
end<br />
},<br />
{<br />
--Second story event - example.<br />
init = function(event, story)<br />
game.print("Collect 100 iron plate")<br />
end,<br />
condition = function(event, story)<br />
return game.players[1].get_item_count("iron-plate") >= 100<br />
end,<br />
action = function(event, story)<br />
game.print("Well done")<br />
end<br />
}<br />
--Once the end of a branch is reached, the story is finished.<br />
--The game will now display the mission complete screen.<br />
},<br />
{<br />
--branch 2<br />
}<br />
}<br />
<br />
--Init the helpers and story table. Must be done all times script is loaded.<br />
story_init_helpers(story_table)</source><br />
<br />
Branches are an optional system of the story system, and you can jump to another branch using <code>story_jump_to(story, name)</code>. The story progresses from the top down, and when it reaches the last story event, the mission concludes.<br />
<br />
It is possible to leverage any number of clever Lua tricks and API calls in the story table. It is good form to try and keep each story part independant from its neighbors, as it makes maintanance and reworkings more manageable.<br />
<br />
Bad:<br />
<br />
<source lang="lua"> {<br />
action = function()<br />
player().insert("iron-plate")<br />
end<br />
},<br />
{<br />
init = function()<br />
player().print("Use your iron plate to craft some belts")<br />
end<br />
}</source><br />
Good:<br />
<br />
<source lang="lua"> {<br />
init = function()<br />
player().insert("iron-plate")<br />
player().print("Use your iron plate...")<br />
end<br />
}</source><br />
<br />
There are some utility functions to make things simpler on the scripting side:<br />
<br />
<source lang="lua">--Return true only after this many seconds has elasped<br />
story_elapsed_check(5)<br />
<br />
--Update the objective for all players<br />
set_goal({"objective-1"})<br />
<br />
--Flash the goal GUI for players (updating info doesn't flash it)<br />
flash_goal()<br />
<br />
--Update the 'info gui' for all players. This is quite powerful and can use custom function to build complex GUI's<br />
set_info(<br />
{<br />
text = {"info-1"},<br />
picture = "item/iron-plate"<br />
})<br />
<br />
--Exports entities in a Lua table format<br />
export_entities(parameters)<br />
<br />
--Recreates entities saved using a Lua format<br />
recreate_entities(entities, parameters)<br />
<br />
--Shorthand syntax for game.players[i], defaults i to 1<br />
player(i)<br />
<br />
--Shorthand syntax for game.surfaces[i], defaults i to 1<br />
surface(i)</source></div>Klonanhttps://wiki.factorio.com/index.php?title=Tutorial:Scripting&diff=158760Tutorial:Scripting2018-04-30T16:36:18Z<p>Klonan: Part on loading scripts</p>
<hr />
<div>== What is a script? ==<br />
<br />
In general, you can learn the definition of a script [https://en.wikipedia.org/wiki/Scripting_language here]. Within the context of Factorio, a script refers to a Lua script, packaged with a mod or scenario.<br />
<br />
There are 2 usages of scripts, loading of prototype data, and runtime scripting of the game and its entities.<br />
<br />
This guide only covers usages of runtime scripts. To be more specific, we call these runtime scripts 'control scripts', as they assert direct control on the game as it runs.<br />
<br />
== Loading a script ==<br />
<br />
When you load a game, scenario and mod scripts are loading. The game looks for a file called 'control.lua', in the mod directory or the scenario directory. If found, the game will then load that script, and any other scripts required in the control script.<br />
<br />
== Factorio specifics ==<br />
<br />
Factorio uses Lua version 5.2<br />
<br />
Factorio uses Serpent for serialization - This comes with some big drawbacks:<br />
<br />
* Serpent is relatively slow and inefficient<br />
* Serpent cannot serialize a lot of Lua objects, such as functions, metatables and coroutines.<br />
<br />
The full scripting API is generated and updated each release, and is available [http://lua-api.factorio.com/latest/index.html here]. This is the number 1 resource for scripting in the game.<br />
<br />
== [http://lua-api.factorio.com/latest/LuaBootstrap.html Script events] ==<br />
<br />
The Lua script has some special functions it runs outside of events: <br />
* <code>script.on_init()</code><br />
* <code>script.on_configuration_changed()</code><br />
* <code>script.on_load()</code><br />
<br />
<code>on_init()</code> will run when the game starts (or in mod cases, when you add it to an existing save). It is used to initialize global variables you will need, changing game parameters, for instance:<br />
<br />
<source lang="lua">script.on_init(function()<br />
global.ticker = 0<br />
global.level = 1<br />
global.teams = {default_team = "johns-lads"}<br />
game.create_surface("Scenario Surface"<br />
game.map_settings.pollution.enabled = false<br />
--etc.<br />
end)</source><br />
<br />
[http://lua-api.factorio.com/latest/LuaGameScript.html <code>game</code>] namespace is available during on_init<br />
<br />
<code>on_configuration_changed(data)</code> will run when some configuration about this save game changes, such as a mod being added, changed or removed. This function is used to account for changes to game or prototype changes. <code>data</code> will contain information on what has changed.<br />
<br />
So if you are dependant on some prototype for your script to work, you should check here that it still exists:<br />
<br />
<source lang="lua">script.on_configuration_changed(function(data)<br />
local turret_name = "gun-turret"<br />
if not game.entity_prototypes[turret_name] then<br />
log("Gun turret isn't here, some mod or something has changed it")<br />
global.do_turret_logic = false<br />
end<br />
end)</source><br />
<br />
The contents of the <code>data</code> parameter is defined [http://lua-api.factorio.com/latest/Concepts.html#ConfigurationChangedData here].<br />
<br />
<code>on_load()</code> will run everytime the script loads. <code>game</code> will not be available during <code>on_load</code>. This should only be used to handle resetting up metatables, making local references to variables in <code>global</code>, and setting up conditional event handlers.<br />
<br />
<source lang="lua">local variable<br />
script.on_load(function()<br />
--Resetting metatables<br />
for k, v in (global.objects_with_metatable) do<br />
setmetatable(v, object_metatable)<br />
end<br />
<br />
--Setting local reference to global variable<br />
variable = global.variable<br />
<br />
--Conditional event handler<br />
if global.trees then<br />
script.on_event(defines.events.on_tick, handle_tree_function)<br />
end<br />
end)</source><br />
It is quite easy to generate desyncs doing overly complex things with on_load, so we recommend only doing things with it if absolutely nescessary.<br />
<br />
== [http://lua-api.factorio.com/latest/events.html Game events] ==<br />
<br />
The scripts all run based off events. These events are sent by the game after certain actions are performed. For instance <code>on_player_crafted_item</code>. To ''do'' something with an event, you will need to assign an event handler:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_player_crafted_item, player_crafted_function)</source><br />
When the event is triggered, it will then call the function with <code>event</code> as its parameter. <code>event</code> is a table that contains varying information about the event. More specific info on them [http://lua-api.factorio.com/latest/events.html here]. You then process the event using your own function:<br />
<br />
<source lang="lua">function player_crafted_function(event)<br />
game.print("A player crafted an item on tick "..event.tick)<br />
end</source><br />
This also works with anonymous functions:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)</source><br />
Note that only one event handler can be assigned for each event, such that:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)<br />
<br />
script.on_event(defines.events.on_tick, function(event)<br />
game.print("tock")<br />
end)</source><br />
The second handler will overwrite the first.<br />
<br />
If you want to do multiple things on the same event, a simple way is as follows:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
this_on_tick(event)<br />
that_on_tick(event)<br />
end)</source><br />
== Saving data &amp; the <code>global</code> table ==<br />
<br />
Save/Load stability is very important to preserve the determinism of the game. In Lua, all values are global by default. This isn’t good news in Factorio, as it can make it seem as though things are working correctly, but will lead to desyncs in MP.<br />
<br />
To preserve data between load and save, we have the <code>global</code> table. If there is some variable that you need to use between events, this is where it should live.<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
global.ticker = (global.ticker or 0) + 1<br />
end)</source><br />
Now when the player saves the game, the value of <code>global.ticker</code> will be saved. When it is loaded again, its value will be restored. This important, because in MP, players joining the game will load the value from the save.<br />
<br />
The way this can cause desyncs is quite clear, if one player has their Lua state, with a ticker value of 100, and another has a value of 50, and you then create ticker number of biters, it would create 100 for player 1, and 50 for player 2.<br />
<br />
However it is not often this easy. The case is often as follows:<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
This will be fine, we are using the variable, but not changing it. When a new player loads the game, <code>tick_to_print</code> will be <code>10</code>, same as the other players.<br />
<br />
Problem comes if we adjust <code>tick_to_print</code>, either by purpose or intentionally.<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
tick_to_print = tick_to_print + 100 --Say we want it to print again in 100 ticks<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
Now when you test the script, it will work perfectly. Every 100 ticks it will print “hello”. The problem occurs when you save, and load the game. When you save, the value of <code>tick_to_print</code> is not saved anywhere, And thus, when you load, it just uses the value its told to at the top of the script: <code>10</code>.<br />
<br />
Now it is clear that the value of <code>tick_to_print</code> has changed by saving and loading, thus we say it is not save/load stable. If a players joins a MP game with this script, they would desync as soon as one of the scripts prints as the result of a comparison against <code>tick_to_print</code>.<br />
<br />
So TL;DR - If you want to use something between ticks, then store it in <code>global</code>. This will prevent 99% of possible desyncs.<br />
<br />
== Story script ==<br />
<br />
Story script is a Lua library designed to facilitate the scripting and flow of a story. It has some simple structure and supporting function to help things move along.<br />
<br />
<source lang="lua">--Initialize the story info<br />
script.on_init(function()<br />
global.story = story_init()<br />
end)<br />
<br />
--Register to update the story on events<br />
script.on_event(defines.events, function(event)<br />
story_update(global.story, event)<br />
end)<br />
<br />
--Story table is where the 'story' is all defined.<br />
story_table =<br />
{<br />
{<br />
--branch 1<br />
{<br />
--First story event<br />
<br />
--Initialise this event<br />
init = function(event, story)<br />
game.print("First init of first story event")<br />
end,<br />
<br />
--Update function that will run on all events<br />
update = function(event, story)<br />
log("updating")<br />
end,<br />
<br />
--Condition to move on. If the return value is 'true', the story will continue.<br />
condition = function(event, story)<br />
if event.tick > 100 then<br />
return true<br />
end<br />
end,<br />
<br />
--Action to perform after condition is met<br />
action = function(event, story)<br />
game.print("You completed the objective!")<br />
end<br />
},<br />
{<br />
--Second story event - example.<br />
init = function(event, story)<br />
game.print("Collect 100 iron plate")<br />
end,<br />
condition = function(event, story)<br />
return game.players[1].get_item_count("iron-plate") >= 100<br />
end,<br />
action = function(event, story)<br />
game.print("Well done")<br />
end<br />
}<br />
--Once the end of a branch is reached, the story is finished.<br />
--The game will now display the mission complete screen.<br />
},<br />
{<br />
--branch 2<br />
}<br />
}<br />
<br />
--Init the helpers and story table. Must be done all times script is loaded.<br />
story_init_helpers(story_table)</source><br />
<br />
Branches are an optional system of the story system, and you can jump to another branch using <code>story_jump_to(story, name)</code>. The story progresses from the top down, and when it reaches the last story event, the mission concludes.<br />
<br />
It is possible to leverage any number of clever Lua tricks and API calls in the story table. It is good form to try and keep each story part independant from its neighbors, as it makes maintanance and reworkings more manageable.<br />
<br />
Bad:<br />
<br />
<source lang="lua"> {<br />
action = function()<br />
player().insert("iron-plate")<br />
end<br />
},<br />
{<br />
init = function()<br />
player().print("Use your iron plate to craft some belts")<br />
end<br />
}</source><br />
Good:<br />
<br />
<source lang="lua"> {<br />
init = function()<br />
player().insert("iron-plate")<br />
player().print("Use your iron plate...")<br />
end<br />
}</source><br />
<br />
There are some utility functions to make things simpler on the scripting side:<br />
<br />
<source lang="lua">--Return true only after this many seconds has elasped<br />
story_elapsed_check(5)<br />
<br />
--Update the objective for all players<br />
set_goal({"objective-1"})<br />
<br />
--Flash the goal GUI for players (updating info doesn't flash it)<br />
flash_goal()<br />
<br />
--Update the 'info gui' for all players. This is quite powerful and can use custom function to build complex GUI's<br />
set_info(<br />
{<br />
text = {"info-1"},<br />
picture = "item/iron-plate"<br />
})<br />
<br />
--Exports entities in a Lua table format<br />
export_entities(parameters)<br />
<br />
--Recreates entities saved using a Lua format<br />
recreate_entities(entities, parameters)<br />
<br />
--Shorthand syntax for game.players[i], defaults i to 1<br />
player(i)<br />
<br />
--Shorthand syntax for game.surfaces[i], defaults i to 1<br />
surface(i)</source></div>Klonanhttps://wiki.factorio.com/index.php?title=Tutorial:Scripting&diff=158759Tutorial:Scripting2018-04-30T16:20:24Z<p>Klonan: </p>
<hr />
<div>== What is a script? ==<br />
<br />
In general, you can learn the definition of a script [https://en.wikipedia.org/wiki/Scripting_language here]. Within the context of Factorio, a script refers to a Lua script, packaged with a mod or scenario.<br />
<br />
There are 2 usages of scripts, loading of prototype data, and runtime scripting of the game and its entities.<br />
<br />
This guide only covers usages of runtime scripts.<br />
<br />
== Factorio specifics ==<br />
<br />
Factorio uses Lua version 5.2<br />
<br />
Factorio uses Serpent for serialization - This comes with some big drawbacks:<br />
<br />
* Serpent is relatively slow and inefficient<br />
* Serpent cannot serialize a lot of Lua objects, such as functions, metatables and coroutines.<br />
<br />
The full scripting API is generated and updated each release, and is available [http://lua-api.factorio.com/latest/index.html here]. This is the number 1 resource for scripting in the game.<br />
<br />
== [http://lua-api.factorio.com/latest/LuaBootstrap.html Script events] ==<br />
<br />
The Lua script has some special functions it runs outside of events: <br />
* <code>script.on_init()</code><br />
* <code>script.on_configuration_changed()</code><br />
* <code>script.on_load()</code><br />
<br />
<code>on_init()</code> will run when the game starts (or in mod cases, when you add it to an existing save). It is used to initialize global variables you will need, changing game parameters, for instance:<br />
<br />
<source lang="lua">script.on_init(function()<br />
global.ticker = 0<br />
global.level = 1<br />
global.teams = {default_team = "johns-lads"}<br />
game.create_surface("Scenario Surface"<br />
game.map_settings.pollution.enabled = false<br />
--etc.<br />
end)</source><br />
<br />
[http://lua-api.factorio.com/latest/LuaGameScript.html <code>game</code>] namespace is available during on_init<br />
<br />
<code>on_configuration_changed(data)</code> will run when some configuration about this save game changes, such as a mod being added, changed or removed. This function is used to account for changes to game or prototype changes. <code>data</code> will contain information on what has changed.<br />
<br />
So if you are dependant on some prototype for your script to work, you should check here that it still exists:<br />
<br />
<source lang="lua">script.on_configuration_changed(function(data)<br />
local turret_name = "gun-turret"<br />
if not game.entity_prototypes[turret_name] then<br />
log("Gun turret isn't here, some mod or something has changed it")<br />
global.do_turret_logic = false<br />
end<br />
end)</source><br />
<br />
The contents of the <code>data</code> parameter is defined [http://lua-api.factorio.com/latest/Concepts.html#ConfigurationChangedData here].<br />
<br />
<code>on_load()</code> will run everytime the script loads. <code>game</code> will not be available during <code>on_load</code>. This should only be used to handle resetting up metatables, making local references to variables in <code>global</code>, and setting up conditional event handlers.<br />
<br />
<source lang="lua">local variable<br />
script.on_load(function()<br />
--Resetting metatables<br />
for k, v in (global.objects_with_metatable) do<br />
setmetatable(v, object_metatable)<br />
end<br />
<br />
--Setting local reference to global variable<br />
variable = global.variable<br />
<br />
--Conditional event handler<br />
if global.trees then<br />
script.on_event(defines.events.on_tick, handle_tree_function)<br />
end<br />
end)</source><br />
It is quite easy to generate desyncs doing overly complex things with on_load, so we recommend only doing things with it if absolutely nescessary.<br />
<br />
== [http://lua-api.factorio.com/latest/events.html Game events] ==<br />
<br />
The scripts all run based off events. These events are sent by the game after certain actions are performed. For instance <code>on_player_crafted_item</code>. To ''do'' something with an event, you will need to assign an event handler:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_player_crafted_item, player_crafted_function)</source><br />
When the event is triggered, it will then call the function with <code>event</code> as its parameter. <code>event</code> is a table that contains varying information about the event. More specific info on them [http://lua-api.factorio.com/latest/events.html here]. You then process the event using your own function:<br />
<br />
<source lang="lua">function player_crafted_function(event)<br />
game.print("A player crafted an item on tick "..event.tick)<br />
end</source><br />
This also works with anonymous functions:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)</source><br />
Note that only one event handler can be assigned for each event, such that:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)<br />
<br />
script.on_event(defines.events.on_tick, function(event)<br />
game.print("tock")<br />
end)</source><br />
The second handler will overwrite the first.<br />
<br />
If you want to do multiple things on the same event, a simple way is as follows:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
this_on_tick(event)<br />
that_on_tick(event)<br />
end)</source><br />
== Saving data &amp; the <code>global</code> table ==<br />
<br />
Save/Load stability is very important to preserve the determinism of the game. In Lua, all values are global by default. This isn’t good news in Factorio, as it can make it seem as though things are working correctly, but will lead to desyncs in MP.<br />
<br />
To preserve data between load and save, we have the <code>global</code> table. If there is some variable that you need to use between events, this is where it should live.<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
global.ticker = (global.ticker or 0) + 1<br />
end)</source><br />
Now when the player saves the game, the value of <code>global.ticker</code> will be saved. When it is loaded again, its value will be restored. This important, because in MP, players joining the game will load the value from the save.<br />
<br />
The way this can cause desyncs is quite clear, if one player has their Lua state, with a ticker value of 100, and another has a value of 50, and you then create ticker number of biters, it would create 100 for player 1, and 50 for player 2.<br />
<br />
However it is not often this easy. The case is often as follows:<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
This will be fine, we are using the variable, but not changing it. When a new player loads the game, <code>tick_to_print</code> will be <code>10</code>, same as the other players.<br />
<br />
Problem comes if we adjust <code>tick_to_print</code>, either by purpose or intentionally.<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
tick_to_print = tick_to_print + 100 --Say we want it to print again in 100 ticks<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
Now when you test the script, it will work perfectly. Every 100 ticks it will print “hello”. The problem occurs when you save, and load the game. When you save, the value of <code>tick_to_print</code> is not saved anywhere, And thus, when you load, it just uses the value its told to at the top of the script: <code>10</code>.<br />
<br />
Now it is clear that the value of <code>tick_to_print</code> has changed by saving and loading, thus we say it is not save/load stable. If a players joins a MP game with this script, they would desync as soon as one of the scripts prints as the result of a comparison against <code>tick_to_print</code>.<br />
<br />
So TL;DR - If you want to use something between ticks, then store it in <code>global</code>. This will prevent 99% of possible desyncs.<br />
<br />
== Story script ==<br />
<br />
Story script is a Lua library designed to facilitate the scripting and flow of a story. It has some simple structure and supporting function to help things move along.<br />
<br />
<source lang="lua">--Initialize the story info<br />
script.on_init(function()<br />
global.story = story_init()<br />
end)<br />
<br />
--Register to update the story on events<br />
script.on_event(defines.events, function(event)<br />
story_update(global.story, event)<br />
end)<br />
<br />
--Story table is where the 'story' is all defined.<br />
story_table =<br />
{<br />
{<br />
--branch 1<br />
{<br />
--First story event<br />
<br />
--Initialise this event<br />
init = function(event, story)<br />
game.print("First init of first story event")<br />
end,<br />
<br />
--Update function that will run on all events<br />
update = function(event, story)<br />
log("updating")<br />
end,<br />
<br />
--Condition to move on. If the return value is 'true', the story will continue.<br />
condition = function(event, story)<br />
if event.tick > 100 then<br />
return true<br />
end<br />
end,<br />
<br />
--Action to perform after condition is met<br />
action = function(event, story)<br />
game.print("You completed the objective!")<br />
end<br />
},<br />
{<br />
--Second story event - example.<br />
init = function(event, story)<br />
game.print("Collect 100 iron plate")<br />
end,<br />
condition = function(event, story)<br />
return game.players[1].get_item_count("iron-plate") >= 100<br />
end,<br />
action = function(event, story)<br />
game.print("Well done")<br />
end<br />
}<br />
--Once the end of a branch is reached, the story is finished.<br />
--The game will now display the mission complete screen.<br />
},<br />
{<br />
--branch 2<br />
}<br />
}<br />
<br />
--Init the helpers and story table. Must be done all times script is loaded.<br />
story_init_helpers(story_table)</source><br />
<br />
Branches are an optional system of the story system, and you can jump to another branch using <code>story_jump_to(story, name)</code>. The story progresses from the top down, and when it reaches the last story event, the mission concludes.<br />
<br />
It is possible to leverage any number of clever Lua tricks and API calls in the story table. It is good form to try and keep each story part independant from its neighbors, as it makes maintanance and reworkings more manageable.<br />
<br />
Bad:<br />
<br />
<source lang="lua"> {<br />
action = function()<br />
player().insert("iron-plate")<br />
end<br />
},<br />
{<br />
init = function()<br />
player().print("Use your iron plate to craft some belts")<br />
end<br />
}</source><br />
Good:<br />
<br />
<source lang="lua"> {<br />
init = function()<br />
player().insert("iron-plate")<br />
player().print("Use your iron plate...")<br />
end<br />
}</source><br />
<br />
There are some utility functions to make things simpler on the scripting side:<br />
<br />
<source lang="lua">--Return true only after this many seconds has elasped<br />
story_elapsed_check(5)<br />
<br />
--Update the objective for all players<br />
set_goal({"objective-1"})<br />
<br />
--Flash the goal GUI for players (updating info doesn't flash it)<br />
flash_goal()<br />
<br />
--Update the 'info gui' for all players. This is quite powerful and can use custom function to build complex GUI's<br />
set_info(<br />
{<br />
text = {"info-1"},<br />
picture = "item/iron-plate"<br />
})<br />
<br />
--Exports entities in a Lua table format<br />
export_entities(parameters)<br />
<br />
--Recreates entities saved using a Lua format<br />
recreate_entities(entities, parameters)<br />
<br />
--Shorthand syntax for game.players[i], defaults i to 1<br />
player(i)<br />
<br />
--Shorthand syntax for game.surfaces[i], defaults i to 1<br />
surface(i)</source></div>Klonanhttps://wiki.factorio.com/index.php?title=Tutorial:Scripting&diff=158758Tutorial:Scripting2018-04-30T16:19:31Z<p>Klonan: </p>
<hr />
<div>== What is a script? ==<br />
<br />
In general, you can learn the definition of a script [here https://en.wikipedia.org/wiki/Scripting_language]. Within the context of Factorio, a script refers to a Lua script, packaged with a mod or scenario.<br />
<br />
There are 2 usages of scripts, loading of prototype data, and runtime scripting of the game and its entities.<br />
<br />
This guide only covers usages of runtime scripts.<br />
<br />
== Factorio specifics ==<br />
<br />
Factorio uses Lua version 5.2<br />
<br />
Factorio uses Serpent for serialization - This comes with some big drawbacks:<br />
<br />
* Serpent is relatively slow and inefficient<br />
* Serpent cannot serialize a lot of Lua objects, such as functions, metatables and coroutines.<br />
<br />
The full scripting API is generated and updated each release, and is available [http://lua-api.factorio.com/latest/index.html here]. This is the number 1 resource for scripting in the game.<br />
<br />
== [http://lua-api.factorio.com/latest/LuaBootstrap.html Script events] ==<br />
<br />
The Lua script has some special functions it runs outside of events: <br />
* <code>script.on_init()</code><br />
* <code>script.on_configuration_changed()</code><br />
* <code>script.on_load()</code><br />
<br />
<code>on_init()</code> will run when the game starts (or in mod cases, when you add it to an existing save). It is used to initialize global variables you will need, changing game parameters, for instance:<br />
<br />
<source lang="lua">script.on_init(function()<br />
global.ticker = 0<br />
global.level = 1<br />
global.teams = {default_team = "johns-lads"}<br />
game.create_surface("Scenario Surface"<br />
game.map_settings.pollution.enabled = false<br />
--etc.<br />
end)</source><br />
<br />
[http://lua-api.factorio.com/latest/LuaGameScript.html <code>game</code>] namespace is available during on_init<br />
<br />
<code>on_configuration_changed(data)</code> will run when some configuration about this save game changes, such as a mod being added, changed or removed. This function is used to account for changes to game or prototype changes. <code>data</code> will contain information on what has changed.<br />
<br />
So if you are dependant on some prototype for your script to work, you should check here that it still exists:<br />
<br />
<source lang="lua">script.on_configuration_changed(function(data)<br />
local turret_name = "gun-turret"<br />
if not game.entity_prototypes[turret_name] then<br />
log("Gun turret isn't here, some mod or something has changed it")<br />
global.do_turret_logic = false<br />
end<br />
end)</source><br />
<br />
The contents of the <code>data</code> parameter is defined [http://lua-api.factorio.com/latest/Concepts.html#ConfigurationChangedData here].<br />
<br />
<code>on_load()</code> will run everytime the script loads. <code>game</code> will not be available during <code>on_load</code>. This should only be used to handle resetting up metatables, making local references to variables in <code>global</code>, and setting up conditional event handlers.<br />
<br />
<source lang="lua">local variable<br />
script.on_load(function()<br />
--Resetting metatables<br />
for k, v in (global.objects_with_metatable) do<br />
setmetatable(v, object_metatable)<br />
end<br />
<br />
--Setting local reference to global variable<br />
variable = global.variable<br />
<br />
--Conditional event handler<br />
if global.trees then<br />
script.on_event(defines.events.on_tick, handle_tree_function)<br />
end<br />
end)</source><br />
It is quite easy to generate desyncs doing overly complex things with on_load, so we recommend only doing things with it if absolutely nescessary.<br />
<br />
== [http://lua-api.factorio.com/latest/events.html Game events] ==<br />
<br />
The scripts all run based off events. These events are sent by the game after certain actions are performed. For instance <code>on_player_crafted_item</code>. To ''do'' something with an event, you will need to assign an event handler:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_player_crafted_item, player_crafted_function)</source><br />
When the event is triggered, it will then call the function with <code>event</code> as its parameter. <code>event</code> is a table that contains varying information about the event. More specific info on them [http://lua-api.factorio.com/latest/events.html here]. You then process the event using your own function:<br />
<br />
<source lang="lua">function player_crafted_function(event)<br />
game.print("A player crafted an item on tick "..event.tick)<br />
end</source><br />
This also works with anonymous functions:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)</source><br />
Note that only one event handler can be assigned for each event, such that:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)<br />
<br />
script.on_event(defines.events.on_tick, function(event)<br />
game.print("tock")<br />
end)</source><br />
The second handler will overwrite the first.<br />
<br />
If you want to do multiple things on the same event, a simple way is as follows:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
this_on_tick(event)<br />
that_on_tick(event)<br />
end)</source><br />
== Saving data &amp; the <code>global</code> table ==<br />
<br />
Save/Load stability is very important to preserve the determinism of the game. In Lua, all values are global by default. This isn’t good news in Factorio, as it can make it seem as though things are working correctly, but will lead to desyncs in MP.<br />
<br />
To preserve data between load and save, we have the <code>global</code> table. If there is some variable that you need to use between events, this is where it should live.<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
global.ticker = (global.ticker or 0) + 1<br />
end)</source><br />
Now when the player saves the game, the value of <code>global.ticker</code> will be saved. When it is loaded again, its value will be restored. This important, because in MP, players joining the game will load the value from the save.<br />
<br />
The way this can cause desyncs is quite clear, if one player has their Lua state, with a ticker value of 100, and another has a value of 50, and you then create ticker number of biters, it would create 100 for player 1, and 50 for player 2.<br />
<br />
However it is not often this easy. The case is often as follows:<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
This will be fine, we are using the variable, but not changing it. When a new player loads the game, <code>tick_to_print</code> will be <code>10</code>, same as the other players.<br />
<br />
Problem comes if we adjust <code>tick_to_print</code>, either by purpose or intentionally.<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
tick_to_print = tick_to_print + 100 --Say we want it to print again in 100 ticks<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
Now when you test the script, it will work perfectly. Every 100 ticks it will print “hello”. The problem occurs when you save, and load the game. When you save, the value of <code>tick_to_print</code> is not saved anywhere, And thus, when you load, it just uses the value its told to at the top of the script: <code>10</code>.<br />
<br />
Now it is clear that the value of <code>tick_to_print</code> has changed by saving and loading, thus we say it is not save/load stable. If a players joins a MP game with this script, they would desync as soon as one of the scripts prints as the result of a comparison against <code>tick_to_print</code>.<br />
<br />
So TL;DR - If you want to use something between ticks, then store it in <code>global</code>. This will prevent 99% of possible desyncs.<br />
<br />
== Story script ==<br />
<br />
Story script is a Lua library designed to facilitate the scripting and flow of a story. It has some simple structure and supporting function to help things move along.<br />
<br />
<source lang="lua">--Initialize the story info<br />
script.on_init(function()<br />
global.story = story_init()<br />
end)<br />
<br />
--Register to update the story on events<br />
script.on_event(defines.events, function(event)<br />
story_update(global.story, event)<br />
end)<br />
<br />
--Story table is where the 'story' is all defined.<br />
story_table =<br />
{<br />
{<br />
--branch 1<br />
{<br />
--First story event<br />
<br />
--Initialise this event<br />
init = function(event, story)<br />
game.print("First init of first story event")<br />
end,<br />
<br />
--Update function that will run on all events<br />
update = function(event, story)<br />
log("updating")<br />
end,<br />
<br />
--Condition to move on. If the return value is 'true', the story will continue.<br />
condition = function(event, story)<br />
if event.tick > 100 then<br />
return true<br />
end<br />
end,<br />
<br />
--Action to perform after condition is met<br />
action = function(event, story)<br />
game.print("You completed the objective!")<br />
end<br />
},<br />
{<br />
--Second story event - example.<br />
init = function(event, story)<br />
game.print("Collect 100 iron plate")<br />
end,<br />
condition = function(event, story)<br />
return game.players[1].get_item_count("iron-plate") >= 100<br />
end,<br />
action = function(event, story)<br />
game.print("Well done")<br />
end<br />
}<br />
--Once the end of a branch is reached, the story is finished.<br />
--The game will now display the mission complete screen.<br />
},<br />
{<br />
--branch 2<br />
}<br />
}<br />
<br />
--Init the helpers and story table. Must be done all times script is loaded.<br />
story_init_helpers(story_table)</source><br />
<br />
Branches are an optional system of the story system, and you can jump to another branch using <code>story_jump_to(story, name)</code>. The story progresses from the top down, and when it reaches the last story event, the mission concludes.<br />
<br />
It is possible to leverage any number of clever Lua tricks and API calls in the story table. It is good form to try and keep each story part independant from its neighbors, as it makes maintanance and reworkings more manageable.<br />
<br />
Bad:<br />
<br />
<source lang="lua"> {<br />
action = function()<br />
player().insert("iron-plate")<br />
end<br />
},<br />
{<br />
init = function()<br />
player().print("Use your iron plate to craft some belts")<br />
end<br />
}</source><br />
Good:<br />
<br />
<source lang="lua"> {<br />
init = function()<br />
player().insert("iron-plate")<br />
player().print("Use your iron plate...")<br />
end<br />
}</source><br />
<br />
There are some utility functions to make things simpler on the scripting side:<br />
<br />
<source lang="lua">--Return true only after this many seconds has elasped<br />
story_elapsed_check(5)<br />
<br />
--Update the objective for all players<br />
set_goal({"objective-1"})<br />
<br />
--Flash the goal GUI for players (updating info doesn't flash it)<br />
flash_goal()<br />
<br />
--Update the 'info gui' for all players. This is quite powerful and can use custom function to build complex GUI's<br />
set_info(<br />
{<br />
text = {"info-1"},<br />
picture = "item/iron-plate"<br />
})<br />
<br />
--Exports entities in a Lua table format<br />
export_entities(parameters)<br />
<br />
--Recreates entities saved using a Lua format<br />
recreate_entities(entities, parameters)<br />
<br />
--Shorthand syntax for game.players[i], defaults i to 1<br />
player(i)<br />
<br />
--Shorthand syntax for game.surfaces[i], defaults i to 1<br />
surface(i)</source></div>Klonanhttps://wiki.factorio.com/index.php?title=Tutorial:Scripting&diff=158757Tutorial:Scripting2018-04-30T16:17:46Z<p>Klonan: </p>
<hr />
<div>= Lua scripting Guide =<br />
<br />
Factorio uses Lua version 5.2<br />
<br />
Factorio uses Serpent for serialization - This comes with some big drawbacks:<br />
<br />
* Serpent is relatively slow and inefficient<br />
* Serpent cannot serialize a lot of Lua objects, such as functions, metatables and coroutines.<br />
<br />
The full scripting API is generated and updated each release, and is available [http://lua-api.factorio.com/latest/index.html here]. This is the number 1 resource for scripting in the game.<br />
<br />
<br />
-----<br />
<br />
== What is a script? ==<br />
<br />
In general, you can learn the definition of a script [here https://en.wikipedia.org/wiki/Scripting_language]. Within the context of Factorio, a script refers to a Lua script, packaged with a mod or scenario.<br />
<br />
There are 2 usages of scripts, loading of prototype data, and runtime scripting of the game and its entities.<br />
<br />
This guide only covers usages of runtime scripts.<br />
<br />
== [http://lua-api.factorio.com/latest/LuaBootstrap.html Script events] ==<br />
<br />
The Lua script has some special functions it runs outside of events: <br />
* <code>script.on_init()</code><br />
* <code>script.on_configuration_changed()</code><br />
* <code>script.on_load()</code><br />
<br />
<code>on_init()</code> will run when the game starts (or in mod cases, when you add it to an existing save). It is used to initialize global variables you will need, changing game parameters, for instance:<br />
<br />
<source lang="lua">script.on_init(function()<br />
global.ticker = 0<br />
global.level = 1<br />
global.teams = {default_team = "johns-lads"}<br />
game.create_surface("Scenario Surface"<br />
game.map_settings.pollution.enabled = false<br />
--etc.<br />
end)</source><br />
<br />
[http://lua-api.factorio.com/latest/LuaGameScript.html <code>game</code>] namespace is available during on_init<br />
<br />
<code>on_configuration_changed(data)</code> will run when some configuration about this save game changes, such as a mod being added, changed or removed. This function is used to account for changes to game or prototype changes. <code>data</code> will contain information on what has changed.<br />
<br />
So if you are dependant on some prototype for your script to work, you should check here that it still exists:<br />
<br />
<source lang="lua">script.on_configuration_changed(function(data)<br />
local turret_name = "gun-turret"<br />
if not game.entity_prototypes[turret_name] then<br />
log("Gun turret isn't here, some mod or something has changed it")<br />
global.do_turret_logic = false<br />
end<br />
end)</source><br />
<br />
The contents of the <code>data</code> parameter is defined [http://lua-api.factorio.com/latest/Concepts.html#ConfigurationChangedData here].<br />
<br />
<code>on_load()</code> will run everytime the script loads. <code>game</code> will not be available during <code>on_load</code>. This should only be used to handle resetting up metatables, making local references to variables in <code>global</code>, and setting up conditional event handlers.<br />
<br />
<source lang="lua">local variable<br />
script.on_load(function()<br />
--Resetting metatables<br />
for k, v in (global.objects_with_metatable) do<br />
setmetatable(v, object_metatable)<br />
end<br />
<br />
--Setting local reference to global variable<br />
variable = global.variable<br />
<br />
--Conditional event handler<br />
if global.trees then<br />
script.on_event(defines.events.on_tick, handle_tree_function)<br />
end<br />
end)</source><br />
It is quite easy to generate desyncs doing overly complex things with on_load, so we recommend only doing things with it if absolutely nescessary.<br />
<br />
== [http://lua-api.factorio.com/latest/events.html Game events] ==<br />
<br />
The scripts all run based off events. These events are sent by the game after certain actions are performed. For instance <code>on_player_crafted_item</code>. To ''do'' something with an event, you will need to assign an event handler:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_player_crafted_item, player_crafted_function)</source><br />
When the event is triggered, it will then call the function with <code>event</code> as its parameter. <code>event</code> is a table that contains varying information about the event. More specific info on them [http://lua-api.factorio.com/latest/events.html here]. You then process the event using your own function:<br />
<br />
<source lang="lua">function player_crafted_function(event)<br />
game.print("A player crafted an item on tick "..event.tick)<br />
end</source><br />
This also works with anonymous functions:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)</source><br />
Note that only one event handler can be assigned for each event, such that:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)<br />
<br />
script.on_event(defines.events.on_tick, function(event)<br />
game.print("tock")<br />
end)</source><br />
The second handler will overwrite the first.<br />
<br />
If you want to do multiple things on the same event, a simple way is as follows:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
this_on_tick(event)<br />
that_on_tick(event)<br />
end)</source><br />
== Saving data &amp; the <code>global</code> table ==<br />
<br />
Save/Load stability is very important to preserve the determinism of the game. In Lua, all values are global by default. This isn’t good news in Factorio, as it can make it seem as though things are working correctly, but will lead to desyncs in MP.<br />
<br />
To preserve data between load and save, we have the <code>global</code> table. If there is some variable that you need to use between events, this is where it should live.<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
global.ticker = (global.ticker or 0) + 1<br />
end)</source><br />
Now when the player saves the game, the value of <code>global.ticker</code> will be saved. When it is loaded again, its value will be restored. This important, because in MP, players joining the game will load the value from the save.<br />
<br />
The way this can cause desyncs is quite clear, if one player has their Lua state, with a ticker value of 100, and another has a value of 50, and you then create ticker number of biters, it would create 100 for player 1, and 50 for player 2.<br />
<br />
However it is not often this easy. The case is often as follows:<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
This will be fine, we are using the variable, but not changing it. When a new player loads the game, <code>tick_to_print</code> will be <code>10</code>, same as the other players.<br />
<br />
Problem comes if we adjust <code>tick_to_print</code>, either by purpose or intentionally.<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
tick_to_print = tick_to_print + 100 --Say we want it to print again in 100 ticks<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
Now when you test the script, it will work perfectly. Every 100 ticks it will print “hello”. The problem occurs when you save, and load the game. When you save, the value of <code>tick_to_print</code> is not saved anywhere, And thus, when you load, it just uses the value its told to at the top of the script: <code>10</code>.<br />
<br />
Now it is clear that the value of <code>tick_to_print</code> has changed by saving and loading, thus we say it is not save/load stable. If a players joins a MP game with this script, they would desync as soon as one of the scripts prints as the result of a comparison against <code>tick_to_print</code>.<br />
<br />
So TL;DR - If you want to use something between ticks, then store it in <code>global</code>. This will prevent 99% of possible desyncs.<br />
<br />
== Story script ==<br />
<br />
Story script is a Lua library designed to facilitate the scripting and flow of a story. It has some simple structure and supporting function to help things move along.<br />
<br />
<source lang="lua">--Initialize the story info<br />
script.on_init(function()<br />
global.story = story_init()<br />
end)<br />
<br />
--Register to update the story on events<br />
script.on_event(defines.events, function(event)<br />
story_update(global.story, event)<br />
end)<br />
<br />
--Story table is where the 'story' is all defined.<br />
story_table =<br />
{<br />
{<br />
--branch 1<br />
{<br />
--First story event<br />
<br />
--Initialise this event<br />
init = function(event, story)<br />
game.print("First init of first story event")<br />
end,<br />
<br />
--Update function that will run on all events<br />
update = function(event, story)<br />
log("updating")<br />
end,<br />
<br />
--Condition to move on. If the return value is 'true', the story will continue.<br />
condition = function(event, story)<br />
if event.tick > 100 then<br />
return true<br />
end<br />
end,<br />
<br />
--Action to perform after condition is met<br />
action = function(event, story)<br />
game.print("You completed the objective!")<br />
end<br />
},<br />
{<br />
--Second story event - example.<br />
init = function(event, story)<br />
game.print("Collect 100 iron plate")<br />
end,<br />
condition = function(event, story)<br />
return game.players[1].get_item_count("iron-plate") >= 100<br />
end,<br />
action = function(event, story)<br />
game.print("Well done")<br />
end<br />
}<br />
--Once the end of a branch is reached, the story is finished.<br />
--The game will now display the mission complete screen.<br />
},<br />
{<br />
--branch 2<br />
}<br />
}<br />
<br />
--Init the helpers and story table. Must be done all times script is loaded.<br />
story_init_helpers(story_table)</source><br />
<br />
Branches are an optional system of the story system, and you can jump to another branch using <code>story_jump_to(story, name)</code>. The story progresses from the top down, and when it reaches the last story event, the mission concludes.<br />
<br />
It is possible to leverage any number of clever Lua tricks and API calls in the story table. It is good form to try and keep each story part independant from its neighbors, as it makes maintanance and reworkings more manageable.<br />
<br />
Bad:<br />
<br />
<source lang="lua"> {<br />
action = function()<br />
player().insert("iron-plate")<br />
end<br />
},<br />
{<br />
init = function()<br />
player().print("Use your iron plate to craft some belts")<br />
end<br />
}</source><br />
Good:<br />
<br />
<source lang="lua"> {<br />
init = function()<br />
player().insert("iron-plate")<br />
player().print("Use your iron plate...")<br />
end<br />
}</source><br />
<br />
There are some utility functions to make things simpler on the scripting side:<br />
<br />
<source lang="lua">--Return true only after this many seconds has elasped<br />
story_elapsed_check(5)<br />
<br />
--Update the objective for all players<br />
set_goal({"objective-1"})<br />
<br />
--Flash the goal GUI for players (updating info doesn't flash it)<br />
flash_goal()<br />
<br />
--Update the 'info gui' for all players. This is quite powerful and can use custom function to build complex GUI's<br />
set_info(<br />
{<br />
text = {"info-1"},<br />
picture = "item/iron-plate"<br />
})<br />
<br />
--Exports entities in a Lua table format<br />
export_entities(parameters)<br />
<br />
--Recreates entities saved using a Lua format<br />
recreate_entities(entities, parameters)<br />
<br />
--Shorthand syntax for game.players[i], defaults i to 1<br />
player(i)<br />
<br />
--Shorthand syntax for game.surfaces[i], defaults i to 1<br />
surface(i)</source></div>Klonanhttps://wiki.factorio.com/index.php?title=Tutorial:Scripting&diff=158756Tutorial:Scripting2018-04-30T16:12:23Z<p>Klonan: Better name also proper link</p>
<hr />
<div>= Lua scripting Guide =<br />
<br />
Factorio uses Lua version 5.2<br />
<br />
Factorio uses Serpent for serialization - This comes with some big drawbacks:<br />
<br />
* Serpent is relatively slow and inefficient<br />
* Serpent cannot serialize a lot of Lua objects, such as functions, metatables and coroutines.<br />
<br />
The full scripting API is generated and updated each release, and is available [http://lua-api.factorio.com/latest/index.html here]. This is the number 1 resource for scripting in the game.<br />
<br />
<br />
-----<br />
<br />
== [http://lua-api.factorio.com/latest/LuaBootstrap.html Script events] ==<br />
<br />
The Lua script has some special functions it runs outside of events: <br />
* <code>script.on_init()</code><br />
* <code>script.on_configuration_changed()</code><br />
* <code>script.on_load()</code><br />
<br />
<code>on_init()</code> will run when the game starts (or in mod cases, when you add it to an existing save). It is used to initialize global variables you will need, changing game parameters, for instance:<br />
<br />
<source lang="lua">script.on_init(function()<br />
global.ticker = 0<br />
global.level = 1<br />
global.teams = {default_team = "johns-lads"}<br />
game.create_surface("Scenario Surface"<br />
game.map_settings.pollution.enabled = false<br />
--etc.<br />
end)</source><br />
<br />
[http://lua-api.factorio.com/latest/LuaGameScript.html <code>game</code>] namespace is available during on_init<br />
<br />
<code>on_configuration_changed(data)</code> will run when some configuration about this save game changes, such as a mod being added, changed or removed. This function is used to account for changes to game or prototype changes. <code>data</code> will contain information on what has changed.<br />
<br />
So if you are dependant on some prototype for your script to work, you should check here that it still exists:<br />
<br />
<source lang="lua">script.on_configuration_changed(function(data)<br />
local turret_name = "gun-turret"<br />
if not game.entity_prototypes[turret_name] then<br />
log("Gun turret isn't here, some mod or something has changed it")<br />
global.do_turret_logic = false<br />
end<br />
end)</source><br />
<br />
The contents of the <code>data</code> parameter is defined [http://lua-api.factorio.com/latest/Concepts.html#ConfigurationChangedData here].<br />
<br />
<code>on_load()</code> will run everytime the script loads. <code>game</code> will not be available during <code>on_load</code>. This should only be used to handle resetting up metatables, making local references to variables in <code>global</code>, and setting up conditional event handlers.<br />
<br />
<source lang="lua">local variable<br />
script.on_load(function()<br />
--Resetting metatables<br />
for k, v in (global.objects_with_metatable) do<br />
setmetatable(v, object_metatable)<br />
end<br />
<br />
--Setting local reference to global variable<br />
variable = global.variable<br />
<br />
--Conditional event handler<br />
if global.trees then<br />
script.on_event(defines.events.on_tick, handle_tree_function)<br />
end<br />
end)</source><br />
It is quite easy to generate desyncs doing overly complex things with on_load, so we recommend only doing things with it if absolutely nescessary.<br />
<br />
== [http://lua-api.factorio.com/latest/events.html Game events] ==<br />
<br />
The scripts all run based off events. These events are sent by the game after certain actions are performed. For instance <code>on_player_crafted_item</code>. To ''do'' something with an event, you will need to assign an event handler:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_player_crafted_item, player_crafted_function)</source><br />
When the event is triggered, it will then call the function with <code>event</code> as its parameter. <code>event</code> is a table that contains varying information about the event. More specific info on them [http://lua-api.factorio.com/latest/events.html here]. You then process the event using your own function:<br />
<br />
<source lang="lua">function player_crafted_function(event)<br />
game.print("A player crafted an item on tick "..event.tick)<br />
end</source><br />
This also works with anonymous functions:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)</source><br />
Note that only one event handler can be assigned for each event, such that:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
game.print("tick")<br />
end)<br />
<br />
script.on_event(defines.events.on_tick, function(event)<br />
game.print("tock")<br />
end)</source><br />
The second handler will overwrite the first.<br />
<br />
If you want to do multiple things on the same event, a simple way is as follows:<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
this_on_tick(event)<br />
that_on_tick(event)<br />
end)</source><br />
== Saving data &amp; the <code>global</code> table ==<br />
<br />
Save/Load stability is very important to preserve the determinism of the game. In Lua, all values are global by default. This isn’t good news in Factorio, as it can make it seem as though things are working correctly, but will lead to desyncs in MP.<br />
<br />
To preserve data between load and save, we have the <code>global</code> table. If there is some variable that you need to use between events, this is where it should live.<br />
<br />
<source lang="lua">script.on_event(defines.events.on_tick, function(event)<br />
global.ticker = (global.ticker or 0) + 1<br />
end)</source><br />
Now when the player saves the game, the value of <code>global.ticker</code> will be saved. When it is loaded again, its value will be restored. This important, because in MP, players joining the game will load the value from the save.<br />
<br />
The way this can cause desyncs is quite clear, if one player has their Lua state, with a ticker value of 100, and another has a value of 50, and you then create ticker number of biters, it would create 100 for player 1, and 50 for player 2.<br />
<br />
However it is not often this easy. The case is often as follows:<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
This will be fine, we are using the variable, but not changing it. When a new player loads the game, <code>tick_to_print</code> will be <code>10</code>, same as the other players.<br />
<br />
Problem comes if we adjust <code>tick_to_print</code>, either by purpose or intentionally.<br />
<br />
<source lang="lua">tick_to_print = 10 --So lets say this is a static variable. Just some config for how your script works.<br />
<br />
function on_tick()<br />
if game.tick == tick_to_print then<br />
game.print("hello")<br />
tick_to_print = tick_to_print + 100 --Say we want it to print again in 100 ticks<br />
end<br />
end<br />
<br />
script.on_event(defines.event.on_tick, on_tick)</source><br />
Now when you test the script, it will work perfectly. Every 100 ticks it will print “hello”. The problem occurs when you save, and load the game. When you save, the value of <code>tick_to_print</code> is not saved anywhere, And thus, when you load, it just uses the value its told to at the top of the script: <code>10</code>.<br />
<br />
Now it is clear that the value of <code>tick_to_print</code> has changed by saving and loading, thus we say it is not save/load stable. If a players joins a MP game with this script, they would desync as soon as one of the scripts prints as the result of a comparison against <code>tick_to_print</code>.<br />
<br />
So TL;DR - If you want to use something between ticks, then store it in <code>global</code>. This will prevent 99% of possible desyncs.<br />
<br />
== Story script ==<br />
<br />
Story script is a Lua library designed to facilitate the scripting and flow of a story. It has some simple structure and supporting function to help things move along.<br />
<br />
<source lang="lua">--Initialize the story info<br />
script.on_init(function()<br />
global.story = story_init()<br />
end)<br />
<br />
--Register to update the story on events<br />
script.on_event(defines.events, function(event)<br />
story_update(global.story, event)<br />
end)<br />
<br />
--Story table is where the 'story' is all defined.<br />
story_table =<br />
{<br />
{<br />
--branch 1<br />
{<br />
--First story event<br />
<br />
--Initialise this event<br />
init = function(event, story)<br />
game.print("First init of first story event")<br />
end,<br />
<br />
--Update function that will run on all events<br />
update = function(event, story)<br />
log("updating")<br />
end,<br />
<br />
--Condition to move on. If the return value is 'true', the story will continue.<br />
condition = function(event, story)<br />
if event.tick > 100 then<br />
return true<br />
end<br />
end,<br />
<br />
--Action to perform after condition is met<br />
action = function(event, story)<br />
game.print("You completed the objective!")<br />
end<br />
},<br />
{<br />
--Second story event - example.<br />
init = function(event, story)<br />
game.print("Collect 100 iron plate")<br />
end,<br />
condition = function(event, story)<br />
return game.players[1].get_item_count("iron-plate") >= 100<br />
end,<br />
action = function(event, story)<br />
game.print("Well done")<br />
end<br />
}<br />
--Once the end of a branch is reached, the story is finished.<br />
--The game will now display the mission complete screen.<br />
},<br />
{<br />
--branch 2<br />
}<br />
}<br />
<br />
--Init the helpers and story table. Must be done all times script is loaded.<br />
story_init_helpers(story_table)</source><br />
<br />
Branches are an optional system of the story system, and you can jump to another branch using <code>story_jump_to(story, name)</code>. The story progresses from the top down, and when it reaches the last story event, the mission concludes.<br />
<br />
It is possible to leverage any number of clever Lua tricks and API calls in the story table. It is good form to try and keep each story part independant from its neighbors, as it makes maintanance and reworkings more manageable.<br />
<br />
Bad:<br />
<br />
<source lang="lua"> {<br />
action = function()<br />
player().insert("iron-plate")<br />
end<br />
},<br />
{<br />
init = function()<br />
player().print("Use your iron plate to craft some belts")<br />
end<br />
}</source><br />
Good:<br />
<br />
<source lang="lua"> {<br />
init = function()<br />
player().insert("iron-plate")<br />
player().print("Use your iron plate...")<br />
end<br />
}</source><br />
<br />
There are some utility functions to make things simpler on the scripting side:<br />
<br />
<source lang="lua">--Return true only after this many seconds has elasped<br />
story_elapsed_check(5)<br />
<br />
--Update the objective for all players<br />
set_goal({"objective-1"})<br />
<br />
--Flash the goal GUI for players (updating info doesn't flash it)<br />
flash_goal()<br />
<br />
--Update the 'info gui' for all players. This is quite powerful and can use custom function to build complex GUI's<br />
set_info(<br />
{<br />
text = {"info-1"},<br />
picture = "item/iron-plate"<br />
})<br />
<br />
--Exports entities in a Lua table format<br />
export_entities(parameters)<br />
<br />
--Recreates entities saved using a Lua format<br />
recreate_entities(entities, parameters)<br />
<br />
--Shorthand syntax for game.players[i], defaults i to 1<br />
player(i)<br />
<br />
--Shorthand syntax for game.surfaces[i], defaults i to 1<br />
surface(i)</source></div>Klonanhttps://wiki.factorio.com/index.php?title=User:Klonan/Designs&diff=158633User:Klonan/Designs2018-04-26T18:49:57Z<p>Klonan: /* Simple setup with burner inserters */</p>
<hr />
<div>The following is a page of personal designs and blueprints I want to preserve more effectively.<br />
I have a problem in that when I change builds and branches and go from dev build to normal, all my blueprint libraries die.<br />
<br />
<br />
== Smelting ==<br />
<br />
=== Simple setup with burner inserters ===<br />
<br />
[https://i.imgur.com/gm5FMmF.png Image]<br />
<br />
This uses burner inserters to insert the coal and iron on one side, and normal inserters to take the plates out the other side.<br />
<br />
If coal runs low, the burner inserters can run out of fuel while picking up ore, leading to the whole system stalling and requiring manual fixing.<br />
<br />
{{BlueprintString|bp-string=0eNqVl+tugyAYhu+F39oIiqdbWZZFLVtILBrEZU3jvQ/r1nar4ssv4+F7eFA+83IhdTuKXktlSHkhsunUQMqXCxnkh6ra+Zo594KURBpxIgFR1Wk+M7pSQ99pE9aiNWQKiFRH8UVKOgW7xYPplAjfR62qRjzUsuk1IEIZaaRYLK4n5zc1nmqhLfyGGG2F/tCdPS4GAem7wRZ2ah7WwkIekLM9xJZ/lFo0yz0W/Dp1o+nHWf1pGLY1zedB4vVBVqAxDk1gaIJDKQzlOJTB0BSG4qIZzIxgZg4z8U9fwEz8fdIIhnIcSmEovkYp22j8lW46/LhGBz6toe5NVFuI0KFUg9DG3ttsTbYKSmAnuufEPZyoyylFnaI9pQxXchrlqBHbMypwI9d3YxFqlOwYMYobcZfRfXXvrkW6Criv6eFUtW0oWttNWjZh37Vi85+7zkoQGeoAcADgqk/9JuOaSwaouN5rDtRzR33hN5V0GxVH/rmF/f2xprfYItVGaompb2z5P8YalPnGFgQa+8YWBJr4xhYEyj1jC8JMPWMLwsw8YwvCzD1jC8IsPFMLwEwiz9DyxLS7jusGpXzYDAXkU+hheSDPGC0iytN8mr4B71Nf/Q== }}<br />
<br />
{| class="wikitable"<br />
|-<br />
! Advantages !! Disadvantages<br />
|-<br />
| Input works without electricity || Input can stall on low coal input<br />
|-<br />
| Only requires one side of electric poles || Only outputs to 1 side<br />
|-<br />
| || Only uses half the belt for ore<br />
|-<br />
|}</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Klonan&diff=158632User:Klonan2018-04-26T18:30:06Z<p>Klonan: I hate that just clicking and it suddenly does something</p>
<hr />
<div>I am the Factorio community manager</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Klonan&diff=158631User:Klonan2018-04-26T18:29:20Z<p>Klonan: Reverted edits by Klonan (talk) to last revision by Slpwnd</p>
<hr />
<div>xxxhi my name is somewhere in between the two names of which I am cuirrently knowing.</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Klonan/Designs&diff=158624User:Klonan/Designs2018-04-26T13:13:59Z<p>Klonan: micro</p>
<hr />
<div>The following is a page of personal designs and blueprints I want to preserve more effectively.<br />
I have a problem in that when I change builds and branches and go from dev build to normal, all my blueprint libraries die.<br />
<br />
<br />
== Smelting ==<br />
<br />
=== Simple setup with burner inserters ===<br />
: [[File:Early smelting.png]] <br />
<br />
This uses burner inserters to insert the coal and iron on one side, and normal inserters to take the plates out the other side.<br />
<br />
If coal runs low, the burner inserters can run out of fuel while picking up ore, leading to the whole system stalling and requiring manual fixing.<br />
<br />
{{BlueprintString|bp-string=0eNqVl+tugyAYhu+F39oIiqdbWZZFLVtILBrEZU3jvQ/r1nar4ssv4+F7eFA+83IhdTuKXktlSHkhsunUQMqXCxnkh6ra+Zo594KURBpxIgFR1Wk+M7pSQ99pE9aiNWQKiFRH8UVKOgW7xYPplAjfR62qRjzUsuk1IEIZaaRYLK4n5zc1nmqhLfyGGG2F/tCdPS4GAem7wRZ2ah7WwkIekLM9xJZ/lFo0yz0W/Dp1o+nHWf1pGLY1zedB4vVBVqAxDk1gaIJDKQzlOJTB0BSG4qIZzIxgZg4z8U9fwEz8fdIIhnIcSmEovkYp22j8lW46/LhGBz6toe5NVFuI0KFUg9DG3ttsTbYKSmAnuufEPZyoyylFnaI9pQxXchrlqBHbMypwI9d3YxFqlOwYMYobcZfRfXXvrkW6Criv6eFUtW0oWttNWjZh37Vi85+7zkoQGeoAcADgqk/9JuOaSwaouN5rDtRzR33hN5V0GxVH/rmF/f2xprfYItVGaompb2z5P8YalPnGFgQa+8YWBJr4xhYEyj1jC8JMPWMLwsw8YwvCzD1jC8IsPFMLwEwiz9DyxLS7jusGpXzYDAXkU+hheSDPGC0iytN8mr4B71Nf/Q== }}<br />
<br />
{| class="wikitable"<br />
|-<br />
! Advantages !! Disadvantages<br />
|-<br />
| Input works without electricity || Input can stall on low coal input<br />
|-<br />
| Only requires one side of electric poles || Only outputs to 1 side<br />
|-<br />
| || Only uses half the belt for ore<br />
|-<br />
|}</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Klonan/Designs&diff=158622User:Klonan/Designs2018-04-26T13:11:07Z<p>Klonan: Move from other page</p>
<hr />
<div>Smelting ores into plates is one the fundamental processes in Factorio.<br />
<br />
Factorio is a creative game, there are endless ways to build things, ways to arrange and adjust the different elements that make up a specific factories layout.<br />
The following are just some examples, with some description of what we are seeing.<br />
<br />
'''Nothing here claims to be the best, most optimal, or preferred way of doing things.'''<br />
<br />
<br />
<br />
== Early game ==<br />
<br />
=== Simple setup with burner inserters ===<br />
: [[File:Early smelting.png]] <br />
<br />
This uses burner inserters to insert the coal and iron on one side, and normal inserters to take the plates out the other side.<br />
<br />
If coal runs low, the burner inserters can run out of fuel while picking up ore, leading to the whole system stalling and requiring manual fixing.<br />
<br />
{{BlueprintString|bp-string=0eNqVl+tugyAYhu+F39oIiqdbWZZFLVtILBrEZU3jvQ/r1nar4ssv4+F7eFA+83IhdTuKXktlSHkhsunUQMqXCxnkh6ra+Zo594KURBpxIgFR1Wk+M7pSQ99pE9aiNWQKiFRH8UVKOgW7xYPplAjfR62qRjzUsuk1IEIZaaRYLK4n5zc1nmqhLfyGGG2F/tCdPS4GAem7wRZ2ah7WwkIekLM9xJZ/lFo0yz0W/Dp1o+nHWf1pGLY1zedB4vVBVqAxDk1gaIJDKQzlOJTB0BSG4qIZzIxgZg4z8U9fwEz8fdIIhnIcSmEovkYp22j8lW46/LhGBz6toe5NVFuI0KFUg9DG3ttsTbYKSmAnuufEPZyoyylFnaI9pQxXchrlqBHbMypwI9d3YxFqlOwYMYobcZfRfXXvrkW6Criv6eFUtW0oWttNWjZh37Vi85+7zkoQGeoAcADgqk/9JuOaSwaouN5rDtRzR33hN5V0GxVH/rmF/f2xprfYItVGaompb2z5P8YalPnGFgQa+8YWBJr4xhYEyj1jC8JMPWMLwsw8YwvCzD1jC8IsPFMLwEwiz9DyxLS7jusGpXzYDAXkU+hheSDPGC0iytN8mr4B71Nf/Q== }}<br />
<br />
{| class="wikitable"<br />
|-<br />
! Advantages !! Disadvantages<br />
|-<br />
| Input works without electricity || Input can stall on low coal input<br />
|-<br />
| Only requires one side of electric poles || Only outputs to 1 side<br />
|-<br />
| || Only uses half the belt for ore<br />
|-<br />
|}<br />
<br />
== Mid game ==<br />
<br />
Typical ugly style:<br />
[[Picture of arumba and steejo]]<br />
<br />
== Late game ==<br />
<br />
=== Bots ===<br />
<br />
Bleh<br />
<br />
=== Beacons ===<br />
<br />
Double bleh</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:AlexTFish&diff=143539User talk:AlexTFish2017-08-10T13:49:28Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br><br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br><br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. In addition to the help provided by MW, we also provide a [[Factorio:Style guide|style guide]] that we enforce. <br><br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br><br />
Again, welcome, we hope you contribute as much high quality information as you can. :) [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 13:49, 10 August 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:AlexTFish&diff=143538User:AlexTFish2017-08-10T13:49:28Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>A computer programmer, gamer and Christian, from Cambridge, UK.<br />
<br />
Proved that the card game Magic: the Gathering is Turing complete.<br />
<br />
Designer of the board game Steam Works (published in 2015 by Tasty Minstrel Games). Creator and admin of the custom Magic card design website MagicMultiverse.net.</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:MG42&diff=140691User talk:MG422017-07-04T09:37:42Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 09:37, 4 July 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:MG42&diff=140690User:MG422017-07-04T09:37:42Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>A player who just touched the game.On the way</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:Christheboss894&diff=140689User talk:Christheboss8942017-07-04T09:37:34Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 09:37, 4 July 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Christheboss894&diff=140688User:Christheboss8942017-07-04T09:37:34Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>i am a Factorio player that aims to get better at the game and help other players understand the game more. i have been playing Factorio since early 2014 and i have made my own mod (i really just copied the code from an oil refinery processing recipe and made it require coal and water and it would make crude oil after a long time), i love Factorio, it is my favourite game. <br />
<br />
this is the end of my Personal biography, bye!</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:BlakBat&diff=138470User talk:BlakBat2017-06-05T15:44:39Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 15:44, 5 June 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:BlakBat&diff=138469User:BlakBat2017-06-05T15:44:39Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>I like to test things in-game: theory vs practice ;-)</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:Joeyg1999&diff=138454User talk:Joeyg19992017-06-05T10:17:28Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 10:17, 5 June 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Joeyg1999&diff=138453User:Joeyg19992017-06-05T10:17:28Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>I just wanna play this fun game my way with mods</div>Klonanhttps://wiki.factorio.com/index.php?title=Multiplayer&diff=138423Multiplayer2017-06-03T15:48:13Z<p>Klonan: </p>
<hr />
<div>{{Languages}}<br />
<br />
In addition to being a single-player game, Factorio also supports multiplayer, allowing many players to cooperate and assist each other, or work against each other in pvp. This page documents how to set up a multiplayer game, and how to join one. 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&sid=93d1fbe9336d31d6bac60847b6c97985 Maps and Scenarios forum].<br />
<br />
== Setting Up a Multiplayer Game ==<br />
<br />
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.<br />
<br />
Use the ''Multiplayer'' button in the ''Play'' menu to start playing a multiplayer game, choose ''New'' or ''Load'' or ''Scenarios'' to host and play, or ''Browse'' or ''Play on LAN'' to connect to an already-running game. The host can also choose not to advertise the game at all, in which case you'll need the server's (public or otherwise reachable) IP address; you can then ''Connect'' directly to that to join the game.<br />
<br />
Notes and tips:<br />
<br />
* All game instances need the installation of ''exactly the same'' game-versions and mods.<br />
* Factorio servers use port '''34197'''. The port can be changed in the [[Application Directory|config]] file.<br />
* Factorio uses '''UDP only'''. Make sure you configure your router's port forwarding correctly. (The game builds its own "reliable delivery" layer built on UDP to deal with packet loss and reordering issues.)<br />
** Make sure there is no firewall or anti-virus blocking the UDP-packets.<br />
* The hard limit for the number of players is [https://forums.factorio.com/viewtopic.php?f=53&t=6481&p=50661#p50586 65,535]. However, practical limit for this is much lower, popular streamers have managed slightly over a hundred players.<br />
<br />
=== Dedicated/Headless server ===<br />
<br />
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.<br />
<br />
In the headless mode:<br />
* Graphics are not initialized (faster start up, less memory usage, works on completely headless servers)<br />
* Game starts immediately and loads a save given as a parameter to the command<br />
* The server has no character in game<br />
* Game is paused while there are no players connected (though this can be overridden using the --no-auto-pause option)<br />
* Saves the game on exit (and autosaves normally)<br />
<br />
''Please note that there has been a slight change between 0.12, 0.13 and 0.14 in how --start-server (and others) interpret the given parameter. Version 0.12 expected --start-server to be followed by a save name, that was to be found in the saves directory. 0.13 instead expects --start-server to be followed by a path to a save file. I.e. if you did '''factorio --start-server foo''' in 0.12, you probably want to use '''factorio --start-server saves/foo.zip''' in 0.13.''<br />
<br />
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:<br />
<br />
<pre><br />
./bin/x64/factorio --create ./saves/my-save.zip # This creates a new save, as if by clicking the New Game button in the GUI<br />
</pre><br />
<br />
<pre><br />
./bin/x64/factorio --start-server ./saves/my-save.zip # This starts a server that will host the file created on the previous line<br />
</pre><br />
<br />
Starting with version 0.13, --create also accepts --map-gen-settings if you want to use non-default map generation. To use it, create a file with the desired map settings (see the file data/map-gen-settings.example.json for an example), and run:<br />
<pre>factorio --create saves/my-save.zip --map-gen-settings path-to-file-with-desired-map-generation-settings.json</pre><br />
<br />
Starting with version 0.14.12, factorio has moved some command-line options into the server-settings.json file. Starting 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:<br />
<br />
<pre>./factorio --start-server-load-latest --server-settings ./data/server-settings.json</pre><br />
<br />
=== Setting up a Linux Factorio server ===<br />
<br />
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.<br />
<br />
The guide assumes you will install the headless server under '''/opt/factorio''', 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.<br />
<br />
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/stable 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.<br />
<br />
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)<br />
<br />
You can use the [https://github.com/Bisa/factorio-init Linux factorio-init script] to start/stop your headless server in a much better way. The script will ensure you only ever use the most recent save when your server starts (even if that was an auto-save) while also letting you set a number of other settings like Autosave frequency and Latency settings. This script will also simplify updating the server when combined with the [https://github.com/narc0tiq/factorio-updater Linux factorio-updater script].<br />
<br />
* Download the selected package -- either full game or the headless package -- and upload the Linux tar.gz package to your server /tmp<br />
* Extract the package in /tmp to /opt/factorio<br />
<pre><br />
$cd /opt/<br />
<br />
$sudo tar -xzf /tmp/factorio.tar.gz # Use the correct file name. It includes the factorio version number.</pre><br />
<br />
* 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)<br />
<pre><br />
$useradd factorio<br />
$chown -R factorio:factorio /opt/factorio</pre><br />
<br />
* Try the binary<br />
<pre><br />
$su factorio<br />
$/opt/factorio/bin/x64/factorio --start-server savename</pre><br />
<br />
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.<br />
<br />
=== How to list a server-hosted game on the matching server ===<br />
<br />
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 ''server settings file''.<br />
<br />
To create a server settings file, look at the example file located in '''data/server-settings.example.json''' in the Factorio [[Application Directory]]. The recommended way is to make a copy of this example file and edit the copy.<br />
<br />
The following values can be changed:<br />
; Name: This will be the name under which the server will be listed in the server browser<br />
; Description: A brief description of your server<br />
; Tags: A list of game tags<br />
; 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.<br />
* Visibility for server browser: May be either public, LAN or hidden.<br />
** Public: The server will appear in the public server list. This requires the login credentials below to be filled in.<br />
** LAN: The server will not appear in the public server list, but will be available through the Play On LAN button<br />
** Hidden: Clients will have to connect using the server's IP address<br />
* User credentials using a username and password or authentication token: These are necessary if you wish to make the server public. Otherwise, they can be left empty.<br />
** 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.<br />
* Server Password<br />
** Field name is game_password<br />
* Whether to verify user identity<br />
(There are additional values in v0.14 of factorio.)<br />
<br />
=== Technical Implementation Details ===<br />
<br />
Notes about some technical details surrounding multiplayer have been published by the development team in several Friday Facts blog posts:<br />
<br />
* [http://www.factorio.com/blog/post/fff-76 Lock step architecture]<br />
* [http://www.factorio.com/blog/post/fff-99 Client-server connections]<br />
* [http://www.factorio.com/blog/post/fff-143 NAT punching, introduced in 0.13]<br />
<br />
=== More Guides ===<br />
<br />
* [https://www.chef.io/blog/2016/03/21/building-a-factorio-multiplayer-server-on-digital-ocean/ How to set up Factorio server with cookbook]<br />
* [http://youtube.com/watch?v=MqsqRWNsbPM How To set up a Factorio Multiplayer Server | Guide | Tutorial], by Teaspoon<br />
* [https://forums.factorio.com/viewtopic.php?f=53&t=6720 Tips to connect in multiplayer], by Nondre<br />
<br />
=== Miscellaneous Tips ===<br />
* The key for [[Console|Console commands]] is also used initiate chat in multiplayer. To execute a command instead of chatting, you need to type ''/c'' before the command. Commands executed are ''visible to all players''. Additionally, the multiplayer game must have been started with commands allowable for commands to work.<br />
* Set the player's color using the command<br />
/c game.players["player_name"].color = {r=0.7, g=0.5, b=0.1, a=0.9}<br />
r, g and b are for red, green and blue respectively (possible values are between 0 and 1, use the right-most column on http://prideout.net/archive/colors.php to convert colors to rgb numbers). a is alpha channel aka transparency of the color to the base texture.<br />
<br />
== Joining a Multiplayer game ==<br />
<br />
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.<br />
<br />
Players wishing to join a game may do so in multiple ways:<br />
<br />
* Joining by directly inputting a public IP and port into Factorio.<br />
* Selecting the server from the active public server menu.<br />
* Joining through Steam's services.<br />
* Playing a local LAN game.<br />
<br />
It is recommended that players use voice chat (TeamSpeak, Discord, Mumble) because you need to talk a lot to coordinate connections, building, handling attacks, etc. TeamSpeak servers are posted in the [https://forums.factorio.com/viewforum.php?f=53 multiplayer forum]. The public Discord of the Factorio community can be found [https://discord.gg/yGQWgy5 here].<br />
<br />
=== Joining by IP ===<br />
<br />
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 -> Multiplayer -> Connect to server, and provide all the information it asks for.<br />
<br />
If the server has been set up correctly to accept public connections, you should be able to join the game.<br />
<br />
=== Joining via server list ===<br />
<br />
Factorio'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 -> Multiplayer -> Browse public games. Provide your Factorio.com login if asked, and a list of public servers will appear. Simply select one.<br />
<br />
=== Joining through Steam ===<br />
<br />
Steam provides a "game invite" system, simply use that to join. You can find more info about how to use steam in it's documentation. ''This is the most recommended way for the average player to use multiplayer with their friends, as it allows Steam to handle everything''.<br />
<br />
=== Joining a local LAN game ===<br />
<br />
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 -> Multiplayer -> Play on LAN.<br />
<br />
=== Finding Other Players ===<br />
<br />
* Use the [https://forums.factorio.com/viewforum.php?f=53 multiplayer board in the forum].<br />
* Many players use other software like Evolve to meet other players. This also has the "advantage" of creating a virtual LAN among the players. See down under software.<br />
* Some also use [https://forums.factorio.com/viewtopic.php?f=5&t=9136 Steam] to find other players.<br />
* There is an external [http://serverlist.lgms.nl/ server browser] with various search options.<br />
* Tell your friends to buy Factorio, then play with them!<br />
<br />
<br />
=== Connecting to a Server Behind NAT ===<br />
<br />
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.<br />
<br />
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).<br />
<br />
* [https://forums.factorio.com/viewtopic.php?f=53&t=6393 Forwarding ports without logging into your router]<br />
* [https://forums.factorio.com/viewtopic.php?f=53&t=7714 A guide for connecting with Evolve]<br />
* [http://steamcommunity.com/sharedfiles/filedetails/?id=653628496 A guide for connecting with Hamachi]<br />
<br />
== PvP ==<br />
<br />
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's [[Turret|turrets]] and [[Combat Robot Capsules|combat bots]] 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.<br />
<br />
To start a PvP game, you can select the 'PvP' scenario from the 'Play' menu, or download a custom scenario which also supports PvP.<br />
<br />
After downloading a PvP scenario, you need to move it to your application directory, and create the multiplayer game using the scenario.<br />
<br />
# Download the scenario and place the scenario directory in the ''scenarios'' directory within your [[Application_directory#Directory_locations_by_OS_and_installation_method|user data directory]].<br />
# Launch Factorio<br />
# Click ''Play''<br />
# Click ''Multiplayer''<br />
# Click ''Scenario''<br />
# Choose the PvP scenario you want and click ''Create''<br />
# Choose latency and other settings, then click ''Play''<br />
# Other players can now join the game<br />
<br />
=== Forces ===<br />
<br />
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.<br />
<br />
Each created force has its own research progression and different forces may attack each other.<br />
<br />
The console commands for setting up and controlling forces are below:<br />
<br />
<pre><br />
game.create_force("Name")<br />
--Creates the force "Name"<br />
<br />
game.players["Player_name"].force = game.forces["Name"]<br />
--Sets this player to the new force<br />
<br />
game.forces["Name"].set_cease_fire("Other_force_name", true)<br />
--Sets the new force ceasefire to the "other force"<br />
<br />
game.forces["Name"].set_spawn_position({x = 10, y = 20}, game.surfaces[1])<br />
--Sets the spawn position of the force<br />
<br />
game.print(#game.forces)<br />
--Prints the number of forces<br />
<br />
for name, force in pairs (game.forces) do<br />
game.print(name)<br />
end<br />
--Prints the name of all the forces<br />
</pre><br />
<br />
<br />
== History ==<br />
<br />
=== Narrative history ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
As of version 0.12.0, the game features "latency hiding" mechanics where the game simulates some of the player's actions locally to make some common interactions (such as moving the player's character) more fluid. Latency hiding is enabled by default, but it can be enabled or disabled in Options → Other → Enable multiplayer latency hiding. Not every action is a part of latency hiding – most notably, car or train driving and shooting are not a part of it. It is recommended to keep this on, as many actions will be very stuttery on a low end internet connection.<br />
<br />
=== Version history ===<br />
<br />
Maintainer note: The following history may not be fully up to date, or comprehensive. Factorio's multiplayer has undergone a great deal of small changes since its inception, however this history will provide a rough overview.<br />
<br />
{{history|0.14.14|<br />
* Added multiplayer server option "Autosave only on server".<br />
* Deconstructing/canceling deconstruction sets the "last user" on an entity.<br />
* Decreased the size of connection accept message with lot of mod which could help some people with 50+ mod multiplayer games.<br />
}}<br />
<br />
{{history|0.14.13|<br />
* 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.}}<br />
<br />
{{history|0.14.11|<br />
* Multiplayer user names can only consist of letters, and <code> -_. </code> characters.}}<br />
<br />
{{history|0.14.10|<br />
* Disabled 32bit (x86) multiplayer. All hosts and members must be running the 64bit (x86_64) version of the game.}}<br />
<br />
{{history|0.14.8|<br />
* More than 10 players in one game will reduce the rate the game is saved to the server.}}<br />
<br />
{{history|0.14.6|<br />
* Username is now set to username setting, not email.}}<br />
<br />
{{history|0.14.5|<br />
* Added AFK Auto kick interval to multiplayer host settings (with never as default).}}<br />
<br />
{{history|0.14.3|<br />
* When save of scenario is loaded in multiplayer, it's scenario is saved in user scenarios.<br />
* Added <code>/time</code> command to print the current map age.<br />
* Added option to host multiplayer game with scenario (it only had new game/load game there).<br />
}}<br />
<br />
{{history|0.14.2|<br />
* Can specify limit of upload speed when hosting.}}<br />
<br />
{{history|0.14.0|<br />
* Server doesn't stop/slow down the game when some client is too slow, stops communicating or saves the game longer than the server.<br />
* Players automatically quit game after 3 desyncs.<br />
* Removed the option to enable/disable latency hiding, it is always on on clients (and off on the server).<br />
}}<br />
<br />
{{history|0.13.10|<br />
* Server stdout messages now contain time stamps and message-type tags}}<br />
<br />
{{history|0.13.2|<br />
* Limit multiplayer player name to 60 characters.}}<br />
<br />
{{history|0.13.0|<br />
* Improved Multiplayer game UX<br />
* Server games are published to the server and clients can browse existing games.<br />
* Removed multiplayer peer-to-peer mode.<br />
* Building sound is played also for other players in multiplayer.<br />
}}<br />
<br />
{{history|0.12.31|<br />
* Human readable error notice when multiplayer connection wasn't successful. (https://forums.factorio.com/23132)<br />
* Improved map download speed when connecting to multiplayer game.}}<br />
<br />
{{history|0.12.30|<br />
* 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.}}<br />
<br />
{{history|0.12.28|<br />
* Added --port to specify which network port the game should use, when hosting with --start-server or --mp-load-game.}}<br />
<br />
{{history|0.12.27|<br />
* The report of different mods when trying to connect to multiplayer game is now scroll-able when needed.<br />
* Better message when the server leaves a multiplayer game}}<br />
<br />
{{history|0.12.11|<br />
* Added --no-auto-pause: When running as a server, --no-auto-pause will prevent stopping the game when no players are connected.}}<br />
<br />
{{history|0.12.9|<br />
* Added resume button to multiplayer game menu}}<br />
<br />
{{history|0.12.7|<br />
*New command line options for the headless server: --disallow-commands and --peer-to-peer}}<br />
<br />
{{history|0.12.5|<br />
* Multiplayer broadcast (heartbeats) is done via a single message when not using peer2peer.<br />
* Further optimizations in size of the Multiplayer heartbeat (message sent every tick).<br />
* LatencyState is suspended when player is killed (and waiting for respawn) in Multiplayer.<br />
}}<br />
<br />
{{history|0.12.4|<br />
* Simple mechanism for multiplayer relaying via the server.<br />
* Less annoying glitches when running and shooting in multiplayer with latency hiding.}}<br />
<br />
{{history|0.12.0|<br />
* Multiplayer latency hiding (gives impression that some common tasks are performed immediately)<br />
* Factorio can run as a dedicated server without graphics (http://www.factorioforums.com/wiki/index.php?title=Multiplayer#Headless_server).<br />
* Basic PvP: New forces can now be created and merged back together; a cease-fire can be agreed upon between forces<br />
* IPv6 support for multiplayer.<br />
* DNS names can be used when connecting to multiplayer game.<br />
* Player's logistic filters are now remembered after respawn in multiplayer<br />
* Smaller multiplayer heartbeat packet size.<br />
}}<br />
<br />
<br />
{{history|0.11.19|<br />
* Multiplayer dropping threshold is doubled during map upload / download.}}<br />
<br />
{{history|0.11.17|<br />
* Autosaves in multiplayer are performed at the same time by all clients (interval is set by hosting player).<br />
* Progress bar is shown when non-responsive peers are about to be dropped from the game in the Multiplayer.<br />
* Progress bar is shown when other peers in multiplayer are saving map.}}<br />
<br />
{{history|0.11.16|<br />
* Revived character (after dying in multiplayer) are placed on the spawn point instead of the center of the map.}}<br />
<br />
{{history|0.11.2|<br />
* Mods that don't affect game state are not needed to be synchronized when playing multiplayer game or replaying game.}}<br />
<br />
{{history|0.11.0|<br />
* Introduced}}</div>Klonanhttps://wiki.factorio.com/index.php?title=Multiplayer&diff=138422Multiplayer2017-06-03T15:45:59Z<p>Klonan: /* PvP */</p>
<hr />
<div>{{Languages}}<br />
<br />
In addition to being a single-player game, Factorio also supports multiplayer, allowing many players to cooperate and assist each other, or work against each other in pvp. This page documents how to set up a multiplayer game, and how to join one. 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&sid=93d1fbe9336d31d6bac60847b6c97985 Maps and Scenarios forum].<br />
<br />
== Setting Up a Multiplayer Game ==<br />
<br />
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.<br />
<br />
Use the ''Multiplayer'' button in the ''Play'' menu to start playing a multiplayer game, choose ''New'' or ''Load'' or ''Scenarios'' to host and play, or ''Browse'' or ''Play on LAN'' to connect to an already-running game. The host can also choose not to advertise the game at all, in which case you'll need the server's (public or otherwise reachable) IP address; you can then ''Connect'' directly to that to join the game.<br />
<br />
Notes and tips:<br />
<br />
* All game instances need the installation of ''exactly the same'' game-versions and mods.<br />
* Factorio servers use port '''34197'''. The port can be changed in the [[Application Directory|config]] file.<br />
* Factorio uses '''UDP only'''. Make sure you configure your router's port forwarding correctly. (The game builds its own "reliable delivery" layer built on UDP to deal with packet loss and reordering issues.)<br />
** Make sure there is no firewall or anti-virus blocking the UDP-packets.<br />
* The hard limit for the number of players is [https://forums.factorio.com/viewtopic.php?f=53&t=6481&p=50661#p50586 65,535]. However, practical limit for this is much lower, popular streamers have managed slightly over a hundred players.<br />
<br />
=== Dedicated/Headless server ===<br />
<br />
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.<br />
<br />
In the headless mode:<br />
* Graphics are not initialized (faster start up, less memory usage, works on completely headless servers)<br />
* Game starts immediately and loads a save given as a parameter to the command<br />
* The server has no character in game<br />
* Game is paused while there are no players connected (though this can be overridden using the --no-auto-pause option)<br />
* Saves the game on exit (and autosaves normally)<br />
<br />
''Please note that there has been a slight change between 0.12, 0.13 and 0.14 in how --start-server (and others) interpret the given parameter. Version 0.12 expected --start-server to be followed by a save name, that was to be found in the saves directory. 0.13 instead expects --start-server to be followed by a path to a save file. I.e. if you did '''factorio --start-server foo''' in 0.12, you probably want to use '''factorio --start-server saves/foo.zip''' in 0.13.''<br />
<br />
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:<br />
<br />
<pre><br />
./bin/x64/factorio --create ./saves/my-save.zip # This creates a new save, as if by clicking the New Game button in the GUI<br />
</pre><br />
<br />
<pre><br />
./bin/x64/factorio --start-server ./saves/my-save.zip # This starts a server that will host the file created on the previous line<br />
</pre><br />
<br />
Starting with version 0.13, --create also accepts --map-gen-settings if you want to use non-default map generation. To use it, create a file with the desired map settings (see the file data/map-gen-settings.example.json for an example), and run:<br />
<pre>factorio --create saves/my-save.zip --map-gen-settings path-to-file-with-desired-map-generation-settings.json</pre><br />
<br />
Starting with version 0.14.12, factorio has moved some command-line options into the server-settings.json file. Starting 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:<br />
<br />
<pre>./factorio --start-server-load-latest --server-settings ./data/server-settings.json</pre><br />
<br />
== PvP ==<br />
<br />
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's [[Turret|turrets]] and [[Combat Robot Capsules|combat bots]] 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.<br />
<br />
To start a PvP game, you can select the 'PvP' scenario from the 'Play' menu, or download a custom scenario which also supports PvP.<br />
<br />
After downloading a PvP scenario, you need to move it to your application directory, and create the multiplayer game using the scenario.<br />
<br />
# Download the scenario and place the scenario directory in the ''scenarios'' directory within your [[Application_directory#Directory_locations_by_OS_and_installation_method|user data directory]].<br />
# Launch Factorio<br />
# Click ''Play''<br />
# Click ''Multiplayer''<br />
# Click ''Scenario''<br />
# Choose the PvP scenario you want and click ''Create''<br />
# Choose latency and other settings, then click ''Play''<br />
# Other players can now join the game<br />
<br />
=== Forces ===<br />
<br />
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.<br />
<br />
Each created force has its own research progression and different forces may attack each other.<br />
<br />
The console commands for setting up and controlling forces are below:<br />
<br />
<pre><br />
game.create_force("Name")<br />
--Creates the force "Name"<br />
<br />
game.players["Player_name"].force = game.forces["Name"]<br />
--Sets this player to the new force<br />
<br />
game.forces["Name"].set_cease_fire("Other_force_name", true)<br />
--Sets the new force ceasefire to the "other force"<br />
<br />
game.forces["Name"].set_spawn_position({x = 10, y = 20}, game.surfaces[1])<br />
--Sets the spawn position of the force<br />
<br />
game.print(#game.forces)<br />
--Prints the number of forces<br />
<br />
for name, force in pairs (game.forces) do<br />
game.print(name)<br />
end<br />
--Prints the name of all the forces<br />
</pre><br />
<br />
=== Setting up a Linux Factorio server ===<br />
<br />
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.<br />
<br />
The guide assumes you will install the headless server under '''/opt/factorio''', 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.<br />
<br />
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/stable 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.<br />
<br />
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)<br />
<br />
You can use the [https://github.com/Bisa/factorio-init Linux factorio-init script] to start/stop your headless server in a much better way. The script will ensure you only ever use the most recent save when your server starts (even if that was an auto-save) while also letting you set a number of other settings like Autosave frequency and Latency settings. This script will also simplify updating the server when combined with the [https://github.com/narc0tiq/factorio-updater Linux factorio-updater script].<br />
<br />
* Download the selected package -- either full game or the headless package -- and upload the Linux tar.gz package to your server /tmp<br />
* Extract the package in /tmp to /opt/factorio<br />
<pre><br />
$cd /opt/<br />
<br />
$sudo tar -xzf /tmp/factorio.tar.gz # Use the correct file name. It includes the factorio version number.</pre><br />
<br />
* 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)<br />
<pre><br />
$useradd factorio<br />
$chown -R factorio:factorio /opt/factorio</pre><br />
<br />
* Try the binary<br />
<pre><br />
$su factorio<br />
$/opt/factorio/bin/x64/factorio --start-server savename</pre><br />
<br />
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.<br />
<br />
=== How to list a server-hosted game on the matching server ===<br />
<br />
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 ''server settings file''.<br />
<br />
To create a server settings file, look at the example file located in '''data/server-settings.example.json''' in the Factorio [[Application Directory]]. The recommended way is to make a copy of this example file and edit the copy.<br />
<br />
The following values can be changed:<br />
; Name: This will be the name under which the server will be listed in the server browser<br />
; Description: A brief description of your server<br />
; Tags: A list of game tags<br />
; 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.<br />
* Visibility for server browser: May be either public, LAN or hidden.<br />
** Public: The server will appear in the public server list. This requires the login credentials below to be filled in.<br />
** LAN: The server will not appear in the public server list, but will be available through the Play On LAN button<br />
** Hidden: Clients will have to connect using the server's IP address<br />
* User credentials using a username and password or authentication token: These are necessary if you wish to make the server public. Otherwise, they can be left empty.<br />
** 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.<br />
* Server Password<br />
** Field name is game_password<br />
* Whether to verify user identity<br />
(There are additional values in v0.14 of factorio.)<br />
<br />
=== Technical Implementation Details ===<br />
<br />
Notes about some technical details surrounding multiplayer have been published by the development team in several Friday Facts blog posts:<br />
<br />
* [http://www.factorio.com/blog/post/fff-76 Lock step architecture]<br />
* [http://www.factorio.com/blog/post/fff-99 Client-server connections]<br />
* [http://www.factorio.com/blog/post/fff-143 NAT punching, introduced in 0.13]<br />
<br />
=== More Guides ===<br />
<br />
* [https://www.chef.io/blog/2016/03/21/building-a-factorio-multiplayer-server-on-digital-ocean/ How to set up Factorio server with cookbook]<br />
* [http://youtube.com/watch?v=MqsqRWNsbPM How To set up a Factorio Multiplayer Server | Guide | Tutorial], by Teaspoon<br />
* [https://forums.factorio.com/viewtopic.php?f=53&t=6720 Tips to connect in multiplayer], by Nondre<br />
<br />
=== Miscellaneous Tips ===<br />
* The key for [[Console|Console commands]] is also used initiate chat in multiplayer. To execute a command instead of chatting, you need to type ''/c'' before the command. Commands executed are ''visible to all players''. Additionally, the multiplayer game must have been started with commands allowable for commands to work.<br />
* Set the player's color using the command<br />
/c game.players["player_name"].color = {r=0.7, g=0.5, b=0.1, a=0.9}<br />
r, g and b are for red, green and blue respectively (possible values are between 0 and 1, use the right-most column on http://prideout.net/archive/colors.php to convert colors to rgb numbers). a is alpha channel aka transparency of the color to the base texture.<br />
<br />
== Joining a Multiplayer game ==<br />
<br />
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.<br />
<br />
Players wishing to join a game may do so in multiple ways:<br />
<br />
* Joining by directly inputting a public IP and port into Factorio.<br />
* Selecting the server from the active public server menu.<br />
* Joining through Steam's services.<br />
* Playing a local LAN game.<br />
<br />
It is recommended that players use voice chat (TeamSpeak, Discord, Mumble) because you need to talk a lot to coordinate connections, building, handling attacks, etc. TeamSpeak servers are posted in the [https://forums.factorio.com/viewforum.php?f=53 multiplayer forum]. The public Discord of the Factorio community can be found [https://discord.gg/yGQWgy5 here].<br />
<br />
=== Joining by IP ===<br />
<br />
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 -> Multiplayer -> Connect to server, and provide all the information it asks for.<br />
<br />
If the server has been set up correctly to accept public connections, you should be able to join the game.<br />
<br />
=== Joining via server list ===<br />
<br />
Factorio'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 -> Multiplayer -> Browse public games. Provide your Factorio.com login if asked, and a list of public servers will appear. Simply select one.<br />
<br />
=== Joining through Steam ===<br />
<br />
Steam provides a "game invite" system, simply use that to join. You can find more info about how to use steam in it's documentation. ''This is the most recommended way for the average player to use multiplayer with their friends, as it allows Steam to handle everything''.<br />
<br />
=== Joining a local LAN game ===<br />
<br />
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 -> Multiplayer -> Play on LAN.<br />
<br />
=== Finding Other Players ===<br />
<br />
* Use the [https://forums.factorio.com/viewforum.php?f=53 multiplayer board in the forum].<br />
* Many players use other software like Evolve to meet other players. This also has the "advantage" of creating a virtual LAN among the players. See down under software.<br />
* Some also use [https://forums.factorio.com/viewtopic.php?f=5&t=9136 Steam] to find other players.<br />
* There is an external [http://serverlist.lgms.nl/ server browser] with various search options.<br />
* Tell your friends to buy Factorio, then play with them!<br />
<br />
<br />
=== Connecting to a Server Behind NAT ===<br />
<br />
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.<br />
<br />
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).<br />
<br />
* [https://forums.factorio.com/viewtopic.php?f=53&t=6393 Forwarding ports without logging into your router]<br />
* [https://forums.factorio.com/viewtopic.php?f=53&t=7714 A guide for connecting with Evolve]<br />
* [http://steamcommunity.com/sharedfiles/filedetails/?id=653628496 A guide for connecting with Hamachi]<br />
<br />
<br />
== History ==<br />
<br />
=== Narrative history ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
As of version 0.12.0, the game features "latency hiding" mechanics where the game simulates some of the player's actions locally to make some common interactions (such as moving the player's character) more fluid. Latency hiding is enabled by default, but it can be enabled or disabled in Options → Other → Enable multiplayer latency hiding. Not every action is a part of latency hiding – most notably, car or train driving and shooting are not a part of it. It is recommended to keep this on, as many actions will be very stuttery on a low end internet connection.<br />
<br />
=== Version history ===<br />
<br />
Maintainer note: The following history may not be fully up to date, or comprehensive. Factorio's multiplayer has undergone a great deal of small changes since its inception, however this history will provide a rough overview.<br />
<br />
{{history|0.14.14|<br />
* Added multiplayer server option "Autosave only on server".<br />
* Deconstructing/canceling deconstruction sets the "last user" on an entity.<br />
* Decreased the size of connection accept message with lot of mod which could help some people with 50+ mod multiplayer games.<br />
}}<br />
<br />
{{history|0.14.13|<br />
* 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.}}<br />
<br />
{{history|0.14.11|<br />
* Multiplayer user names can only consist of letters, and <code> -_. </code> characters.}}<br />
<br />
{{history|0.14.10|<br />
* Disabled 32bit (x86) multiplayer. All hosts and members must be running the 64bit (x86_64) version of the game.}}<br />
<br />
{{history|0.14.8|<br />
* More than 10 players in one game will reduce the rate the game is saved to the server.}}<br />
<br />
{{history|0.14.6|<br />
* Username is now set to username setting, not email.}}<br />
<br />
{{history|0.14.5|<br />
* Added AFK Auto kick interval to multiplayer host settings (with never as default).}}<br />
<br />
{{history|0.14.3|<br />
* When save of scenario is loaded in multiplayer, it's scenario is saved in user scenarios.<br />
* Added <code>/time</code> command to print the current map age.<br />
* Added option to host multiplayer game with scenario (it only had new game/load game there).<br />
}}<br />
<br />
{{history|0.14.2|<br />
* Can specify limit of upload speed when hosting.}}<br />
<br />
{{history|0.14.0|<br />
* Server doesn't stop/slow down the game when some client is too slow, stops communicating or saves the game longer than the server.<br />
* Players automatically quit game after 3 desyncs.<br />
* Removed the option to enable/disable latency hiding, it is always on on clients (and off on the server).<br />
}}<br />
<br />
{{history|0.13.10|<br />
* Server stdout messages now contain time stamps and message-type tags}}<br />
<br />
{{history|0.13.2|<br />
* Limit multiplayer player name to 60 characters.}}<br />
<br />
{{history|0.13.0|<br />
* Improved Multiplayer game UX<br />
* Server games are published to the server and clients can browse existing games.<br />
* Removed multiplayer peer-to-peer mode.<br />
* Building sound is played also for other players in multiplayer.<br />
}}<br />
<br />
{{history|0.12.31|<br />
* Human readable error notice when multiplayer connection wasn't successful. (https://forums.factorio.com/23132)<br />
* Improved map download speed when connecting to multiplayer game.}}<br />
<br />
{{history|0.12.30|<br />
* 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.}}<br />
<br />
{{history|0.12.28|<br />
* Added --port to specify which network port the game should use, when hosting with --start-server or --mp-load-game.}}<br />
<br />
{{history|0.12.27|<br />
* The report of different mods when trying to connect to multiplayer game is now scroll-able when needed.<br />
* Better message when the server leaves a multiplayer game}}<br />
<br />
{{history|0.12.11|<br />
* Added --no-auto-pause: When running as a server, --no-auto-pause will prevent stopping the game when no players are connected.}}<br />
<br />
{{history|0.12.9|<br />
* Added resume button to multiplayer game menu}}<br />
<br />
{{history|0.12.7|<br />
*New command line options for the headless server: --disallow-commands and --peer-to-peer}}<br />
<br />
{{history|0.12.5|<br />
* Multiplayer broadcast (heartbeats) is done via a single message when not using peer2peer.<br />
* Further optimizations in size of the Multiplayer heartbeat (message sent every tick).<br />
* LatencyState is suspended when player is killed (and waiting for respawn) in Multiplayer.<br />
}}<br />
<br />
{{history|0.12.4|<br />
* Simple mechanism for multiplayer relaying via the server.<br />
* Less annoying glitches when running and shooting in multiplayer with latency hiding.}}<br />
<br />
{{history|0.12.0|<br />
* Multiplayer latency hiding (gives impression that some common tasks are performed immediately)<br />
* Factorio can run as a dedicated server without graphics (http://www.factorioforums.com/wiki/index.php?title=Multiplayer#Headless_server).<br />
* Basic PvP: New forces can now be created and merged back together; a cease-fire can be agreed upon between forces<br />
* IPv6 support for multiplayer.<br />
* DNS names can be used when connecting to multiplayer game.<br />
* Player's logistic filters are now remembered after respawn in multiplayer<br />
* Smaller multiplayer heartbeat packet size.<br />
}}<br />
<br />
<br />
{{history|0.11.19|<br />
* Multiplayer dropping threshold is doubled during map upload / download.}}<br />
<br />
{{history|0.11.17|<br />
* Autosaves in multiplayer are performed at the same time by all clients (interval is set by hosting player).<br />
* Progress bar is shown when non-responsive peers are about to be dropped from the game in the Multiplayer.<br />
* Progress bar is shown when other peers in multiplayer are saving map.}}<br />
<br />
{{history|0.11.16|<br />
* Revived character (after dying in multiplayer) are placed on the spawn point instead of the center of the map.}}<br />
<br />
{{history|0.11.2|<br />
* Mods that don't affect game state are not needed to be synchronized when playing multiplayer game or replaying game.}}<br />
<br />
{{history|0.11.0|<br />
* Introduced}}</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:LottieVixen&diff=137347User talk:LottieVixen2017-05-12T08:19:02Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 08:19, 12 May 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:LottieVixen&diff=137346User:LottieVixen2017-05-12T08:19:02Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>Not new to lua modding but new to factorio modding, hoping to update the modding guides!</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:Daafuku&diff=137345User talk:Daafuku2017-05-12T08:18:54Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 08:18, 12 May 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Daafuku&diff=137344User:Daafuku2017-05-12T08:18:54Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>Just your normal factorio addict, I've found a few mistakes and outdated information on the wiki and I would like to help update the information so that players are not misinformed.</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:Aecturus&diff=137343User talk:Aecturus2017-05-12T08:18:48Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 08:18, 12 May 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Aecturus&diff=137342User:Aecturus2017-05-12T08:18:48Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>I am a student of computer science living in Switzerland and enjoy playing Factorio very much. So far, I have only completed ~50 hours of Factorio but I hope I find time to increase that number significantly. :)</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:BuGGaTon&diff=137341User talk:BuGGaTon2017-05-12T08:18:43Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 08:18, 12 May 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:BuGGaTon&diff=137340User:BuGGaTon2017-05-12T08:18:43Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>Former Factorio Streamer and now just a fan of the game and a huge enthusiast!<br />
<br />
I don't know what else to write in this section. I just wanted to correct some mistakes I found on the wiki.</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:Sebson49&diff=137339User talk:Sebson492017-05-12T08:18:36Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 08:18, 12 May 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Sebson49&diff=137338User:Sebson492017-05-12T08:18:36Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>Hi. I would like to be a part of the wiki mostly because i use the factorio very much while playing factorio. I would maybe like to make some discussions.</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:WinterpegCanuck&diff=137337User talk:WinterpegCanuck2017-05-12T08:18:30Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 08:18, 12 May 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:WinterpegCanuck&diff=137336User:WinterpegCanuck2017-05-12T08:18:30Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>A long time fan of building games like Transport Tycoon, Sim City, Minecraft, Masters of Orion and many others, Factorio has hit so many right buttons. Great gameplay and a dedicated development community, this game has made it fun to do something I do for work (build factories and automate equipment) as a past time.</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:Prethoryn&diff=136120User talk:Prethoryn2017-04-28T18:56:31Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 18:56, 28 April 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Prethoryn&diff=136119User:Prethoryn2017-04-28T18:56:31Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>Klonanhttps://wiki.factorio.com/index.php?title=User_talk:Putnam&diff=136118User talk:Putnam2017-04-28T18:56:23Z<p>Klonan: Welcome!</p>
<hr />
<div>'''Welcome to the Official Factorio Wiki!''' Now that you have an account, there are a few key places on this Wiki that will be helpful in your efforts to improve it. <br />
First and foremost, please be sure to read and understand the [[Factorio:Wiki rules|rules of this Wiki]]. If you have any questions or concerns with these rules, please don't hesitate to ask an Admin. <br />
Secondly, if you're new to editing Wikis and are unfamiliar with MediaWiki's formatting, please be sure to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages]. <br />
If you're unsure where to begin, please see the [[Factorio:Editor_noticeboard|editor noticeboard]], where information on the current objectives and projects of the Wiki may be found. <br />
Again, welcome, we hope you contribute as much high quality information as you can. [[User:Klonan|Klonan]] ([[User talk:Klonan|talk]]) 18:56, 28 April 2017 (UTC)</div>Klonanhttps://wiki.factorio.com/index.php?title=User:Putnam&diff=136117User:Putnam2017-04-28T18:56:23Z<p>Klonan: Creating user page for new user.</p>
<hr />
<div>Mostly a modder, though mostly only of Dwarf Fortress. Creator of a few mods that I don't feel like naming, plus a few scripts for DFHack, most of which are made specifically to aid other modders. Can't come up with any ideas for factorio mods, though I almost definitely have the skill to make them.</div>Klonan