Modding: Difference between revisions
(Dynamic merge Modding/Overview, and Mods into this page.) |
m (typo) |
||
Line 9: | Line 9: | ||
There are 2 ways to install mods in Factorio. Both of these methods are supported. | There are 2 ways to install mods in Factorio. Both of these methods are supported. | ||
=== The mod portal == | === The mod portal === | ||
Factorio's devs have set up a mod portal for uploading, hosting, and sharing mods to be downloaded by players. This is the primary place to get mods, secondary being the forums. To download a mod, simply visit the mod portal in-game or with a browser, and download the mod. If you're browsing in-game, the game will automatically install the mod for you. If you're browsing with a browser, you will need to place the downloaded zipped mod in your [[Application directory|mods directory]]. | Factorio's devs have set up a mod portal for uploading, hosting, and sharing mods to be downloaded by players. This is the primary place to get mods, secondary being the forums. To download a mod, simply visit the mod portal in-game or with a browser, and download the mod. If you're browsing in-game, the game will automatically install the mod for you. If you're browsing with a browser, you will need to place the downloaded zipped mod in your [[Application directory|mods directory]]. |
Revision as of 10:00, 20 June 2017
Factorio's modding API allows for members of the community to add features and entities to the game. Factorio's modding API uses the language Lua to interpret scripting and setup of entities, and injects them into the start up and data construction of the game. This API offers many hooks for modders to have actions run when the hook triggers.
This page documents modding of Factorio in general, for a tutorial for making mods, see this wiki's tutorials, and for information on where mods are installed to, see Application directory.
Installing mods
There are 2 ways to install mods in Factorio. Both of these methods are supported.
The mod portal
Factorio's devs have set up a mod portal for uploading, hosting, and sharing mods to be downloaded by players. This is the primary place to get mods, secondary being the forums. To download a mod, simply visit the mod portal in-game or with a browser, and download the mod. If you're browsing in-game, the game will automatically install the mod for you. If you're browsing with a browser, you will need to place the downloaded zipped mod in your mods directory.
Manual downloading
Whether the mod was downloaded from the mod portal or the forums, sometimes manual installation is required. Simply drop the ZIP archive of the mod into your mods directory, no need to unzip it. You can see if it has loaded correctly by checking the in-game mods list, in the main menu.
Dependencies
Factorio's mods have the ability to setup dependencies for themselves, which means that some mods will also require some other mods to be installed, or in some cases, not require them, but enable extra functionality if the extra mods are installed. In either case, currently dependencies are not automatically resolved, so it is up to the user to find and install all of the dependencies that the mod requires. This is expected to be made an automatic process in the future.
Creation of mods
All modding in Factorio is done in the Lua programming language. Lua files can be created and edited in any text editor. Well-known ones that offer syntax highlighting are Notepad++ and Sublime Text.
Useful resources for Lua:
- Lua tutorial
- Lua reference manual
- Lua REPL : A Lua read-eval-print-loop, essentially a sandbox.
Format
Factorio's mods are distributed in ZIP archives, and contain a few key files that Factorio looks for when loading mods. These files are listed below, with red entries being absolutely required.
- info.json
- control.Lua
- data.Lua
- data-updates.Lua
- data-final-fixes.Lua
Licensing
All mods require a license since v0.11. If a mod has no license it is assumed to have a Creative Commons Attribution-Noncommercial 4.0 International (CC BY-NC 4.0) license. However, it is possible to purposely unlicense the mod, to allow the code within it to be common public domain. The most common and popular distribution licenses for factorio mods are the MIT license, and the GPL license.
Other useful legal links include: