Blockdefinition (moddinghints): Difference between revisions

From Medieval Engineers Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This is a "MyObjectBuilder_CubeBlockDefinition" with hints and explanations. This is a community collection. Please feel free to add/correct things.  
{{SEO|description=This is a MyObjectBuilder_CubeBlockDefinition with hints and explanations. This is a community collection. Please feel free to add/correct things.}}
 
{{Version <!-- Do not change the version until the entire page is up-to-date -->
<source lang="xml">
|release=0
  <Definition xsi:type="MyObjectBuilder_CubeBlockDefinition"> <!-- definition type -->
|major=5
  <Id Type="CubeBlock" Subtype="StoneCube" /> <!-- definition id  -->
}}
  <DisplayName>DisplayName_Block_StoneBlockCube</DisplayName> <!-- display name used for the block in-game (mods don't support localization) -->
==General Block Definition==
  <BlockPairName>StoneBlockCube</BlockPairName> <!-- block pair name is used together with block position (a separate definition) to position the block within the G-screen grid -->
This is a <code>MyObjectBuilder_CubeBlockDefinition</code> with hints and explanations. This is a community collection. Please feel free to add/correct things.
  <Public>true</Public> <!-- whether or not the definition is accesible to players (Default: true) -->
 
  <Icon>Textures\GUI\Icons\cubes\StoneCube.dds</Icon> <!-- icon(s) used in the gui -->
<syntaxhighlight lang="xml" line>
  <CubeSize>Large</CubeSize> <!-- what grid size the block is using (large / small) (Default: Large) -->
  <Definition xsi:type="MyObjectBuilder_CubeBlockDefinition"> <!-- definition type -->
  <BlockTopology>TriangleMesh</BlockTopology> <!-- this can be Cube or TriangleMesh (but Cube won't work in ME, it is only useful for SE armor blocks) -->
    <Id Type="CubeBlock" Subtype="StoneCube" /> <!-- definition id  -->
  <Size x="1" y="1" z="1" /> <!-- how many blocks in each direction does the block occupy (Default: 0,0,0) (Default value will make game sad :P) -->
    <DisplayName>DisplayName_Block_StoneBlockCube</DisplayName> <!-- display name used for the block in-game (mods don't support localization) -->
  <ModelOffset x="0" y="0" z="0" /> <!-- offset of the model within the block space (Default: 0,0,0) -->
    <BlockPairName>StoneBlockCube</BlockPairName> <!-- block pair name is used together with block position (a separate definition) to position the block within the G-screen grid -->
  <Model>Models\Cubes\Large\StoneCube.mwm</Model> <!-- model for the fully built block -->
    <Public>true</Public> <!-- whether or not the definition is accesible to players (Default: true) -->
  <BuildProgressModels> <!-- building progression models -->
    <Icon>Textures\GUI\Icons\cubes\StoneCube.dds</Icon> <!-- icon(s) used in the gui -->
  <Model BuildPercentUpperBound="0.5" File="Models\Cubes\large\StoneCube_Construction_1.mwm"> <!-- What block model to use if build integrity is below specified threshold -->
    <CubeSize>Large</CubeSize> <!-- what grid size the block is using (large / small) (Default: Large) -->
  <MountPointOverrides> <!-- overrides for mountpoints, if necessary (To prevent players from attaching to the top of an unfinished block for example) -->
    <BlockTopology>TriangleMesh</BlockTopology> <!-- this can be Cube or TriangleMesh (but Cube won't work in ME, it is only useful for SE armor blocks) -->
  <MountPoint Side="Top" Enabled="false" />
    <Size x="1" y="1" z="1" /> <!-- how many blocks in each direction does the block occupy (Default: 0,0,0) (Default value will make game sad :P) -->
  </MountPointOverrides>
    <ModelOffset x="0" y="0" z="0" /> <!-- offset of the model within the block space (Default: 0,0,0) -->
  </Model>
    <Model>Models\Cubes\Large\StoneCube.mwm</Model> <!-- model for the fully built block -->
  </BuildProgressModels>
    <BuildProgressModels> <!-- building progression models -->
  <MountPoints> <!-- mount points for the block, can specify multiple for each side (Default: all sides have some kind of a mount point) -->
      <Model BuildPercentUpperBound="0.5" File="Models\Cubes\large\StoneCube_Construction_1.mwm"> <!-- What block model to use if build integrity is below specified threshold -->
    <MountPoint Side="Front" StartX="1.0324" StartY="-0.03239999" EndX="-0.032400012" EndY="1.0324" />
        <MountPointOverrides> <!-- overrides for mountpoints, if necessary (To prevent players from attaching to the top of an unfinished block for example) -->
    <MountPoint Side="Back" StartX="-0.03239999" StartY="-0.03239999" EndX="1.0324" EndY="1.0324" />
          <MountPoint Side="Top" Enabled="false" />  
    <MountPoint Side="Left" StartX="-0.03239999" StartY="-0.03239999" EndX="1.0324" EndY="1.0324" />
        </MountPointOverrides>
    <MountPoint Side="Right" StartX="1.0324" StartY="-0.03239999" EndX="-0.032400012" EndY="1.0324" />
      </Model>
    <MountPoint Side="Top" StartX="-0.03239999" StartY="1.0324" EndX="1.0324" EndY="-0.032400012" />
    </BuildProgressModels>
    <MountPoint Side="Bottom" StartX="-0.03239999" StartY="-0.03239999" EndX="1.0324" EndY="1.0324" />
    <MountPoints> <!-- mount points for the block, can specify multiple for each side (Default: all sides have some kind of a mount point) -->
  </MountPoints>
      <MountPoint Side="Front" StartX="1.0324" StartY="-0.03239999" EndX="-0.032400012" EndY="1.0324" />
  <MirroringY>Z</MirroringY> <!-- for mirrored building, I don't think is is useful for ME -->
      <MountPoint Side="Back" StartX="-0.03239999" StartY="-0.03239999" EndX="1.0324" EndY="1.0324" />
  <MirroringZ>Y</MirroringZ> <!-- (Default: None) -->
      <MountPoint Side="Left" StartX="-0.03239999" StartY="-0.03239999" EndX="1.0324" EndY="1.0324" />
  <BuildTimeSeconds>6</BuildTimeSeconds> <!-- how much time you need to build the block (Default: 10) -->
      <MountPoint Side="Right" StartX="1.0324" StartY="-0.03239999" EndX="-0.032400012" EndY="1.0324" />
  <Direction>Horizontal</Direction> <!-- I honestly don't know (Default: Both) -->
      <MountPoint Side="Top" StartX="-0.03239999" StartY="1.0324" EndX="1.0324" EndY="-0.032400012" />
  <Rotation>Vertical</Rotation> <!-- which way the block can be rotated (Default: Both) -->
      <MountPoint Side="Bottom" StartX="-0.03239999" StartY="-0.03239999" EndX="1.0324" EndY="1.0324" />
  <BuildType>Cube</BuildType> <!-- used for additional model generators (irrelevant if you don't want to use it as generated block or with generated blocks) -->
    </MountPoints>
  <PhysicalMaterial>Stone</PhysicalMaterial> <!-- physical material of the block (determines the strength of material, contact sounds, particles and maybe something else) -->
    <MirroringY>Z</MirroringY> <!-- for mirrored building, I don't think is is useful for ME -->
  <Components> <!-- components used for building one of these blocks (every block needs at least a component - integrity / total component count is used to calculate how much integrity the block can have with currently built components) -->
    <MirroringZ>Y</MirroringZ> <!-- (Default: None) -->
    <Component Tag="ScrapWood" Count="10" /> <!-- Tag = any item matching the specified tag can be used here -->
    <BuildTimeSeconds>6</BuildTimeSeconds> <!-- how much time you need to build the block (Default: 10) -->
    <Component Type="InventoryItem" Subtype="LargeStone" Count ="12" /> <!-- item with the specified defintion id needs to be used -->
    <Direction>Horizontal</Direction> <!-- I honestly don't know (Default: Both) -->
  </Components>
    <Rotation>Vertical</Rotation> <!-- which way the block can be rotated (Default: Both) -->
  <CriticalComponent Type="InventoryItem" Subtype="LargeStone" Index="0" /> <!-- used to determined at which point in building the block is 'working' (also supports tags) -->
    <BuildType>Cube</BuildType> <!-- used for additional model generators (irrelevant if you don't want to use it as generated block or with generated blocks) -->
  <RandomRotation>true</RandomRotation> <!-- can the block be rotated when placed in line or plane? (Default: false) -->
    <PhysicalMaterial>Stone</PhysicalMaterial> <!-- physical material of the block (determines the strength of material, contact sounds, particles and maybe something else) -->
  <CompoundTemplates> <!-- template for compounding (this only works for Large blocks) - (don't use if you don't want to have compound block) -->
    <Components> <!-- components used for building one of these blocks (every block needs at least a component - integrity / total component count is used to calculate how much integrity the block can have with currently built components) -->
  <Template>Cube</Template>
      <Component Tag="ScrapWood" Count="10" /> <!-- Tag = any item matching the specified tag can be used here -->
  </CompoundTemplates>
      <Component Type="InventoryItem" Subtype="LargeStone" Count ="12" /> <!-- item with the specified defintion id needs to be used -->
  <GeneratedBlocks> <!-- generated blocks when built (for the stone cube and walls it adds the corner stone pillars) (no need to use for block without additional decoration) (no used for small grids) -->
    </Components>
  <GeneratedBlock><TypeId>CubeBlock</TypeId>
    <CriticalComponent Type="InventoryItem" Subtype="LargeStone" Index="0" /> <!-- used to determined at which point in building the block is 'working' (also supports tags) -->
      <SubtypeId>GeneratedStoneSlopeEdgeLeft</SubtypeId>
    <RandomRotation>true</RandomRotation> <!-- can the block be rotated when placed in line or plane? (Default: false) -->
  </GeneratedBlock></GeneratedBlocks><MaxIntegrity>21000</MaxIntegrity> <!-- maximum integrity for the block (essentially HP) (Default: 1) -->
    <CompoundTemplates> <!-- template for compounding (this only works for Large blocks) - (don't use if you don't want to have compound block) -->
  <NavigationDefinition>Default</NavigationDefinition> <!-- not used by the game at all (was used in legacy AI pathfinding) -->
      <Template>Cube</Template>
  <BuildProgressToPlaceGeneratedBlocks>0.5</BuildProgressToPlaceGeneratedBlocks> <!-- how much of the block needs to be built for the generated blocks to be placed on it -->
    </CompoundTemplates>
    <GeneratedBlocks> <!-- generated blocks when built (for the stone cube and walls it adds the corner stone pillars) (no need to use for block without additional decoration) (no used for small grids) -->
      <GeneratedBlock>
        <TypeId>CubeBlock</TypeId>
        <SubtypeId>GeneratedStoneSlopeEdgeLeft</SubtypeId>
    </GeneratedBlock></GeneratedBlocks><MaxIntegrity>21000</MaxIntegrity> <!-- maximum integrity for the block (essentially HP) (Default: 1) -->
    <NavigationDefinition>Default</NavigationDefinition> <!-- not used by the game at all (was used in legacy AI pathfinding) -->
    <BuildProgressToPlaceGeneratedBlocks>0.5</BuildProgressToPlaceGeneratedBlocks> <!-- how much of the block needs to be built for the generated blocks to be placed on it -->
<!-- Options used for other blocks -->
  <UseModelIntersection>true</UseModelIntersection> <!-- (Default: false) -->
  <Mass>20</Mass> <!-- weight of the block (Default: 0) -->
  <AvailableInSurvival>true</AvailableInSurvival> <!-- is it buildable in survival? (Default: true) -->
  <VoxelPlacement> <!-- rules for placing the block into voxels -->
    <StaticMode>         
      <PlacementMode>Both</PlacementMode>
      <!-- None - Cannot be placed at all -->
      <!-- InVoxel - Can only be placed in voxels -->
      <!-- OutsideVoxel - Can only be placed outside voxels -->
      <!-- Both - Can be placed inside or outside voxels -->
      <!-- Volumetric - Has to be in voxel and must be in voxel sfor a certain percentage -->
      <MaxAllowed>1</MaxAllowed> <!-- maximum of block being inside voxel (0 - 1 maps to 0% - 100%) -->
      <MinAllowed>0</MinAllowed> <!-- minimum of block being inside voxel (0 - 1 maps to 0% - 100%) -->
    </StaticMode>
    <DynamicMode>
      <PlacementMode>Both</PlacementMode>
      <MaxAllowed>1</MaxAllowed>
      <MinAllowed>0</MinAllowed>
    </DynamicMode>
  </VoxelPlacement><!--Dynamic mode is dynamic placement mode (in the air I think) and Static is placing in voxel or on a static grid -->
  </Definition>
  </Definition>
  <UseModelIntersection>true</UseModelIntersection> <!-- (Default: false) -->
</syntaxhighlight>
  <Mass>20</Mass> <!-- weight of the block (Default: 0) -->
 
  <AvailableInSurvival>true</AvailableInSurvival> <!-- is it buildable in survival? (Default: true) -->
==Further Explanations==
  <VoxelPlacement> <!-- rules for placing the block into voxels -->
''' Icons '''<br />
    <StaticMode>          
To add an icon to your block/item, simply paste the relative path to your icon. The entry folder is your mod folder.
      <PlacementMode>Both</PlacementMode>
<syntaxhighlight lang="xml" line>
      <!-- None - Cannot be placed at all -->
<Icon>Path\To\Your\Icon\File.dds</Icon>
      <!-- InVoxel - Can only be placed in voxels -->
 
      <!-- OutsideVoxel - Can only be placed outside voxels -->
Example (the Stone Block icon):
      <!-- Both - Can be placed inside or outside voxels -->
<Icon>Textures\GUI\Icons\cubes\StoneCube.dds</Icon>
      <!-- Volumetric - Has to be in voxel and must be in voxel sfor a certain percentage -->
</syntaxhighlight>
      <MaxAllowed>1</MaxAllowed> <!-- maximum of block being inside voxel (0 - 1 maps to 0% - 100%) -->
 
      <MinAllowed>0</MinAllowed> <!-- minimum of block being inside voxel (0 - 1 maps to 0% - 100%) -->
You can add multiple icons to your objects, they will overlap each others and use transparency as according.
    </StaticMode>
The last icons will overlap the first ones written in the definition file. You can use them as following:
    <DynamicMode>
<syntaxhighlight lang="xml" line>
      <PlacementMode>Both</PlacementMode>
<Icon>First\Icon\Printed.dds</Icon>
      <MaxAllowed>1</MaxAllowed>
<Icon>Second\Icon\Printed.dds</Icon>
      <MinAllowed>0</MinAllowed>
<Icon>Third\Icon\Printed.dds</Icon>
    </DynamicMode>
 
  </VoxelPlacement><!--Dynamic mode is dynamic placement mode (in the air I think) and Static is placing in voxel or on a static grid -->
Example (Seed Bags icons):
</source>
<Icon>Textures\GUI\Icons\ToolsAndWeapons\SeedBag.dds</Icon>
<Icon>Textures\GUI\Icons\Consumables\Cabbage.dds</Icon>
</syntaxhighlight>
 
[[Category:Community_Guides]]

Latest revision as of 20:05, 18 July 2022


Version: 0.5

General Block Definition

This is a MyObjectBuilder_CubeBlockDefinition with hints and explanations. This is a community collection. Please feel free to add/correct things.

  <Definition xsi:type="MyObjectBuilder_CubeBlockDefinition"> <!-- definition type -->
    <Id Type="CubeBlock" Subtype="StoneCube" /> <!-- definition id  -->
    <DisplayName>DisplayName_Block_StoneBlockCube</DisplayName> <!-- display name used for the block in-game (mods don't support localization) -->
    <BlockPairName>StoneBlockCube</BlockPairName> <!-- block pair name is used together with block position (a separate definition) to position the block within the G-screen grid -->
    <Public>true</Public> <!-- whether or not the definition is accesible to players (Default: true) -->
    <Icon>Textures\GUI\Icons\cubes\StoneCube.dds</Icon> <!-- icon(s) used in the gui -->
    <CubeSize>Large</CubeSize> <!-- what grid size the block is using (large / small) (Default: Large) -->
    <BlockTopology>TriangleMesh</BlockTopology> <!-- this can be Cube or TriangleMesh (but Cube won't work in ME, it is only useful for SE armor blocks) -->
    <Size x="1" y="1" z="1" /> <!-- how many blocks in each direction does the block occupy (Default: 0,0,0) (Default value will make game sad :P) -->
    <ModelOffset x="0" y="0" z="0" /> <!-- offset of the model within the block space (Default: 0,0,0) -->
    <Model>Models\Cubes\Large\StoneCube.mwm</Model> <!-- model for the fully built block -->
    <BuildProgressModels> <!-- building progression models -->
      <Model BuildPercentUpperBound="0.5" File="Models\Cubes\large\StoneCube_Construction_1.mwm"> <!-- What block model to use if build integrity is below specified threshold -->
        <MountPointOverrides> <!-- overrides for mountpoints, if necessary (To prevent players from attaching to the top of an unfinished block for example) -->
          <MountPoint Side="Top" Enabled="false" /> 
        </MountPointOverrides>
      </Model>
    </BuildProgressModels>
    <MountPoints> <!-- mount points for the block, can specify multiple for each side (Default: all sides have some kind of a mount point) -->
      <MountPoint Side="Front" StartX="1.0324" StartY="-0.03239999" EndX="-0.032400012" EndY="1.0324" />
      <MountPoint Side="Back" StartX="-0.03239999" StartY="-0.03239999" EndX="1.0324" EndY="1.0324" />
      <MountPoint Side="Left" StartX="-0.03239999" StartY="-0.03239999" EndX="1.0324" EndY="1.0324" />
      <MountPoint Side="Right" StartX="1.0324" StartY="-0.03239999" EndX="-0.032400012" EndY="1.0324" />
      <MountPoint Side="Top" StartX="-0.03239999" StartY="1.0324" EndX="1.0324" EndY="-0.032400012" />
      <MountPoint Side="Bottom" StartX="-0.03239999" StartY="-0.03239999" EndX="1.0324" EndY="1.0324" />
    </MountPoints>
    <MirroringY>Z</MirroringY> <!-- for mirrored building, I don't think is is useful for ME -->
    <MirroringZ>Y</MirroringZ> <!-- (Default: None) -->
    <BuildTimeSeconds>6</BuildTimeSeconds> <!-- how much time you need to build the block (Default: 10) -->
    <Direction>Horizontal</Direction> <!-- I honestly don't know (Default: Both) -->
    <Rotation>Vertical</Rotation> <!-- which way the block can be rotated (Default: Both) -->
    <BuildType>Cube</BuildType> <!-- used for additional model generators (irrelevant if you don't want to use it as generated block or with generated blocks) -->
    <PhysicalMaterial>Stone</PhysicalMaterial> <!-- physical material of the block (determines the strength of material, contact sounds, particles and maybe something else) -->
    <Components> <!-- components used for building one of these blocks (every block needs at least a component - integrity / total component count is used to calculate how much integrity the block can have with currently built components) -->
      <Component Tag="ScrapWood" Count="10" /> <!-- Tag = any item matching the specified tag can be used here -->
      <Component Type="InventoryItem" Subtype="LargeStone" Count ="12" /> <!-- item with the specified defintion id needs to be used -->
    </Components>
    <CriticalComponent Type="InventoryItem" Subtype="LargeStone" Index="0" /> <!-- used to determined at which point in building the block is 'working' (also supports tags) -->
    <RandomRotation>true</RandomRotation> <!-- can the block be rotated when placed in line or plane? (Default: false) -->
    <CompoundTemplates> <!-- template for compounding (this only works for Large blocks) - (don't use if you don't want to have compound block) -->
      <Template>Cube</Template>
    </CompoundTemplates>
    <GeneratedBlocks> <!-- generated blocks when built (for the stone cube and walls it adds the corner stone pillars) (no need to use for block without additional decoration) (no used for small grids) -->
      <GeneratedBlock>
        <TypeId>CubeBlock</TypeId>
        <SubtypeId>GeneratedStoneSlopeEdgeLeft</SubtypeId>
    </GeneratedBlock></GeneratedBlocks><MaxIntegrity>21000</MaxIntegrity> <!-- maximum integrity for the block (essentially HP) (Default: 1) -->
    <NavigationDefinition>Default</NavigationDefinition> <!-- not used by the game at all (was used in legacy AI pathfinding) -->
    <BuildProgressToPlaceGeneratedBlocks>0.5</BuildProgressToPlaceGeneratedBlocks> <!-- how much of the block needs to be built for the generated blocks to be placed on it -->
<!-- Options used for other blocks -->
  <UseModelIntersection>true</UseModelIntersection> <!-- (Default: false) -->
  <Mass>20</Mass> <!-- weight of the block (Default: 0) -->
  <AvailableInSurvival>true</AvailableInSurvival> <!-- is it buildable in survival? (Default: true) -->
  <VoxelPlacement> <!-- rules for placing the block into voxels -->
    <StaticMode>           
      <PlacementMode>Both</PlacementMode>
      <!-- None - Cannot be placed at all -->
      <!-- InVoxel - Can only be placed in voxels -->
      <!-- OutsideVoxel - Can only be placed outside voxels -->
      <!-- Both - Can be placed inside or outside voxels -->
      <!-- Volumetric - Has to be in voxel and must be in voxel sfor a certain percentage -->
      <MaxAllowed>1</MaxAllowed> <!-- maximum of block being inside voxel (0 - 1 maps to 0% - 100%) -->
      <MinAllowed>0</MinAllowed> <!-- minimum of block being inside voxel (0 - 1 maps to 0% - 100%) -->
    </StaticMode>
    <DynamicMode>
      <PlacementMode>Both</PlacementMode>
      <MaxAllowed>1</MaxAllowed>
      <MinAllowed>0</MinAllowed>
    </DynamicMode>
  </VoxelPlacement><!--Dynamic mode is dynamic placement mode (in the air I think) and Static is placing in voxel or on a static grid -->
 </Definition>

Further Explanations

Icons
To add an icon to your block/item, simply paste the relative path to your icon. The entry folder is your mod folder.

<Icon>Path\To\Your\Icon\File.dds</Icon>

Example (the Stone Block icon):
<Icon>Textures\GUI\Icons\cubes\StoneCube.dds</Icon>

You can add multiple icons to your objects, they will overlap each others and use transparency as according. The last icons will overlap the first ones written in the definition file. You can use them as following:

<Icon>First\Icon\Printed.dds</Icon>
<Icon>Second\Icon\Printed.dds</Icon>
<Icon>Third\Icon\Printed.dds</Icon>

Example (Seed Bags icons):
<Icon>Textures\GUI\Icons\ToolsAndWeapons\SeedBag.dds</Icon>
<Icon>Textures\GUI\Icons\Consumables\Cabbage.dds</Icon>