OUTDATED !!! Use https://ficsit.app/mod/5T4Z1exTKPDbWF

Old Mod Description # ContentLib Recipes

This mod allows Users (and Developers) to easily define custom recipes for any machine, or overwrite recipes from other mods!

Creating your own recipes is as simple as creating a JSON file (schema provided below) and placing it in the FactoryGame/Configs/Recipes or the FactoryGame/Configs/RecipePatches directory and launching the game.

You can also overwrite any recipe in a very similar manner.

If it doesn't exist, and you want to use it, create it!

This mod's recipe format supports basically everything a recipe Blueprint created in Unreal Engine does because it turns the JSON into such a blueprint at runtime.

Questions? Suggestions? Join the Nog's Mods Discord server or leave an issue on the GitHub issues page (slower response time)

Example Recipe

Below is an example recipe and a screenshot of it within the Item Codex in game.

{
    "Name": "BioFuel",
    "Ingredients": [
        {
            "Item": "Coal",
            "Amount": 1
        }
    ],
    "Products": [
        {
            "Item": "Biofuel",
            "Amount": 10
        }
    ],
    "ManufacturingDuration": 1,
    "ProducedIn":["ConstructorMk1"],
    "UnlockedBy":["Schematic_1-1"]
}

Recipe

Example Complex Recipe

Here's an example recipe for the Blender made by McGalleon.

{
  "Name": "Synthetic Crystal",
  "Ingredients": [
    {
      "Item": "Desc_RawQuartz",
      "Amount": 16
    },
    {
      "Item": "Desc_QuartzCrystal",
      "Amount": 7
    },
    {
      "Item": "Desc_Water",
      "Amount": 4800
    }
  ],
  "Products": [
    {
      "Item": "Desc_QuartzCrystal",
      "Amount": 20
    }
  ],
  "ManufacturingDuration": 8,
  "ProducedIn": ["Build_Blender"],
  "UnlockedBy": ["Schematic_1-1"]
}

Blender example ingame

File Patching Example (Overwrite other recipes)

In addition to creating new recipes, you can also use ContentLib Recipes to modify existing recipes, both base-game recipes and those added by other mods.

The syntax for the recipe is the exact same, but you must put an additional line at the start of the file to specify what recipe to overwrite - the recipe's blueprint path.

You can find this blueprint path from a reference list, via a tool like UModel, or by looking a mod's source code (either online or ingame with ContentInspector, once that mod is released).

Below is an example modification of the base game's Biofuel recipe.

Different to Recipes that should be created, Recipe Patches belong into a Folder with this Path:

FactoryGame/Configs/RecipePatches

//Game/FactoryGame/Recipes/Constructor/Recipe_Biofuel.Recipe_Biofuel_C
{
    "Name": "BioFuel Override",
    "Ingredients": [
        {
            "Item": "Coal",
            "Amount": 1
        }
    ],
    "Products": [
        {
            "Item": "Biofuel",
            "Amount": 10
        }
    ]
}

Writing Your Own Recipes

Example Starter Recipe

Most of your recipes will follow the JSON structure below:

{
    "$schema": "https://raw.githubusercontent.com/Nogg-aholic/ContentLib_Recipes/master/FContentLib_Recipe.json",
    "Ingredients": [
        {
            "Item": "Coal",
            "Amount": 1 
        }
    ],
    "Products": [
        {
            "Item": "Coal",
            "Amount": 1
        }
    ],
    "ManufacturingDuration": 1,
    "ProducedIn": [
        "Build_ConstructorMk1"
    ],
    "UnlockedBy": [
        "Schematic_1-1"
    ]
}

You can check the JSON schema linked above to find out what fields are optional and which are required. There are a lot more fields on offer, such as the variable power settings for the Particle Accelerator.

For example, you could leave out the UnlockedBy field, but the recipe would not be accessible without some other code to register it. An example of a minimal recipe is presented below.

Minimum valid recipe (still needs registration by another mod)
{
    "Ingredients": [
        {
            "Item": "Coal",
            "Amount": 1 
        }
    ],
    "Products": [
        {
            "Item": "Coal",
            "Amount": 1
        }
    ],
    "ProducedIn": [
        "Build_ConstructorMk1"
    ]
}

