﻿<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<vehicle type="stumpCutterCultivatorPlow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../shared/xml/schema/vehicle.xsd">
    <annotation>Copyright (C) GIANTS Software GmbH, All Rights Reserved.</annotation>

    <storeData>
        <name>M650</name>
        <specs>
            <neededPower>200</neededPower>
            <workingWidth>2.3</workingWidth>
            <combination filterCategory="weights" filterSpec="weight" filterSpecMin="1300" filterSpecMax="1500"/>
            <combination xmlFilename="$data/vehicles/prinoth/raptor300/raptor300.xml" />
        </specs>
        <functions>
            <function>$l10n_function_forestryMulcher</function>
        </functions>
        <rotation>0</rotation>
        <image>$data/vehicles/prinoth/m650/store_m650.png</image>
        <price>41000</price>
        <lifetime>600</lifetime>
        <brand>PRINOTH</brand>
        <category>wood</category>
        <shopTranslationOffset>0 0 0</shopTranslationOffset>
        <shopRotationOffset>-0.113 0 0</shopRotationOffset>
        <vertexBufferMemoryUsage>1047552</vertexBufferMemoryUsage>
        <indexBufferMemoryUsage>167168</indexBufferMemoryUsage>
        <textureMemoryUsage>1310720</textureMemoryUsage>
        <instanceVertexBufferMemoryUsage>0</instanceVertexBufferMemoryUsage>
        <instanceIndexBufferMemoryUsage>0</instanceIndexBufferMemoryUsage>
        <audioMemoryUsage>0</audioMemoryUsage>
    </storeData>

    <base>
        <typeDesc>$l10n_typeDesc_forestryMulcher</typeDesc>
        <filename>$data/vehicles/prinoth/m650/m650.i3d</filename>
        <size width="3.2" length="3"/>
        <speedLimit value="6"/>
        <components>
            <component centerOfMass="0 0.3 0" solverIterationCount="10" mass="2900" />
        </components>
        <schemaOverlay attacherJointPosition="0 0" name="IMPLEMENT" />
        <mapHotspot type="TOOL" />
    </base>

    <attachable>
        <inputAttacherJoints>
            <inputAttacherJoint node="attacherJoint" jointType="implement" topReferenceNode="topReferenceNode" lowerRotLimitScale="0 0 0" upperRotationOffset="25" lowerRotationOffset="-5" needsLowering="false" >
                <distanceToGround lower="0.4" upper="0.8"/>
            </inputAttacherJoint>
        </inputAttacherJoints>
        <support animationName="moveSupport" />
    </attachable>

    <connectionHoses>
        <hose inputAttacherJointIndices="1" type="hydraulicIn"  node="hydraulicIn01"  length="1.1" diameter="0.02" straighteningFactor="1" outgoingAdapter="DEFAULT">
            <objectChange node="hydraulicIn01_attached" visibilityActive="false" visibilityInactive="true"/>
        </hose>
        <hose inputAttacherJointIndices="1" type="hydraulicOut" node="hydraulicOut01" length="1.1" diameter="0.02" straighteningFactor="1" outgoingAdapter="DEFAULT">
            <objectChange node="hydraulicOut01_attached" visibilityActive="false" visibilityInactive="true"/>
        </hose>
        <hose inputAttacherJointIndices="1" type="hydraulicIn"  node="hydraulicIn02"  length="1.1" diameter="0.02" straighteningFactor="1" outgoingAdapter="DEFAULT">
            <objectChange node="hydraulicIn02_attached" visibilityActive="false" visibilityInactive="true"/>
        </hose>
        <hose inputAttacherJointIndices="1" type="hydraulicOut" node="hydraulicOut02" length="1.1" diameter="0.02" straighteningFactor="1" outgoingAdapter="DEFAULT">
            <objectChange node="hydraulicOut02_attached" visibilityActive="false" visibilityInactive="true"/>
        </hose>
    </connectionHoses>

    <powerConsumer ptoRpm="540" neededMinPtoPower="80" neededMaxPtoPower="100"/> <!-- max is used while cutting trees and bushes -->

    <powerTakeOffs>
        <input inputAttacherJointIndices="1" inputNode="pto" detachNode="ptoDetachNode" aboveAttacher="true" />
    </powerTakeOffs>

    <groundReferenceNodes>
        <groundReferenceNode node="groundReferenceNode" threshold="0.1" forceFactor="1" />
        <groundReferenceNode node="groundReferenceNodeArm" threshold="0.1" forceFactor="2" />
    </groundReferenceNodes>

    <workAreas>
        <!-- must be the first area for bush cutting, otherwise cultivator removed bushes already-->
        <workArea type="stumpCutter" functionName="processStumpCutterArea" disableBackwards="false">
            <area startNode="start" widthNode="width" heightNode="height" />
            <groundReferenceNode index="1" />
            <onlyActiveWhenLowered value="false"/>
        </workArea>
        <workArea type="cultivator" functionName="processCultivatorArea" disableBackwards="false">
            <area startNode="start" widthNode="width" heightNode="height" />
            <groundReferenceNode index="1" />
            <onlyActiveWhenLowered value="true"/>
        </workArea>
        <workArea type="plow" functionName="processPlowArea" needsSetIsTurnedOn="false" >
            <area startNode="startArm" widthNode="widthArm" heightNode="heightArm" />
            <groundReferenceNode index="2" />
            <onlyActiveWhenLowered value="true"/>
        </workArea>
    </workAreas>

    <workParticles>
        <effect workAreaIndex="1" activeDirection="0" needsSetIsTurnedOn="true">
            <effectNode effectClass="CultivatorMotionPathEffect" effectType="CULTIVATOR" linkNode="tineEffect01LinkNode">
                <motionPathEffect textureFilename="$data/vehicles/tmcCancela/tfk200/tineEffect01Array.dds" numRows="20" rowLength="18" density="1" speedScale="2" shapeScale="0.8" maxShapeScale="0.8"/>
            </effectNode>
        </effect>

        <particle>
            <node node="smokeEmitter" refNodeIndex="1" particleType="SOIL_SMOKE" emitCountScale="1.0" />
        </particle>
    </workParticles>

    <animations>
        <animation name="moveSupport">
            <part node="arm" startTime="0" endTime="0.5" startRot="0 0 0" endRot="0 0 0" />
            <part node="supportCol" startTime="0" endTime="0.2" startTrans="0 0.287 0" endTrans="0 0 0" />
            <part node="supportArm" startTime="0.00" endTime="0.05" visibility="false" />
            <part node="supportArm" startTime="0.05" endTime="0.10" visibility="true" />

            <sound template="clackVar5" startTime="0.49" pitchScale="1.3" volumeScale="1.6" linkNode="attacherJoint"/>
            <sound template="latchSmall" startTime="0.49" pitchScale="1.6" volumeScale="0.5" linkNode="attacherJoint"/>
        </animation>
    </animations>

    <cylindered>
        <movingTools>
            <movingTool node="arm" >
                <controls axis="AXIS_FRONTLOADER_TOOL" invertAxis="false" mouseSpeedFactor="0.4" iconName="FRONTLOADER_ARM_ROTATE" />
                <rotation rotSpeed="30" rotAcceleration="170" rotMax="0" rotMin="-95" rotationAxis="1" startRot="0"/>
                <dependentPart node="armHydraulic" />
                <dependentMovingTool node="backFlap">
                    <rotationBasedLimits>
                        <limit rotation="-95" rotMax="35"  rotMin="0" />
                        <limit rotation="-40" rotMax="118" rotMin="0" />
                    </rotationBasedLimits>
                </dependentMovingTool>
            </movingTool>
            <movingTool node="backFlap" >
                <controls axis="AXIS_FRONTLOADER_ARM" invertAxis="false" mouseSpeedFactor="0.7" iconName="TOOL_OPEN_CLOSE" />
                <rotation rotSpeed="40" rotAcceleration="170" rotMax="118" rotMin="0" rotationAxis="1" syncMinRotLimits="true" syncMaxRotLimits="true"/>
                <dependentPart node="backFlapHydraulic" />
            </movingTool>
        </movingTools>

        <movingParts>
            <movingPart node="armHydraulic" referencePoint="armHydraulicRef" referenceFrame="armHydraulicRef" playSound="true" >
                <translatingPart node="armHydraulicPunch" />
            </movingPart>
            <movingPart node="backFlapHydraulic" referencePoint="backFlapHydraulicRef" referenceFrame="backFlapHydraulicRef" playSound="true" >
                <translatingPart node="backFlapHydraulicPunch" />
            </movingPart>
        </movingParts>

        <sounds>
            <actionSound template="hydraulicLayerTone"    pitchScale="0.6" volumeScale="2"   linkNode="arm"      actionNames="TOOL_MOVE_POS TOOL_MOVE_NEG" nodes="arm"      fadeIn="0.1" fadeOut="0.1"/>
            <actionSound template="defaultHydraulicSound" pitchScale="0.8" volumeScale="1.6" linkNode="backFlap" actionNames="TOOL_MOVE_POS TOOL_MOVE_NEG" nodes="backFlap" fadeIn="0.1" fadeOut="0.1"/>
            <actionSound template="sheetImp02"            pitchScale="0.8" volumeScale="2"   linkNode="arm"      actionNames="TOOL_MOVE_END_POS_LIMIT"     nodes="arm"/>
            <actionSound template="clackVar6"             pitchScale="0.7" volumeScale="2"   linkNode="arm"      actionNames="TOOL_MOVE_END_POS_LIMIT"     nodes="arm"/>
            <actionSound template="clackVar6"             pitchScale="0.6" volumeScale="1.7" linkNode="arm"      actionNames="TOOL_MOVE_END_NEG_LIMIT"     nodes="arm"/>
            <actionSound template="sheetImp02"            pitchScale="0.8" volumeScale="2.3" linkNode="arm"      actionNames="TOOL_MOVE_END_NEG_LIMIT"     nodes="arm"/>
            <actionSound template="sheetImp02"            pitchScale="1"   volumeScale="2.3" linkNode="backFlap" actionNames="TOOL_MOVE_END_NEG_LIMIT"     nodes="backFlap"/>
            <actionSound template="clackVar6"             pitchScale="1"   volumeScale="1"   linkNode="backFlap" actionNames="TOOL_MOVE_END_NEG_LIMIT"     nodes="backFlap"/>
            <actionSound template="sheetImp02"            pitchScale="1.4" volumeScale="2.3" linkNode="backFlap" actionNames="TOOL_MOVE_END_POS_LIMIT"     nodes="backFlap"/>
        </sounds>
    </cylindered>

    <cultivator useDeepMode="true">
        <onlyActiveWhenLowered value="false" />
        <sounds>
            <work file="$data/vehicles/prinoth/m650/sounds/mulcher_ground_loop.wav" linkNode="m650_main_component1" innerRadius="5.0" outerRadius="70.0" fadeOut="0.1">
                <volume indoor="0.4" outdoor="1.2" />
                <pitch indoor="1.0" outdoor="1.0" />
                <lowpassGain indoor="0.3" outdoor="1.0" />
            </work>
        </sounds>
    </cultivator>

    <plow>
        <onlyActiveWhenLowered value="false" />
        <sounds>
            <work template="DEFAULT_PLOW_WORK" linkNode="m650_main_component1" />
        </sounds>
    </plow>

    <stumpCutter>
        <cutNode node="cutNode" cutSizeY="2.0" cutSizeZ="2.5" maxCutTime="0.1" maxResetCutTime="0.001" workAreaIndex="1"/>
        <cutNode node="cutNodeFront" cutSizeY="2.0" cutSizeZ="0.9" maxCutTime="0.1" maxResetCutTime="0.001" />
        <cutNode node="cutNodeBack" cutSizeY="2.0" cutSizeZ="0.9" maxCutTime="0.1" maxResetCutTime="0.001" />

        <effects>
            <effectNode effectClass="ParticleEffect" effectNode="emitterShapeWood" particleType="CRUSHER_WOOD" emitCountScale="1"/>
            <effectNode effectClass="ParticleEffect" effectNode="emitterShapeDust" particleType="CRUSHER_DUST" emitCountScale="0.3"/>
        </effects>

        <sounds>
            <start template="STUMP_CUTTER_START" linkNode="m650_main_component1" />
            <idle template="STUMP_CUTTER_IDLE" linkNode="m650_main_component1" />
            <work file="$data/vehicles/prinoth/m650/sounds/mulcher_work_loop.wav" linkNode="m650_main_component1" innerRadius="5.0" outerRadius="80.0" fadeOut="0.1">
                <volume indoor="0.5" outdoor="1.50" />
                <pitch indoor="1.0" outdoor="1.0" />
                <lowpassGain indoor="0.50" outdoor="1.00" />
            </work>
            <stop template="STUMP_CUTTER_STOP" linkNode="m650_main_component1" />
        </sounds>
    </stumpCutter>

    <turnOnVehicle turnOffIfNotAllowed="true">
        <animationNodes>
            <animationNode node="cutterWheel" rotSpeed="-1800" rotAxis="1" turnOnFadeTime="2" turnOffFadeTime="5"/>
        </animationNodes>
    </turnOnVehicle>

    <ai>
        <agentAttachment width="2.6" height="1.7" length="1.5" lengthOffset="0"/>
    </ai>

    <foliageBending>
        <bendingNode minX="-1.3" maxX="1.3" minZ="-0.7" maxZ="0.75" yOffset="0.1" />
        <bendingNode minX="-1.25" maxX="1.25" minZ="-0.75" maxZ="0" yOffset="0.8" node="arm" />
    </foliageBending>

    <baseMaterial>
        <material name="m650_mat" baseNode="m650_vis">
            <shaderParameter name="colorMat0" value="PRINOTH_RED1"/>
        </material>
    </baseMaterial>

    <wearable wearDuration="480" workMultiplier="5" fieldMultiplier="2"/>
    <washable dirtDuration="90" washDuration="1" workMultiplier="2" fieldMultiplier="2"/>

    <i3dMappings>
        <i3dMapping id="m650_main_component1" node="0>" />
        <i3dMapping id="m650_vis" node="0>0" />
        <i3dMapping id="attacherJoint" node="0>0|0|0" />
        <i3dMapping id="topReferenceNode" node="0>0|0|1" />
        <i3dMapping id="supportCol" node="0>0|0|2|0" />
        <i3dMapping id="supportArm" node="0>0|0|2|1" />
        <i3dMapping id="pto" node="0>0|0|3|0" />
        <i3dMapping id="ptoDetachNode" node="0>0|0|3|1" />
        <i3dMapping id="hydraulicIn01_attached" node="0>0|0|4|0" />
        <i3dMapping id="hydraulicOut01_attached" node="0>0|0|4|1" />
        <i3dMapping id="hydraulicIn02_attached" node="0>0|0|4|2" />
        <i3dMapping id="hydraulicOut02_attached" node="0>0|0|4|3" />
        <i3dMapping id="hydraulicOut02" node="0>0|0|4|4" />
        <i3dMapping id="hydraulicIn02" node="0>0|0|4|5" />
        <i3dMapping id="hydraulicIn01" node="0>0|0|4|6" />
        <i3dMapping id="hydraulicOut01" node="0>0|0|4|7" />
        <i3dMapping id="arm" node="0>0|1|0" />
        <i3dMapping id="armHydraulicRef" node="0>0|1|0|0" />
        <i3dMapping id="startArm" node="0>0|1|0|1|0" />
        <i3dMapping id="widthArm" node="0>0|1|0|1|1" />
        <i3dMapping id="heightArm" node="0>0|1|0|1|2" />
        <i3dMapping id="groundReferenceNodeArm" node="0>0|1|0|1|3" />
        <i3dMapping id="backFlap" node="0>0|1|1" />
        <i3dMapping id="backFlapHydraulicRef" node="0>0|1|1|3" />
        <i3dMapping id="cutterWheel" node="0>0|1|2" />
        <i3dMapping id="chain1" node="0>0|1|3" />
        <i3dMapping id="chain2" node="0>0|1|4" />
        <i3dMapping id="armHydraulic" node="0>0|2|0" />
        <i3dMapping id="armHydraulicPunch" node="0>0|2|0|0" />
        <i3dMapping id="backFlapHydraulic" node="0>0|2|1" />
        <i3dMapping id="backFlapHydraulicPunch" node="0>0|2|1|0" />
        <i3dMapping id="start" node="0>0|3|0" />
        <i3dMapping id="width" node="0>0|3|1" />
        <i3dMapping id="height" node="0>0|3|2" />
        <i3dMapping id="groundReferenceNode" node="0>0|3|3" />
        <i3dMapping id="smokeEmitter" node="0>0|4|0" />
        <i3dMapping id="emitterShapeWood" node="0>0|4|1" />
        <i3dMapping id="emitterShapeDust" node="0>0|4|2" />
        <i3dMapping id="tineEffect01LinkNode" node="0>0|4|3" />
        <i3dMapping id="cutNode" node="0>0|5|0" />
        <i3dMapping id="cutNodeFront" node="0>0|5|1" />
        <i3dMapping id="cutNodeBack" node="0>0|5|2" />
    </i3dMappings>
</vehicle>
