VisualKits
|
You can find a JSON Schema for Visual Kits here. |
ContentLib introduces the concept of Visual Kits to prevent having to deal with long, verbose blueprint paths in Item and Schematic definitions.
Visual Kits are automatically generated at runtime for every pre-existing item and schematic (including those from other mods).
If you want to refer to the kit of existing content,
use its asset name with the _C suffix,
For example, Desc_OreGold_C resolves to the Caterium Ore kit,
but Desc_OreGold does not resolve.
ResourceSink_CyberWagon_C resolves to the Cyber Wagon AWESOME Shop unlock schematic.
You can also define your own Visual Kits using JSON files.
All Visual Kit JSON files must start with the prefix Kit_.
In custom visual kits, you can re-use base game content, refer to content from other mods, or (in the case of icons only) use Icons that have been loaded by ContentLib.
For example, a custom kit file named Kit_CustomWater.json can be used in Item definitions via the name "Kit_CustomWater".
All fields of a custom visual kit are optional. Schematic visual kits of course do not need to specify a mesh or colors since those are irrelevant to schematics.
|
Remember that custom Visual Kits need to go in the correct Folder. |
VisualKit Exporting
A debugging chat command exists to export all loaded Visual Kits to JSON files for ease of viewing.
Trigger it via /CLDumpVisualKits. It will output files to FactoryGame/Mods/ContentLib/Output/VisualKits/DumpOutput/<KitName>.json.
Schematic Visual Kit Example
Here is an example Visual Kit that is used in RePan to reference custom Icons for use in a Schematic
It requires that a file AcidRefinery.png be included in an Icons folder.
{
"$schema": "https://raw.githubusercontent.com/budak7273/ContentLib_Documentation/main/JsonSchemas/CL_VisualKit.json",
"BigIcon": "AcidRefinery",
"SmallIcon": "AcidRefinery"
}
Item Visual Kit Example
Below is an example Visual Kit that reuses properties of the base-game Water resource.
Note that if a Solid is given fluid/gas color properties, they will have no noticeable effect.
{
"$schema": "https://raw.githubusercontent.com/budak7273/ContentLib_Documentation/main/JsonSchemas/CL_VisualKit.json",
"Mesh": "/Game/FactoryGame/Resource/Parts/PackagedWater/SM_PackedWater_01.SM_PackedWater_01",
"BigIcon": "/Game/FactoryGame/Resource/RawResources/Water/UI/LiquidWater_Pipe_512.LiquidWater_Pipe_512",
"SmallIcon": "/Game/FactoryGame/Resource/RawResources/Water/UI/LiquidWater_Pipe_256.LiquidWater_Pipe_256",
"FluidColor":
{
"r": 122,
"g": 176,
"b": 212,
"a": 255
},
"GasColor":
{
"r": 122,
"g": 176,
"b": 212,
"a": 255
}
}
Visual Kit overriding
|
As of April 4th 2023, this feature is not fully working correctly. The override will apply for ContentLib-defined items that try to use the kit you overwrite, but if you try to override a vanilla/modded item, the changes will not be visibly applied to that item. If you want to override an existing item’s kit, create a custom kit as normal,
but also create an Item Patch
for the item you want to change that specifies your new kit via the |
If a Visual Kit shares the name of an existing definition, the last visual kit to load will overwrite the existing kit(s), including base-game ones!
This means that you can replace the icons/meshes/fluid colors etc. of any mod’s item or schematic by writing a Visual Kit that shares its exact name.
The below example will replace the icon for the Caterium Ore base game item.
The file should be named exactly Desc_OreGold_C.json,
otherwise it will not successfully override the existing Caterium Ore,
and will instead create a separate visual kit.
It requires that a file MyIconName.png be included in an
Icons folder, for example,
\YourModReference\ContentLib\Icons\MyIconName.png
{
"$schema": "https://raw.githubusercontent.com/budak7273/ContentLib_Documentation/main/JsonSchemas/CL_VisualKit.json",
"BigIcon": "MyIconName",
"SmallIcon": "MyIconName"
}