Page 1 of 1

Modding Info References

Posted: Tue Jul 15, 2014 9:06 pm
by FreeER
This post/topic is obviously meant as a list of links to Factorio modding information, to be honest it's mostly duplicating links from the wiki, but I've been notified that some people don't know to look there when just starting out so... no harm putting it here as well (at least, not that I could think of) :)
So the obvious starting point is the wiki's main modding page here with links to all of the general pages (which then link to other, increasingly specific, pages). Not everything is complete (and some is out of date, though it's fairly rare for anything to actually be wrong, most often a few things are missing).

If you are just starting out then look at the Modding Overview which lists some basic information about how mods work in general and the Modding Tutorial which goes through the process of creating a small mod (Originally created by me, updated to 0.10.3 by jeroon). Then look at the links below (don't get overwhelmed and give up, it is a decent amount of information but a lot of it is used in only certain cases :)).

From there the primary links are:
  • Lua Objects: which lists all of the properties and methods of different lua objects (the global 'game' object is also listed here), this is one of the pages you'll want to bookmark when starting out (and I still reference it sometimes)
  • Prototypes definitions: lists all of the prototypes that you can create, the ones that are finished have (at least) the required fields and some of (if not all) of the optional fields as well. This is likely to be the most out of date, but still occasionally useful (sometimes more useful than looking at the base files).
  • Lua Events: which describes the events that allow a mod to know when something has happened in game (like the player building or mining something).
  • Modding FAQ: Meant to be a list of frequently asked questions concerning mods (mostly how to fix common errors)...not much is really here yet though.
The Script Interfaces cover creating an interface for your mod that other mods can call and the Migrations scripts (currently) has a link to a post I've made about creating migration scripts for when you make a 'breaking' change in your mod (so that you can prevent actually breaking the users' saves).

The last reference I can think of to add here is drs9999's post about some of the methods added in 0.10.0, most of them should be on the wiki by now but I'm not sure if all of them are.
Also: 11.x Fluid Interaction with entity.fluidbox (on wiki as of Feb. 4, 2015)

data.lua, data-updates.lua, and data-final-fixes.lua: are run for each mod in that order (all data.lua files first, then ...). allows mods to change the data of other mods without the need to be last (specifying [optional] dependencies in info.json).

If you know of any other wiki pages or forum topics/posts that are helpful and should be linked here then make a post below and I'll update this. Obviously if there are several forum posts linked here then someone (anyone) could take the time to place them on the wiki (in a logical place) but at least having them here helps keep the information from being lost in the void of time :)

Re: Modding Info References

Posted: Mon Jul 28, 2014 12:08 pm
by Reygan
When the Prototype definitions will be finished? Or where can i get information about prototypes.

Re: Modding Info References

Posted: Mon Jul 28, 2014 11:28 pm
by FreeER
Reygan wrote:When the Prototype definitions will be finished? Or where can i get information about prototypes.
Finish date: Unknown. As for more info, base prototypes and asking specific questions in modding help (if no one actually knows there are a few people, other than the devs, with access to the source that can look it up, it's just that everyone has their own lives and goals so they aren't devoted to updating the wiki even if we wish they were :P).

Re: Modding Info References

Posted: Tue Jul 29, 2014 6:02 am
by Reygan
Okay. And because of what devs may give me rights to access sources? At least that part, where prototypes are used.

Re: Modding Info References

Posted: Wed Dec 17, 2014 12:43 am
by DaveMcW
FreeER wrote:the Modding Tutorial which goes through the process of creating a small mod
This is the most important reference for beginners. Everything else is too confusing until you read it.

Re: Modding Info References

Posted: Tue Jul 26, 2016 10:15 pm
by aubergine18
Good library of useful functions to pick at: https://github.com/rxi/lume

Re: Modding Info References

Posted: Fri Sep 16, 2016 2:13 pm
by aubergine18
Some of the links in OP are outdated, more update infos can be found in the auto-generated modding API docs:

http://lua-api.factorio.com/latest/index.html

Re: Modding Info References

Posted: Mon Nov 28, 2016 4:50 pm
by Arg-Arthur_MP
Hi,

Is this still working "game.player.print(game.help())" ? Cuz i get this https://postimg.org/image/4whqc3i8b/

Thanks!

Re: Modding Info References

Posted: Wed Nov 30, 2016 3:10 am
by BrokenScience
Are there any keys on the error messages? I'm new to this modding thing and any attempt to test my 'creations' ends with a crash on line 1 and I don't know enough about the errors I get to fix them.

Re: Modding Info References

