Fungible Reagents

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Galdoc
Inserter
Inserter
Posts: 28
Joined: Wed May 11, 2016 9:43 pm
Contact:

Fungible Reagents

Post by Galdoc »

What is it: When crafting by hand or in an 'assembling-machine' of some sort, individual ingredients can be drawn from a pool. At simplest, this could be a list of ingredients that can be used -- for example, {"iron-plate", "steel-plate"}. Adding functionality, it might look like giving items a list of tags, and accepting any item that satisfies a logical statement involving those tags -- for example, an individual requirement might be {{"load-bearing", "heavy-load-bearing"}, {"high-tensile", "very-high-tensile"}} would require one tag from each sub-table in the table.

Problems with current workarounds:
- One way to implement this in the current system is to procedurally generate a massive, exponentially growing list of recipes during the prototype stage, and make some sort of GUI that makes it less of a nightmare for the player to pick a recipe -- as in, clicking on a recipe for Burner Inserter, and then picking the sub-recipe that involves the ingredients that the player expects to be on belts feeding the assembler. Beyond the bloated memory problems, this won't allow for on-the-fly insertion of reagents of different types, and there's (probably) no good way at runtime to swap the recipe in the assembler on the fly.
- The workaround I used was to introduce a layer of intermediate abstraction. That is, metals have properties (these would be the 'tags' above), and when they go from the Stock abstraction layer to the Machined Part abstraction layer, they crystalize into a part that has one (or more) of those properties, forgetting their original metal. This means I can't go back -- one cannot recycle a machined part back into the metal that sourced it.
- When the player's crafting UI reports whether or not they can craft an item, it may not properly communicate to the player that an item can be made. This is because (I think) when it calculates the 'raw materials' to craft an item, it picks a material that WILL work, but it misses other materials that CAN work, and if you have items in your inventory that differ from what it saw, then it won't let you make it. For example, in my mod, Basic Paneling can be made from Copper or Iron. The recipe for Assembling Machine 1 takes Basic Paneling. The breakdown says that it requires 16 Iron Plate Stock, because when it calculated the recipes for making Basic Paneling, it settled on Iron. If I then have Copper Plate Stock in my inventory instead of Iron Plate Stock, then it won't let me craft the Assembling Machine 1 until I manually make Basic Paneling.

Benefits of making this:
- Mod designers can simplify (or, alternately, make more complex / rich) chains of production that better reflect their vision.
- You could recast the recipes for Solid Fuel into a single recipe with Fungible Reagents
- Barrels could be tagged with the fluid it contains, or some other simplification

Post Reply

Return to “Modding interface requests”