In order to write your own recipes, you will need the following:

  1. A text editor, preferably one that supports JSON Schema validation (like Visual Studio Code or Rider)
  2. The internal names of the ingredients and products in your recipe
  3. The internal name of the building(s) that can use your recipe
  4. The internal name of the schematic that will unlock your recipe

First, an explanation of the JSON schema, which documents the structure of the recipes.

JSON Schema

The format of recipe json files follows a JSON Schema, a helpful template that both explains the structure of the file and allows your favorite editors to automatically check your syntax for you. The schema itself is human-readable, so you can also read it to learn the recipe file format.

You can use Visual Studio Code, any JetBrains editor, or more, to get automatic suggestions and see the documentation as you write. Those links go to documentation on how to set it up.

You can view the schema below (may be out of date) or on GitHub here (guaranteed to be up to date).

JSON Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "Name": {
      "type": "string",
      "description": "Recipe Name. If not used first Product is used as Name"
    },
    "Ingredients": {
      "type": "array",
      "items": {
        "properties": {
          "Item": {
            "type": "string",
            "description": "Class Name -> 'Desc_Coal_C' while 'Desc_' & '_C' is not required"
          },
          "Amount": {
            "description": "Amount of Items",
            "type": "integer"
          }
        },
        "required": [ "Item", "Amount" ],
        "type": "object"
      },
      "minItems": 1
    },
    "Products": {
      "type": "array",
      "items": {
        "properties": {
          "Item": {
            "type": "string",
            "description": "Class Name -> 'Desc_Coal_C' while 'Desc_' & '_C' is not required"
          },
          "Amount": {
            "description": "Amount of Items",
            "type": "integer"
          }
        },
        "required": [ "Item", "Amount" ],
        "type": "object"
      },
      "minItems": 1
    },
    "ProducedIn": {
      "type": "array",
      "items": {
        "Item": {
          "type": "string",
          "description": "Class Name -> 'Build_ConstruktorMk1_C' while 'Build_' & '_C' is not required. Alternatively 'manual' can be used to Add this Recipe to all Manual Crafters"
        }
      },
      "minItems": 1
    },
    "UnlockedBy": {
      "type": "array",
      "Item": {
        "type": "string",
        "description": "Class Name -> 'Schematic_1-1_C' while '_C' is not required"
      },
      "minItems": 1
    },
    "ManufacturingDuration": {
      "type": "number",
      "description": "Duration for the Recipe Cycle in Seconds",
      "minimum": 0.0
    },
    "ManualManufacturingMultiplier": {
      "type": "number",
      "description": "Multiplier for the Recipe Cycle in Crafting Components",
      "minimum": 0.0
    },
    "VariablePowerConsumptionFactor": {
      "type": "number",
      "minimum": 0.0
    },
    "VariablePowerConsumptionConstant": {
      "type": "number",
      "minimum": 0.0
    },
    "ManufacturingMenuPriority": {
      "type": "number",
      "minimum": 0.0
    },
    "ClearIngredients": {
      "type": "boolean",
      "description": "Should the Recipe this is used on have its Ingredient Array Cleared before Adding to it? Default is true when Property Ingredients exists, false when not."
    },
    "ClearProducts": {
      "type": "boolean",
      "description": "Should the Recipe this is used on have its Products Array Cleared before Adding to it? Default is true when Property Products exists, false when not."

    },
    "ClearBuilders": {
      "type": "boolean",
      "description": "Should the Recipe this is used on have its Builders Array Cleared before Adding to it? Default is true when Property ProducedIn exists, false when not."
    }
  }
}

Writing Your Recipe

After setting up your text editor, go ahead and create a new file called Recipe_YourNameHere.json and copy in the "Example Starter Recipe" from above.

It is important that your recipe name is formatted in this way because the file name will become the internal recipe blueprint name once the recipe is loaded.

Override names do not need to follow any specific pattern, as they are modifying an existing asset as opposed to creating a new one.

