Modding Info References

Place to get help with not working mods / modding interface.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Modding Info References

Post 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 :)
User avatar
Reygan
Fast Inserter
Fast Inserter
Posts: 177
Joined: Tue Jan 28, 2014 8:42 pm
Contact:

Re: Modding Info References

Post by Reygan »

When the Prototype definitions will be finished? Or where can i get information about prototypes.
Daniel V. Lenskiy
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Modding Info References

Post 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).
User avatar
Reygan
Fast Inserter
Fast Inserter
Posts: 177
Joined: Tue Jan 28, 2014 8:42 pm
Contact:

Re: Modding Info References

Post by Reygan »

Okay. And because of what devs may give me rights to access sources? At least that part, where prototypes are used.
Daniel V. Lenskiy
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3717
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Modding Info References

Post 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.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Modding Info References

Post by aubergine18 »

Good library of useful functions to pick at: https://github.com/rxi/lume
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Modding Info References

Post 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
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Arg-Arthur_MP
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Nov 17, 2016 4:29 am
Contact:

Re: Modding Info References

Post by Arg-Arthur_MP »

Hi,

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

Thanks!
BrokenScience
Inserter
Inserter
Posts: 26
Joined: Thu Jul 21, 2016 5:31 pm
Contact:

Re: Modding Info References

Post 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.
Smashing a brick wall with my face would be a lot more rewarding if I didn't just reveal 3 more.
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Modding Info References

Post 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.
quick links: log file | graphical issues | wiki
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Modding Info References

Post 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.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Modding Info References

Post 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.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
Shenpen
Fast Inserter
Fast Inserter
Posts: 227
Joined: Sat Aug 27, 2016 2:46 pm
Contact:

Re: Modding Info References

Post 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????
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Modding Info References

Post 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.
User avatar
Shenpen
Fast Inserter
Fast Inserter
Posts: 227
Joined: Sat Aug 27, 2016 2:46 pm
Contact:

Re: Modding Info References

Post 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.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Modding Info References

Post 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.
Post Reply

Return to “Modding help”