BlueprintClasses
A quick tutorial to explain how production blocks (refinery, assembler, etc) are tied to blueprints (recipes).
Terminology
- Blueprint (Blueprints.sbc) defines a list of items (prerequisites) that can be turned into a different list of items (results).
There can be multiple blueprints that make up the same item(s), however only the <IsPrimary>true</IsPrimary> blueprint will be used for reverse lookup when for example Assembler block wants to disassemble something.
- BlueprintClass (BlueprintClasses.sbc at the top) defines a group of blueprints, these are directly referenced by production blocks' sbc (assembler, refinery, etc) and they also define the tabs you see in Production terminal in-game.
- BlueprintClassEntry (BlueprintClasses.sbc at the bottom) is how a Blueprint is linked to a BlueprintClass without needing to override blocks or classes, this is the way for mods to add new items.
Add a new blueprint without overriding blocks
Step 1. Create a Blueprint definition
You first need a Blueprint definition to specify what item(s) make what (by copying a vanilla Blueprints.sbc, erasing all except one blueprint and then changing its subtype to be unique ane the items).Blocks automatically have blueprints generated with
TypeId/SubtypeId format for the blueprint subtype, therefore you simply enter BlueprintSubtypeId="JumpDrive/LargeJumpDrive" for example. If block's subtypeId is empty then enter (null) after the slash.<Results> and <Prerequisites>, that can crash the game if item's <MinimalPricePerUnit> is set to -1, follow the link for more details.<?xml version="1.0"?>
<Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Blueprints>
<Blueprint>
<Id>
<TypeId>BlueprintDefinition</TypeId>
<SubtypeId>StoneOreToIngot</SubtypeId>
</Id>
<DisplayName>DisplayName_BlueprintClass_Ingots</DisplayName>
<Icon>Textures\GUI\Icons\ingot\ingot_class.dds</Icon>
<Prerequisites>
<Item Amount="1000" TypeId="Ore" SubtypeId="Stone"/>
</Prerequisites>
<Results>
<Item Amount="14" TypeId="Ingot" SubtypeId="Stone"/>
<Item Amount="30" TypeId="Ingot" SubtypeId="Iron"/>
<Item Amount="2.4" TypeId="Ingot" SubtypeId="Nickel"/>
<Item Amount="4.0" TypeId="Ingot" SubtypeId="Silicon"/>
</Results>
<BaseProductionTimeInSeconds>10</BaseProductionTimeInSeconds>
</Blueprint>
</Blueprints>
</Definitions>
Now change it to be yours! First <SubtypeId> has to be unique otherwise you're overriding that vanilla blueprint.
On the<Item ... /> entries from Prerequisites and Results, the TypeId and SubtypeId have to come from the <Id> of a physical item. The xsi:type is never part of an ID and handitem definitions are not physical items.Step 2. Prepare BlueprintClassEntries
Copy BlueprintClasses.sbc to your mod, then remove all classes (the entire<BlueprintClasses> to </BlueprintClasses> section) and to only leave the <BlueprintClassEntries> section.
Then in the <BlueprintClassEntries> leave only one entry because this list is additive so all mods can declare it without breaking. Can also remove blueprints from existing classes if desired.
How it should look afterwards:
<?xml version="1.0"?>
<Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<BlueprintClassEntries>
<Entry Class="Components" BlueprintSubtypeId="ConstructionComponent" />
</BlueprintClassEntries>
</Definitions>
Step 3. Find which BlueprintClass you need
Open the game's\Content\Data\CubeBlocks\CubeBlocks_Production.sbc and find the block(s) you wish your blueprint to be part of, in their <BlueprintClasses> element.
For example:
<BlueprintClasses>
<Class>SimpleComponents</Class>
<Class>SimpleEquipment</Class>
<Class>Tools</Class>
<Class>SimpleWeapons</Class>
<Class>Consumables</Class>
</BlueprintClasses>
Note: don't copy this block SBC to your mod, you don't need to override blocks only to add blueprints!
Decide which class makes sense, and also check other production blocks as a class can be used by multiple blocks!
Once you've decided, copy the class name (which is its SubtypeId) onto the Class from your entry in step 2. If confused, refer to the full examples section below.Full Examples
<?xml version="1.0"?>
<Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Blueprints>
<Blueprint>
<Id>
<TypeId>BlueprintDefinition</TypeId>
<SubtypeId>YourFancyBlueprint</SubtypeId>
</Id>
<DisplayName>Name seen in Production UI</DisplayName>
<Icon>Textures\SomeIcon.dds</Icon>
<Prerequisites>
<Item Amount="4" TypeId="Ingot" SubtypeId="Iron" />
<Item Amount="1" TypeId="Ingot" SubtypeId="Nickel" />
<Item Amount="2" TypeId="Ingot" SubtypeId="Silicon" />
</Prerequisites>
<Results>
<Item Amount="1" TypeId="PhysicalGunObject" SubtypeId="HandDrill3Item" />
</Results>
<BaseProductionTimeInSeconds>10</BaseProductionTimeInSeconds>
</Blueprint>
</Blueprints>
<BlueprintClassEntries>
<!-- survival kit -->
<Entry Class="BasicTools" BlueprintSubtypeId="YourFancyBlueprint" />
<!-- basic assembler -->
<Entry Class="Tools" BlueprintSubtypeId="YourFancyBlueprint" />
<!-- assembler (2x1x1) -->
<Entry Class="EliteTools" BlueprintSubtypeId="YourFancyBlueprint" />
</BlueprintClassEntries>
</Definitions>
Changing existing blueprints
Same way any other definition, you copy its sbc to your mod, remove other definitions you don't want to touch then the remaining one leave its SubtypeId alone as that is what will override it, then change the things you wish to change.
Adding new classes
For this you will need either a new block or override an existing block or a script-based solution (like ModAdjuster) to partially modify a block. As for the class itself, it's like any other sbc, you copy the .sbc to your mod, remove all but one class and give it a unique subtype and customize everything about it.
Remove blueprints from existing classes
It's possible to remove blueprints from classes using the <BlueprintClassEntries> too, the process is a bit tricky because it involves opening up the self-closing tag.
Here's a full working example which removes medical component's blueprint from the SimpleComponents class, which only affects Basic Assembler.
Find the classes you need as shown in Step 3. Find which BlueprintClass you need.
<?xml version="1.0"?>
<Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<BlueprintClassEntries>
<Entry Class="SimpleComponents" BlueprintSubtypeId="MedicalComponent"> <!-- mind the ending with ">" not "/>" -->
<Enabled>false</Enabled>
</Entry>
</BlueprintClassEntries>
</Definitions>
An element ending with /> means it self-closes, so a <Tag /> is the same as <Tag></Tag>.
In this case <Enabled> has to go inside the <Entry> element therefore it should not self-close, like shown above.