<?xml version="1.0" encoding="utf-8"?>
<ItemRenderer>
  <Data>
    <StateMachines>
      <StateMachine name="Facing">
        <States>
          <State name="Left"/>
          <State name="Right"/>
        </States>
        <Transitions>
          <Transition to="Left" from="Right">
            <Condition>
              <IsFacingLeft>true</IsFacingLeft>
            </Condition>
          </Transition>
          <Transition to="Right" from="Left">
            <Condition>
              <IsFacingLeft>false</IsFacingLeft>
            </Condition>
          </Transition>
        </Transitions>
      </StateMachine>

      <StateMachine name="Movement">
        <States>
          <State name="None"/>
          <State name="Horizontal" />
        </States>
        <Transitions>
          <Transition to="None" from="Horizontal">
            <Condition>
              <IsVariableFloat name="speed.x" operator="Less" abs="true">0.1</IsVariableFloat>
            </Condition>
          </Transition>
          <Transition to="Horizontal" from="None">
            <Condition>
              <IsVariableFloat name="speed.x" operator="Greater" abs="true">0.1</IsVariableFloat>
            </Condition>
          </Transition>
        </Transitions>
      </StateMachine>
    </StateMachines>


    <Sprite name="s_turbine" fileName="game/particles12.rttex" textureSize="32" frame="9,17"/>
    <Sprite name="s_backPiece" fileName="game/particles12.rttex" textureSize="32" frame="13,17"/>
    <Sprite name="s_strap" fileName="game/player_cosmetics4.rttex" textureSize="32" frame="2,7"/>
    <Sprite name="s_sideDust" fileName="game/particles10.rttex" textureSize="32" frame="25,20"/>
    <Sprite name="s_jumpCloud" fileName="game/particles10.rttex" textureSize="32" frame="26,20"/>
    <Sprite name="s_jumpSpeedlines" fileName="game/particles10.rttex" textureSize="32" frame="27,20"/>
    
    <Animations>

      <SpriteAnimation name="a_turbine" sprite="s_turbine" animTime="1200" isLoop="true" autoPlay="true">
        <Frame>9,17</Frame>
        <Frame>10,17</Frame>
        <Frame>11,17</Frame>
        <Frame>12,17</Frame>
        <Frame>11,17</Frame>
        <Frame>10,17</Frame>
      </SpriteAnimation>

      <InterpolationVec4Animation name="a_turbineRotLeftMove" variableName="turbineRotLeft" targetValue="10, 0, 0, 1" animTime="200" playOnState="Movement.Horizontal"/>
      <InterpolationVec4Animation name="a_turbineRotLeftIdle" variableName="turbineRotLeft" targetValue="0, 0, 0, 1" animTime="200" playOnState="Movement.None"/>

      <InterpolationVec4Animation name="a_turbineRotRightMove" variableName="turbineRotRight" targetValue="10, 0, 0, 1" animTime="200" playOnState="Movement.Horizontal"/>
      <InterpolationVec4Animation name="a_turbineRotRightIdle" variableName="turbineRotRight" targetValue="0, 0, 0, 1" animTime="200" playOnState="Movement.None"/>
    </Animations>
    
    <ParticleSystems>
      <ParticleSystem name="ps_sideDust" renderStage="RenderBackpack" updateStage="AddClothingParticles">
        <Emitter>
          <Set name="offset">0,0</Set>
          <Set name="emissionInterval">0.4</Set>
          <Set name="infParticles">true</Set>
          <Set name="infLifeTime">true</Set>
          <Set name="particlesPerEmission">2</Set>
          <Set name="particlesToEmit">1</Set>
          <Set name="useCharacterPos">true</Set>
        </Emitter>
        <Particle>
          <Set name="sprite">s_sideDust</Set>
          <Set name="relativeToEmitter">false</Set>
          <Set name="inSpecificOrder">true</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Curve name="initialAlpha">
            <KeyFrame>0, 1</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Curve name="initialScale">
            <KeyFrame>0, 0.75, 0.75</KeyFrame>
            <KeyFrame>1, 1.5, 1.5</KeyFrame>
          </Curve>
          <Set name="lifeTime">0.75</Set>
          <Select name="offset" input="particleIndex">
            <Item>-30, -3</Item>
            <Item>30, -3</Item>
          </Select>
          <Select name="initialVelocity" input="particleIndex">
            <Item>-20, 0</Item>
            <Item>20, 0</Item>
          </Select>
          <Select name="flipX" input="particleIndex">
            <Item>false</Item>
            <Item>true</Item>
          </Select>
        </Particle>
      </ParticleSystem>
      <ParticleSystem name="ps_jumpClouds">
        <Emitter>
          <Set name="particlesPerEmission">1</Set>
          <Set name="particlesToEmit">1</Set>
          <Set name="offset">0,0</Set>
          <Set name="useCharacterPos">true</Set>
        </Emitter>
        <Particle>
          <Set name="sprite">s_jumpCloud</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Set name="lifeTime">0.75</Set>
          <Curve name="initialAlpha">
            <KeyFrame>0, 1</KeyFrame>
            <KeyFrame>0.5, 1</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Curve name="initialScale">
            <KeyFrame>0, 0.75, 0.75</KeyFrame>
            <KeyFrame>1, 1.5, 1.5</KeyFrame>
          </Curve>
        </Particle>
      </ParticleSystem>
      <ParticleSystem name="ps_jumpSpeedlines" renderStage="RenderBackpack">
        <Emitter>
          <Set name="emissionInterval">0.5</Set>
          <Set name="infParticles">true</Set>
          <Set name="infLifeTime">true</Set>
          <Set name="particlesPerEmission">1</Set>
          <Set name="particlesToEmit">1</Set>
          <Set name="offset">0,-30</Set>
        </Emitter>
        <Particle>
          <Set name="sprite">s_jumpSpeedlines</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Set name="relativeToEmitter">true</Set>
          <Set name="lifeTime">0.5</Set>
          <Set name="renderAlignment">UPPER_CENTER</Set>
          <Set name="inSpecificOrder">true</Set>
          <Curve name="initialAlpha">
            <KeyFrame>0, 1</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Curve name="initialScale">
            <KeyFrame>0, 1, 1</KeyFrame>
            <KeyFrame>1, 1, 4</KeyFrame>
          </Curve>
        </Particle>
      </ParticleSystem>
    </ParticleSystems>

    <RenderOptions>
      <Default>
        <Set name="ShouldHover">true</Set>
      </Default>
    </RenderOptions>
    <VariableMap>
      <Set name="turbineRotLeft">0, 0, 0, 1</Set>
      <Set name="turbinePosLeft">-20, -24, 0</Set>

      <Set name="turbinePosRight">20, -24, 0</Set>
      <Set name="turbineRotRight">0, 0, 0, 1</Set>
    </VariableMap>
  </Data>

  <RenderRules>
    <Update>
      <StopIf>
        <IsZombified>true</IsZombified>
        <IsWearing slot="SHIRT">ITEM_ID_TACTICAL_STEALTH_DEVICE</IsWearing>
      </StopIf>
      <AvatarTransform class="FootPosition">
        <Set name="foot1dy">0</Set>
        <Set name="foot2dy">0</Set>
        <Set name="foot1y">0</Set>
        <Set name="foot2y">0</Set>
      </AvatarTransform>
    </Update>
    <AddClothingParticles>
      <StopIf>
        <IsRenderMod>RENDER_MOD_MINI_YOU</IsRenderMod>
      </StopIf>
      <ParticleSystemUpdate name="ps_jumpSpeedlines" onAction="JUMP"/>
    </AddClothingParticles>
    <RenderBackpack>
      <SpriteRender name="s_backPiece" scale="1,1" offset="-16.5,-16" alignment="CENTER"/>

      <Group>
        <Translate>turbinePosLeft</Translate>
        <Rotate>turbineRotLeft</Rotate>
        <SpriteRender name="s_turbine" blend="PREMULTIPLIED_ALPHA" drawShadow="true" alignment="RIGHT_CENTER"  onState="Facing.Right"/>
        <SpriteRender name="s_turbine" flip="1,0" blend="PREMULTIPLIED_ALPHA" drawShadow="true" alignment="LEFT_CENTER"  onState="Facing.Left"/>
      </Group>

      <Group>
        <Translate>turbinePosRight</Translate>
        <Rotate>turbineRotRight</Rotate>
        <SpriteRender name="s_turbine" blend="PREMULTIPLIED_ALPHA" drawShadow="true" alignment="LEFT_CENTER"  onState="Facing.Right"/>
        <SpriteRender name="s_turbine" flip="1,0" blend="PREMULTIPLIED_ALPHA" drawShadow="true" alignment="RIGHT_CENTER"  onState="Facing.Left"/>
      </Group>

      <SpriteRender name="s_backPiece" scale="1,1" offset="16,-16" flip="1,0" alignment="CENTER"/>
      
      <StopIf>
        <IsRenderMod>RENDER_MOD_MINI_YOU</IsRenderMod>
      </StopIf>

      <ParticleSystemUpdate name="ps_jumpClouds" onAction="JUMPSTART|JUMPDOUBLE"/>
    </RenderBackpack>


    <RenderFrontpack>
      <SpriteRender name="s_strap" offset="0,0" alignment="DOWN_CENTER"/>
    </RenderFrontpack>
    
  </RenderRules>
</ItemRenderer>