Space Engineers

Space Engineers

BluePrint To Assembler
 This topic has been pinned, so it's probably important
BusDroake  [developer] 24 Apr, 2021 @ 6:26am
GUIDE: Adding custom blocks, components
Intro

I have noticed some people have problems with adding custom blocks to the script so I write this quick guide to help out with this problem.

ATTENTION: For adding custom blocks to this script you will need to check the workshop files of the custom blocks. These can be found in <<steam/steamapps/workshop/content/244850/>>.

For this walkthrough, I will be using the mod called 'Components_Zirael'.
https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=2366281046




Getting required files

As mentioned above we go to workshop folder.


In this folder search for certain .sbc files.
There should be Components.sbc and CubeBlocks.sbc.
But these can be called anything so I will just tell you search for the .sbc file with contents that look like this for Custom components.
<?xml version="1.0"?> <Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Components> <Component> <Id> <TypeId>Component</TypeId> <SubtypeId>AdminSteelPlate</SubtypeId> </Id> <DisplayName>Admin Steel Plate</DisplayName> <Icon>Textures\GUI\Icons\component\steel_plate_component.dds</Icon> <Size> <X>0.5</X> <Y>0.5</Y> <Z>0.01</Z> </Size> <Mass>1</Mass> <Volume>50000</Volume> <Model>Models\Components\steel_plate_component.mwm</Model> <PhysicalMaterial>Metal</PhysicalMaterial> <MaxIntegrity>100</MaxIntegrity> <DropProbability>0.9</DropProbability> <Health>1000000</Health> <MinimumOfferAmount>250</MinimumOfferAmount> <MaximumOfferAmount>2500</MaximumOfferAmount> <MinimumOrderAmount>100</MinimumOrderAmount> <MaximumOrderAmount>1000</MaximumOrderAmount> <CanPlayerOrder>true</CanPlayerOrder> <MinimumAcquisitionAmount>100</MinimumAcquisitionAmount> <MaximumAcquisitionAmount>1000</MaximumAcquisitionAmount> </Component> </Components> </Definitions>

And following for the custom blocks.
<?xml version="1.0" encoding="utf-8"?> <Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <CubeBlocks> <Definition xsi:type="MyObjectBuilder_CargoContainerDefinition"> <Id> <TypeId>CargoContainer</TypeId> <SubtypeId>LargeBlockLargeContainerAdmin</SubtypeId> </Id> <DisplayName>LargeAdminContainer</DisplayName> <Icon>Textures\GUI\Icons\Cubes\container_large.dds</Icon> <Description>Description_LargeCargoContainer</Description> <CubeSize>Large</CubeSize> <GuiVisible>false</GuiVisible> <BlockTopology>TriangleMesh</BlockTopology> <Size x="3" y="3" z="3" /> <ModelOffset x="0" y="0" z="0" /> <Model>Models\Cubes\Large\CargoContainerLarge.mwm</Model> <Components> <Component Subtype="Computer" Count="8" /> <Component Subtype="AdminSteelPlate" Count="1" /> </Components> <CriticalComponent Subtype="Computer" Index="0" /> <MountPoints> <MountPoint Side="Right" StartX="1" StartY="1" EndX="2" EndY="2" /> <MountPoint Side="Left" StartX="1" StartY="1" EndX="2" EndY="2" /> <MountPoint Side="Top" StartX="1" StartY="1" EndX="2" EndY="2" /> <MountPoint Side="Bottom" StartX="1" StartY="1" EndX="2" EndY="2" Default="true" /> <MountPoint Side="Front" StartX="1" StartY="1" EndX="2" EndY="2" /> <MountPoint Side="Back" StartX="1" StartY="1" EndX="2" EndY="2" /> </MountPoints> <BuildProgressModels> <Model BuildPercentUpperBound="0.33" File="Models\Cubes\Large\CargoContainerLargeConstruction_1.mwm" /> <Model BuildPercentUpperBound="0.66" File="Models\Cubes\Large\CargoContainerLargeConstruction_2.mwm" /> <Model BuildPercentUpperBound="1.00" File="Models\Cubes\Large\CargoContainerLargeConstruction_3.mwm" /> </BuildProgressModels> <BlockPairName>LargeCargoContainer</BlockPairName> <MirroringY>Z</MirroringY> <MirroringZ>Y</MirroringZ> <EdgeType>Light</EdgeType> <GeneralDamageMultiplier>0</GeneralDamageMultiplier> <BuildTimeSeconds>100</BuildTimeSeconds> <DamageEffectName>Damage_HeavyMech_Damaged</DamageEffectName> <DamagedSound>ParticleHeavyMech</DamagedSound> <DestroyEffect>BlockDestroyedExplosion_Large</DestroyEffect> <DestroySound>WepSmallWarheadExpl</DestroySound> <PCU>10</PCU> </Definition> </CubeBlocks> </Definitions>