Posted: Wed Nov 30, 2016 10:21 pm
by daniel34
Arg-Arthur_MP wrote:Is this still working "game.player.print(game.help())" ? Cuz i get this https://postimg.org/image/4whqc3i8b/
No, and it isn't required anymore. http://lua-api.factorio.com will give you the same information with much more details.
BrokenScience wrote:Are there any keys on the error messages? I'm new to this modding thing and any attempt to test my 'creations' ends with a crash on line 1 and I don't know enough about the errors I get to fix them.
Search for the error (using the forum's search function or google), or make a new thread in Modding help.

Re: Modding Info References

Posted: Wed Feb 01, 2017 10:22 pm
by aubergine18
When changing .lua files, you don't need to exit whole app, you can just load or start new game as Lua files are loaded fresh each time (unlike sprites which are loaded when app is first launched).

When playtesting, you can make Factorio load faster by caching sprites....
RSeding91 wrote:Config settings: https://www.reddit.com/r/factorio/comme ... g/dcjxrf2/

Result (GIF): https://gfycat.com/MinorUnfoldedGuineafowl

Also you only have to restart if your change one of the data.lua files. Changing control.lua just requires a save/exit/load.

Re: Modding Info References

Posted: Tue Apr 11, 2017 2:30 pm
by bobingabout
aubergine18 wrote:When changing .lua files, you don't need to exit whole app, you can just load or start new game as Lua files are loaded fresh each time (unlike sprites which are loaded when app is first launched).
Correction:
Editing Script files (control.lua and everything included within that, or anything in a migration folder) can be changed while the game is running, and simply starting a new game or loading will load the script again.
Data files (Including all lua files added by data.lua, data-updates.lua and data-final-fixes.lua, sprite sheets etc) need to restart the game to take effect.

Re: Modding Info References

Posted: Wed Apr 19, 2017 7:47 pm
by Shenpen
Is there a know way to make a alternative prototype for a mod?
Like a prototype that has some properties of items, but not all.

Say if I wanted a prototype "bucket" that would need special belts, special inserters and not be acceptable to vanilla belts and inserters,
would I then be able to specify this in alternative prototype?

The result I want is to have some resources that are not items (and don't fit the vanilla logistics) and are not fluids (don't go by pipes), but are still usable as resources in assembler production.

And why can the spellcheck not spell inserter????

Re: Modding Info References

Posted: Wed Apr 19, 2017 8:50 pm
by darkfrei
Shenpen wrote:Is there a know way to make a alternative prototype for a mod?
Like a prototype that has some properties of items, but not all.

Say if I wanted a prototype "bucket" that would need special belts, special inserters and not be acceptable to vanilla belts and inserters,
would I then be able to specify this in alternative prototype?

The result I want is to have some resources that are not items (and don't fit the vanilla logistics) and are not fluids (don't go by pipes), but are still usable as resources in assembler production.
Items: things in your inventory, in chest or dropped on ground.
Entities: all buildings, trees, all things, that you place on the map.
Recipes: recipes, that can be used by handcrafting, assembler, refinery or chem plant. Recipes define what items are you need to product another items.
Liquids: Special type of items, but you can't it store in inventory or take it from the map.
Technologies: Some process, that enabled on result some recipes.

Also, you can do what you want. But you need new items, new recipes, define recipes where is possible produce them, and technologies, that will enable them.

Re: Modding Info References

Posted: Thu Apr 20, 2017 3:36 am
by Shenpen
darkfrei wrote:
Shenpen wrote:Is there a know way to make a alternative prototype for a mod?
Like a prototype that has some properties of items, but not all.

Say if I wanted a prototype "bucket" that would need special belts, special inserters and not be acceptable to vanilla belts and inserters,
would I then be able to specify this in alternative prototype?

The result I want is to have some resources that are not items (and don't fit the vanilla logistics) and are not fluids (don't go by pipes), but are still usable as resources in assembler production.
Items: things in your inventory, in chest or dropped on ground.
Entities: all buildings, trees, all things, that you place on the map.
Recipes: recipes, that can be used by handcrafting, assembler, refinery or chem plant. Recipes define what items are you need to product another items.
Liquids: Special type of items, but you can't it store in inventory or take it from the map.
Technologies: Some process, that enabled on result some recipes.

Also, you can do what you want. But you need new items, new recipes, define recipes where is possible produce them, and technologies, that will enable them.
Yes, we agree on all of that. The question is though if I can make a prototype that is like fluids, items that are not moved by vanilla logistics, don't fit in inventory, but can still be moved by specific logistic arrangements (but not pipes) and will still be resources in recipes. So "like" a fluid, but not a fluid.

Re: Modding Info References

Posted: Mon Dec 25, 2017 11:13 pm
by darkfrei
Shenpen wrote:The question is though if I can make a prototype that is like fluids, items that are not moved by vanilla logistics, don't fit in inventory, but can still be moved by specific logistic arrangements (but not pipes) and will still be resources in recipes. So "like" a fluid, but not a fluid.
With control.lua you can make some script, that reads player's inventory and drop this items to the ground. So, it's impossible to make hand-logistics. You still can to transport this items with inserters, belts, cars and train wagons.