Skip to content

Example Definition

Ashley Bennett edited this page Mar 7, 2024 · 11 revisions

This is an example definition for a multi-tool with Weld, Grind, and Drill functionality. The Grind and Drill modes share the same definition, and so will have the same settings and animations. The Weld mode has a separate definition with different settings. Of course, this is only an example - you could create a tool that has only one definition, or three.

<?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_ConveyorSorterDefinition">
            <Id>
                <TypeId>ConveyorSorter</TypeId>
                <SubtypeId>TestToolSorter</SubtypeId>
            </Id>
            <DisplayName>Test Tool Sorter</DisplayName>
            <Icon>Textures\GUI\Icons\Cubes\ConveyorSorterLarge.dds</Icon>
            <Description>Description_ConveyorSorter</Description>
            <CubeSize>Large</CubeSize>
            <GuiVisible>false</GuiVisible>
            <BlockTopology>TriangleMesh</BlockTopology>
            <Size x="1" y="1" z="3" />
            <ModelOffset x="0" y="0" z="0" />
            <Model>Models\Cubes\Large\drill.mwm</Model>
            <Components>
                <Component Subtype="InteriorPlate" Count="40" />
                <Component Subtype="Construction" Count="100" />
                <Component Subtype="SmallTube" Count="50" />
                <Component Subtype="Computer" Count="20" />
                <Component Subtype="Motor" Count="2" />
                <Component Subtype="Construction" Count="20" />
                <Component Subtype="InteriorPlate" Count="10" />
            </Components>
            <CriticalComponent Subtype="Motor" Index="0" />
            <BuildProgressModels>
                <Model BuildPercentUpperBound="0.33" File="Models\Cubes\Large\DrillConstruction_1.mwm" />
                <Model BuildPercentUpperBound="0.66" File="Models\Cubes\Large\DrillConstruction_2.mwm" />
                <Model BuildPercentUpperBound="1.00" File="Models\Cubes\Large\DrillConstruction_3.mwm" />
            </BuildProgressModels>

            <ToolValues Type="Weld">
                <EffectShape>Line</EffectShape>
                <WorkOrder>Forward</WorkOrder>
                <WorkOrigin>Emitter</WorkOrigin>
                <Emitter>subpart_DrillHead</Emitter>
                <Offset x="0" y="0" z="-4" />
                <Length>50</Length>
                <Speed>2.5</Speed>
                <WorkRate>10</WorkRate>
                <AffectOwnGrid>true</AffectOwnGrid>
                <Debug>false</Debug>
                <Action Type="Primary" SizeRatio="1" SpeedRatio="1" HarvestRatio="1" />
                <Action Type="Secondary" SizeRatio="3" SpeedRatio="1" HarvestRatio="0" />
                <Event Trigger="Firing">
                    <Animation>
                        <Subpart>DrillHead</Subpart>
                        <AnimationType>Rotate</AnimationType>
                        <Direction x="0" y="0" z="-1" />
                        <Speed>100</Speed>
                        <WindupTime>60</WindupTime>
                    </Animation>
                    <Beam>
                        <Start>subpart_DrillHead</Start>
                        <EndLocation>Hit</EndLocation>
                        <Material>WeaponLaser</Material>
                        <Width>0.3</Width>
                        <Color>
                            <X>5</X>
                            <Y>10</Y>
                            <Z>69</Z>
                            <W>1</W>
                        </Color>
                    </Beam>
                    <Sound>
                        <Name>ToolLrgWeldIdle</Name>
                    </Sound>
                </Event>
                <Event Trigger="RayHit">
                    <ParticleEffect>
                        <Name>ShipWelderArc</Name>
                        <Location>Hit</Location>
                        <Dummy>subpart_DrillHead</Dummy>
                        <Offset x="0" y="0" z="-4" />
                    </ParticleEffect>
                    <Sound>
                        <Name>ToolLrgWeldMetal</Name>
                    </Sound>
                </Event>
                <MaterialSpecificModifiers>
                    <Material Category="Sand" SpeedRatio="0.5" HarvestRatio="1.3"/>
                    <Material Category="Soil" SpeedRatio="5" HarvestRatio="0.2"/>
                </MaterialSpecificModifiers>
            </ToolValues>

            <ToolValues Type="Grind Drill">
                <EffectShape>Line</EffectShape>
                <WorkOrder>Forward</WorkOrder>
                <WorkOrigin>Emitter</WorkOrigin>
                <Emitter>subpart_DrillHead</Emitter>
                <Offset x="0" y="0" z="-4" />
                <Radius>5</Radius>
                <Length>50</Length>
                <Speed>1</Speed>
                <WorkRate>5</WorkRate>
                <Debug>false</Debug>
                <Action Type="Primary" SizeRatio="1" SpeedRatio="1" HarvestRatio="1" />
                <Action Type="Secondary" SizeRatio="3" SpeedRatio="1" HarvestRatio="0" />
                <Event Trigger="Firing">
                    <Animation>
                        <Subpart>DrillHead</Subpart>
                        <AnimationType>Rotate</AnimationType>
                        <Direction x="0" y="0" z="-1" />
                        <Speed>100</Speed>
                        <WindupTime>60</WindupTime>
                    </Animation>
                    <Beam>
                        <Start>subpart_DrillHead</Start>
                        <EndLocation>Forward</EndLocation>
                        <Material>WeaponLaser</Material>
                        <Width>0.3</Width>
                        <Color>
                            <X>69</X>
                            <Y>10</Y>
                            <Z>5</Z>
                            <W>1</W>
                        </Color>
                    </Beam>
                    <Sound>
                        <Name>ToolLrgGrindIdle</Name>
                    </Sound>
                </Event>
                <Event Trigger="RayHit">
                    <ParticleEffect>
                        <Name>MaterialProperties/Grinder</Name>
                        <Location>Hit</Location>
                        <Dummy>subpart_DrillHead</Dummy>
                        <Offset x="0" y="0" z="-4" />
                    </ParticleEffect>
                    <Sound>
                        <Name>MaterialProperties/Grinder</Name>
                    </Sound>
                </Event>
                <MaterialSpecificModifiers>
                    <Material Category="Sand" SpeedRatio="0.5" HarvestRatio="1.3"/>
                    <Material Category="Soil" SpeedRatio="5" HarvestRatio="0.2"/>
                </MaterialSpecificModifiers>
            </ToolValues>

            <BlockPairName>TestToolSorter</BlockPairName>
            <MirroringY>Z</MirroringY>
            <MirroringZ>Y</MirroringZ>
            <EdgeType>Light</EdgeType>
            <BuildTimeSeconds>20</BuildTimeSeconds>
            <DamageEffectName>Damage_HeavyMech_Damaged</DamageEffectName>
            <DamagedSound>ParticleHeavyMech</DamagedSound>
            <ResourceSinkGroup>Conveyors</ResourceSinkGroup>
            <PowerInput>0.00025</PowerInput>
            <InventorySize>
                <X>5</X>
                <Y>1</Y>
                <Z>1</Z>
            </InventorySize>
            <EmissiveColorPreset>Default</EmissiveColorPreset>
            <DamageEffectName>Damage_HeavyMech_Damaged</DamageEffectName>
            <DamagedSound>ParticleHeavyMech</DamagedSound>
            <DestroyEffect>BlockDestroyedExplosion_Large</DestroyEffect>
            <DestroySound>WepSmallWarheadExpl</DestroySound>
            <PCU>25</PCU>
            <IsAirTight>true</IsAirTight>
        </Definition>
    </CubeBlocks>
</Definitions>
Clone this wiki locally