Next, you need to find the item, building, and schematic names. These names are part of the 'blueprint path' of the items in the game's files. Thankfully, this mod will automatically resolve part of the blueprint path into the full name, saving you from having to type out the full name. You can exclude the "_C" from the end as well. More info on how this works can be found in the "The Inner Workings" section.

You can find these blueprint path from a reference list, via a tool like UModel, browsing around in the SML starter project, or by looking a mod's source code (either online or ingame with ContentInspector).

Watch out - if you're using fluids in your recipes, you need to multiply the item count by 1000, Each fluid 'item' in Satisfactory is small interval, which allows for decimal values of fluid in-game. For example, if you want a recipe to consume 4.8 Fuel per operation, you will need to use Item name Desc_LiquidFuel and an Amount of 4800.

Here are a few Vanilla building names:

  • Constructor : Build_ConstructorMk1
  • Assembler : Build_AssemblerMk1
  • Foundry : Build_FoundryMk1
  • Manufacturer : Build_ManufacturerMk1
  • Blender: Build_Blender

Schematic names for HUB milestones will generally follow the format Schematic_1-1, but you can find out specific ones via the approaches described above.

Use the values you've selected and the example recipe above to create your recipe, then place it in the FactoryGame/Configs/Recipes directory and launch the game to try it out. If you've done everything correctly, you should see your recipe unlocked by the schematic you specified, and you can use it in the machines you added to ProducedIn.

Tracking Down Errors

If an error is encountered while loading a recipe, the mod will print error information to the SML console and your log files. To see the SML console, turn on consoleWindow in your configs. You can find info on how to do that here. You can find your log files in your Local AppData directory, ex. AppData\Local\FactoryGame\Saved\Logs.

Common Errors

  • Nothing showing up at all in the logs
    • Make sure your recipes are in the FactoryGame/Configs/Recipes directory.
  • Wrong Naming Convention ! "Recipe" expected followed by a Name
    • Your recipe file should be names like this: Recipe_YourNameHere.json

The Inner Workings

How does resolving Item names work?

Items are resolved by comparing the supplied Item name against existing Item ClassNames in the game. The first match the mod finds will be used.

Watch out for ambiguity with Class Names! Sometimes items can have very similar names. Be as specific as possible with the name to avoid problems with this.

Class Names have a '_C' suffix when they have been generated by a Blueprint. The "_C" suffix, as well as the naming-convention related "Build" or "Desc" prefix, is optional for this mod.

Why do recipe overwrites need the blueprint path?

The reason is simple:

  • This Recipe may not be loaded when it isn't added by a Registered Schematic at this point.
  • There is no way to "Find" it by name without loading everything.

Therefore, this mod uses a Blueprint Path here to reliably load the Recipe to be Patched.

Why is the blueprint path not part of the Json itself?

  • The step of turning the raw text into JSON is skipped when the recipe class fails to load to improve performance.
  • Putting the path inside of the JSON would have forced this Mod to do the conversion step earlier.
  • Even if it were part of the JSON, it has no actual value for the Recipes themselves, just for the mod figuring out what to overwrite. The path resolves to either a useless nullptr or a valid pointer with no further usefulness.

For Mod Developers

You can use ContentLib Recipes to define the recipes for your own mods.

This makes it easy for end users to configure recipes to their own balance preferences, and can help you quickly create recipes if you want to automatically generate them from another source.

Mods/%MyMod%/Configs/CLRecipe

Mods/%MyMod%/Configs/CLRecipePatches

are also included in the Search for Files. That means you can bundle your Recipes and Patches into a Mod without any Pak or Binary Files!

You can follow the examples below to load recipes from your mod's own custom directories, or create and register recipes from strings alone, or whatever you'd like!

Make sure that you list ContentLib_Recipes as a required or optional dependency of your own mod, and follow the directions here to be sure that any json files you include in your mod files get packed into your final mod.

Guide

HIDDEN
ContentLib Recipes Logo

Info

Created: Jul 7, 2021, 3:19:20 PM
Views: 23,052
Downloads: 1,141
Reference: ContentLib_Recipes