Blueprint Libraries

TODO - Add more examples and info on where to find available functions (reading the headers + function doc comments)

In addition to using the text-file-based JSON features of ContentLib, modders can also interact directly with ContentLib systems to make writing other mods easier.

For example, ContentLib’s blueprint library could be used to iterate over every defined item at launch and remove the radiation stat from them.

ContentLib offers both Blueprint and C++ APIs with additional functionality.

You can find examples of its usage by looking at the Content Lib mod’s blueprint code for usage examples, or by looking at the source code of other mods using Content Lib, such as Aquilla’s mods or SifVerT’s Difficulty Tuner.

Set Up your Plugin to Use the Library

Get ContentLib in your Editor

Follow the directions here to set up the ContentLib blueprint libraries in your editor.

If you want to use C++, there are a few more steps.

Examples of Blueprint Library Functions

You can find out what blueprint library functions are available by looking at the header files for the mod.

Anything labeled BlueprintCallable or BlueprintPure can be used with blueprints, and fields with BlueprintReadOnly and BlueprintReadWrite can be accessed.

To see some usage examples, you can look at ContentLib’s own blueprint implementation.

Since you have already set up the ContentLib source to be in your editor, you should see a ContentLib Content folder in your editor’s content browser. You can open the blueprints there to see what functions they make use of.

The CL_<something>_Module files are probably of particular interest to you.

In general, the code in those files does the following:

  1. Fetch all of the JSON files in the relevant folder in all mods

  2. Run a function, probably called Process <something> to turn the text loaded from the file into an asset for the game

  3. Repeat steps 1-2 for items in the user’s Configs folder

  4. Repeat steps 1-3 for the patch version of that asset (ex. first Items, then ItemPatches)

Recipe Example

Here is an example of patching an existing recipe:

RecipePatchExample

Schematic Cost Modification Example from Difficulty Tuner

DifficultyTunerSubsystem Schematic Example

Last updated by SifVerT 5/3/2022

This example is from the mod Difficulty Tuner by SifVerT. It applies a configurable cost multiplier to the ingredients of all in-game schematics.

  1. Inputs from the Event Graph to the blueprint function. This function takes arrays of Schematics (FGSchematic Array) and CL Schematic structs (CLSchematic Array) whose items are in parallel (items at the same index are relevant to each other), a reference to the CL subsystem (CL Subsystem), and a multiplier variable (Multiplier).

  2. The loop processes each schematic in the array one by one. I am using ContentLib Schematics which I have put in an array earlier passed into this function, so here I bring out the keys of the cost in an orderly fashion via an array. The Find feature looks into the ingredients name map for the currently scanned Display Name and gets the value (the quantity) based on the key (the item name).

  3. The value from the previous loop goes into a simple mathematical multiplication, with the Multiplier input into the function. In Difficulty Tuner this input value is set externally via a configuration widget. And for each loop of going through keys in 'Step #2' it adds each modified entry into a temporary map variable. Nothing is saved yet to the ContentLib schematic.

  4. For each schematic, once all cost keys have been processed, the changes to the schematic are applied (saved/overwritten in this case) via the ContentLib blueprint library and take effect in game immediately. Before proceeding to the next schematic to modify, the temporary map is cleared, so that it is blank for use in the next schematic.

ContentLib’s Subsystem must be called for in order to use the entire CL feature. If you have any questions feel welcome to contact SifVerT#2610 on Discord for help. If the demo needs extra clarification please also come with feedback.

More Usage Examples

ContentLib implements its "loading of text files into real content" functionality using the same blueprint library functions it exposes for use by any other mods.

You can look at the ContentLib mod’s blueprint source code for more examples of how each function is used.

Please consider contributing more examples to the docs here if you have some time via 'Edit This Page' in the top right.