1. lua-api.factorio.com is not searchable. I solved this by downloading the site (wget -m http://lua-api.factorio.com/latest/) and searching with grep. Not ideal as the lines are often huge and fill the whole terminal... but it works.
2. game.findentities() is used in the main modding tutorial on the wiki, but it is not even documented. On the wiki there are no hits (other than the tutorial) and in the Lua reference there are no hits at all.
3. Entities of type "tree" are not in the lua reference either. They appear to be non-blueprintable... but who can say?
4. That I can create an entity of type "tree" but not find it in the Lua reference, also means that there exists no list of possible types. We just have to infer this from what the base mod uses?
5. I cannot find assembling-machine info in the Lua reference. I'd like to know what fields and methods it has (defines.html tells me I must be able to access its inventory because defines.inventory.assembling_machine_input exists.... but how?) and whether it has any events (particularly: recipe changed, or finished crafting an item).
How do people even manage to make mods and write tutorials when functions are not written down anywhere, am I missing something?
Terrible documentation
Re: Terrible documentation
Factorio releases also come with the full api in the documents directory. If you use ATOM as your editor I can send you the factorio api autocomlete package I use.luc wrote:1. lua-api.factorio.com is not searchable. I solved this by downloading the site (wget -m http://lua-api.factorio.com/latest/) and searching with grep. Not ideal as the lines are often huge and fill the whole terminal... but it works.
The modding wiki is way outdated. game.findentities has been replaced with surface.find_entities{}luc wrote:2. game.findentities() is used in the main modding tutorial on the wiki, but it is not even documented. On the wiki there are no hits (other than the tutorial) and in the Lua reference there are no hits at all.
Entity prototype definitions are found in the data/base/prototypes folder. Not all entities are blueprintableluc wrote:3. Entities of type "tree" are not in the lua reference either. They appear to be non-blueprintable... but who can say?
Yes, see above. the lua-api is just that, an API for getting/setting stuff via lua. It is not for creating new prototypesluc wrote:4. That I can create an entity of type "tree" but not find it in the Lua reference, also means that there exists no list of possible types. We just have to infer this from what the base mod uses?
Information on prototypes is found in the data/base/prototypes folder. All events are found here http://lua-api.factorio.com/latest/events.html. There is no event for recipe change or finished crafting.luc wrote:5. I cannot find assembling-machine info in the Lua reference. I'd like to know what fields and methods it has (defines.html tells me I must be able to access its inventory because defines.inventory.assembling_machine_input exists.... but how?) and whether it has any events (particularly: recipe changed, or finished crafting an item).
All of the functions for accessing/changing stuff during run-time is found in the factorio-API. All of the prototype definitions are found in data/base/prototypesluc wrote:How do people even manage to make mods and write tutorials when functions are not written down anywhere, am I missing something?
Re: Terrible documentation
Thank you very much for the thorough response! It is much appreciated 
I was thinking, maybe keep a global array of all these special factories, like global.specialfactories. Then on_built_entity I could check whether it (created_entity) was a special factory and, if yes, add it to global.specialfactories. Then on each tick: foreach (global.specialfactories as factory){ if factory.is_crafting(): continue; else get the recipe and fill inputs }. Does that make sense, or is there a better way?
Ah, I didn't notice that before.Nexela wrote:Factorio releases also come with the full api in the documents directory. If you use ATOM as your editor I can send you the factorio api autocomlete package I use.
Ah yes, that one I can find in the reference.Nexela wrote:The modding wiki is way outdated. game.findentities has been replaced with surface.find_entities{}
How can I figure out which ones are blueprintable? Is it possible to make one blueprintable if it isn't?Nexela wrote:Entity prototype definitions are found in the data/base/prototypes folder. Not all entities are blueprintable
Alright so I have a custom factory-like building which makes products without needing any inputs (think of it like a cheat, but it draws a massive amount of power to compensate). It seemed easiest to me to make a variant of an assembly machine and let it fill its own inventory using Lua. Upon (1)setting/changing a recipe and (2)completion of an product, it needs to re-fill itself. What is an efficient way to do this?Nexela wrote:Information on prototypes is found in the data/base/prototypes folder. All events are found here http://lua-api.factorio.com/latest/events.html. There is no event for recipe change or finished crafting.
I was thinking, maybe keep a global array of all these special factories, like global.specialfactories. Then on_built_entity I could check whether it (created_entity) was a special factory and, if yes, add it to global.specialfactories. Then on each tick: foreach (global.specialfactories as factory){ if factory.is_crafting(): continue; else get the recipe and fill inputs }. Does that make sense, or is there a better way?
Re: Terrible documentation
That sounds about right.luc wrote:I was thinking, maybe keep a global array of all these special factories, like global.specialfactories. Then on_built_entity I could check whether it (created_entity) was a special factory and, if yes, add it to global.specialfactories. Then on each tick: foreach (global.specialfactories as factory){ if factory.is_crafting(): continue; else get the recipe and fill inputs }. Does that make sense, or is there a better way?
Entities with the not-in-blueprint flag (something like this), entities without forces (trees, simple-entity). There are a couple of other cases tooluc wrote:How can I figure out which ones are blueprintable? Is it possible to make one blueprintable if it isn't?
Re: Terrible documentation
Mod with water well as assembler with locked recipe and without raw material.Alright so I have a custom factory-like building which makes products without needing any inputs (think of it like a cheat, but it draws a massive amount of power to compensate).