If you have found the files we can continue.




Adding custom components to script

So when we are in game we can start to edit the script.
First of all we will add the custom components to the script.
For this we need to add a line to ComponentsKeys.
There is already a commented lin" so just delete the // in front of the line and in this case we will change this from
{22,"BlueprintSubtypeId"}
to
{22,"AdminSteelPlate"}
The AdminSteelPlate can be found in the cubeblock xml in tag Components/subtype
<Component Subtype="AdminSteelPlate" Count="1" />

If the name you have found here does not equal to the name found in the components.sbc. Found here in SubTypeId:
... <Component> <Id> <TypeId>Component</TypeId> <SubtypeId>AdminSteelPlate</SubtypeId> </Id> ...
So for example if SubtypeId here was AdminSteelPlateComponent,
then we need to add to ComponentsKeys like this:
{22,"AdminSteelPlateComponent"}

Also if this is the case then we need to add to ComponentToBlueprint like this:
,{"AdminSteelPlate","AdminSteelPlateComponent"}

To match the name given in the cubeblock xml.

ATTENTION:This is not necessary for all components visible here, only the custom components and only once. No need to add them multiple times here. ALSO don't forget the quotes!

If that is done the custom component(s) is now succesfully added to the script.




Adding custom blocks to script

So now we need to add our custom block to the script.
for this we need the CubeSize, Displayname and components from the cubeblock xml.
... <DisplayName>LargeAdminContainer</DisplayName> ... <CubeSize>Large</CubeSize> ... <Components> <Component Subtype="Computer" Count="8" /> <Component Subtype="AdminSteelPlate" Count="1" /> </Components> ...

To add the name to the script we need to form a name like this:
<<CubeSize>>_<<Displayname>> all in small letters.
So for this example this will be:
large_largeadmincontainer

now we need the ID's and count from the components in ComponentsKeys:
- Computer is already present and it is 9, we need 8
- AdminSteelPlate we just added, and that is 22, we need 1

Now we add this to customBlocks:
,{"<<made name>>", new Dictionary<int,int>(){{<<id_component>>,<<count_component>>},...}
So in this example it is:
,{"large_largeadmincontainer", new Dictionary<int,int>(){{9,8},{22,1}}

If this is done then the custom block is succesfully added. Repeat this process for every custom block in the mod, if you are using it.




Ending note

This is my first time writing a guide like this so please be gentle :p
Hope this guide will help everyone who struggles with this issue.
< >
Showing 1-1 of 1 comments
{"small_airecorder(task)",new Dictionary<int,int>(){{1,2},{9,10},{6,2},{18,4},{2,5},{3,2}}},
{"large_airecorder(task)",new Dictionary<int,int>(){{1,20},{9,20},{6,4},{18,20},{2,30},{3,20}}},
{"small_aibasic(task)",new Dictionary<int,int>(){{1,2},{9,10},{6,2},{18,4},{2,5},{3,2}}},
{"large_aibasic(task)",new Dictionary<int,int>(){{1,20},{9,20},{6,4},{18,20},{2,30},{3,20}}},
{"small_aidefensive(combat)",new Dictionary<int,int>(){{1,2},{9,10},{6,2},{18,4},{2,5},{3,2}}},
{"large_aidefensive(combat)",new Dictionary<int,int>(){{1,20},{9,20},{6,4},{18,20},{2,30},{3,20}}},
{"small_aioffensive(combat)",new Dictionary<int,int>(){{1,2},{9,10},{6,2},{18,4},{2,5},{3,2}}},
{"large_aioffensive(combat)",new Dictionary<int,int>(){{1,20},{9,20},{6,4},{18,20},{2,30},{3,20}}},
{"small_aiflight(move)",new Dictionary<int,int>(){{1,2},{9,10},{6,2},{18,4},{2,5},{3,2}}},
{"large_aiflight(move)",new Dictionary<int,int>(){{1,20},{9,20},{6,4},{18,20},{2,30},{3,20}}},
{"small_largeflatatmosphericthruster",new Dictionary<int,int>(){{1,8},{2,14},{5,2},{11,3},{6,30}}},
{"large_largeflatatmosphericthruster ",new Dictionary<int,int>(){{1,90},{2,25},{5,20},{11,15},{6,400}}},

some of the new blocks that my build required have fun with them
< >
Showing 1-1 of 1 comments
Per page: 1530 50