Blockdefinition (moddinghints): Difference between revisions

From Medieval Engineers Wiki
Jump to navigation Jump to search
mNo edit summary
m (Further Explainations by Yurand2000)
Line 1: Line 1:
==General Block Definition==
This is a "MyObjectBuilder_CubeBlockDefinition" with hints and explanations. This is a community collection. Please feel free to add/correct things.  
This is a "MyObjectBuilder_CubeBlockDefinition" with hints and explanations. This is a community collection. Please feel free to add/correct things.  
 
 
<source lang="xml">
<source lang="xml">
   <Definition xsi:type="MyObjectBuilder_CubeBlockDefinition"> <!-- definition type -->
   <Definition xsi:type="MyObjectBuilder_CubeBlockDefinition"> <!-- definition type -->
Line 74: Line 75:
  </Definition>
  </Definition>
</source>
</source>
==Further Explanations==
''' Icons '''<br />
To add an icon to your block/item, simply paste the relative path to your icon. The entry folder is your mod folder.
<source lang="xml">
<Icon>Path\To\Your\Icon\File.dds</Icon>
Example (the Stone Block icon):
<Icon>Textures\GUI\Icons\cubes\StoneCube.dds</Icon>
</source>
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:
<source lang="xml">
<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>
</source>
[[Category:Community_Modding_Guides]]
[[Category:Community_Modding_Guides]]

Revision as of 14:50, 2 September 2017

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>