<?xml version="1.0" encoding="UTF-8"?>

<PropertyList>

  <path>pioneer200.ac</path>

  <nasal>
    <load>
      var livery_update = aircraft.livery_update.new("Aircraft/Pioneer-200/Models/Liveries", 10);

      var self = cmdarg();

      var float_0 = self.getNode("sim/multiplay/generic/float[0]", 1);
      var float_1 = self.getNode("sim/multiplay/generic/float[1]", 1);
      
      var crew_door = self.getNode("instrumentation/doors/crew/position-norm", 1);
      var passenger_door = self.getNode("instrumentation/doors/passenger/position-norm", 1);
    
      crew_door.alias(float_0);
      passenger_door.alias(float_1);
    </load>

    <unload>
      livery_update.stop();
      crew_door.unalias();
      passenger_door.unalias();
    </unload>
  </nasal>

  <animation>
    <!-- Objets opaques -->
    <object-name>fuselage</object-name>
    <object-name>entreesair</object-name>
    <object-name>air</object-name>
    <object-name>ailes</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>voletG</object-name>
    <object-name>voletD</object-name>
    <object-name>ailes2</object-name>
    <object-name>profondeur</object-name>
    <object-name>direction</object-name>
    <object-name>bol</object-name>
    <object-name>tourverriere</object-name>
    <object-name>cacheA</object-name>
    <object-name>cacheG</object-name>
    <object-name>cacheD</object-name>

    <object-name>helice</object-name>
    <object-name>axeA</object-name>
    <object-name>roueA</object-name>
    <object-name>axeG</object-name>
    <object-name>roueG</object-name>
    <object-name>axeD</object-name>
    <object-name>roueD</object-name>
    <object-name>trous</object-name>
    <object-name>troucacheA</object-name>
    <object-name>troucacheG</object-name>
    <object-name>troucacheD</object-name>

    <!-- Objets transparents -->
    <object-name>verriere</object-name>
    <object-name>propdisc</object-name>
    <object-name>propblur</object-name>
  </animation>

  <animation>
    <type>material</type>
    <object-name>fuselage</object-name>
    <object-name>entreesair</object-name>
    <object-name>air</object-name>
    <object-name>ailes</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>voletG</object-name>
    <object-name>voletD</object-name>
    <object-name>ailes2</object-name>
    <object-name>profondeur</object-name>
    <object-name>direction</object-name>
    <object-name>bol</object-name>
    <object-name>tourverriere</object-name>
    <object-name>cacheA</object-name>
    <object-name>cacheG</object-name>
    <object-name>cacheD</object-name>

    <object-name>helice</object-name>
    <object-name>axeA</object-name>
    <object-name>roueA</object-name>
    <object-name>axeG</object-name>
    <object-name>roueG</object-name>
    <object-name>axeD</object-name>
    <object-name>roueD</object-name>
    <object-name>trous</object-name>
    <object-name>troucacheA</object-name>
    <object-name>troucacheG</object-name>
    <object-name>troucacheD</object-name>

    <property-base>sim/model/livery</property-base>
    <texture-prop>texture</texture-prop>
    <texture>texture.png</texture>
<!--
    <diffuse>
      <red-prop>diffuse/red</red-prop>
      <green-prop>diffuse/green</green-prop>
      <blue-prop>diffuse/blue</blue-prop>
    </diffuse>

    <ambient>
      <red-prop>ambient/red</red-prop>
      <green-prop>ambient/green</green-prop>
      <blue-prop>ambient/blue</blue-prop>
    </ambient>
-->
    <specular>
      <red-prop>specular/red</red-prop>
      <green-prop>specular/green</green-prop>
      <blue-prop>specular/blue</blue-prop>
    </specular>

    <emission>
      <red-prop>emission/red</red-prop>
      <green-prop>emission/green</green-prop>
      <blue-prop>emission/blue</blue-prop>
    </emission>
<!--
    <shininess>
      <shininess-prop>shininess</shininess-prop>
    </shininess>
-->
  </animation>

  <effect>
    <inherits-from>Aircraft/Generic/Effects/Fuselagereflect</inherits-from>
    <object-name>fuselage</object-name>
    <object-name>entreesair</object-name>
    <object-name>air</object-name>
    <object-name>ailes</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>voletG</object-name>
    <object-name>voletD</object-name>
    <object-name>ailes2</object-name>
    <object-name>profondeur</object-name>
    <object-name>direction</object-name>
    <object-name>bol</object-name>
    <object-name>tourverriere</object-name>
    <object-name>cacheA</object-name>
    <object-name>cacheG</object-name>
    <object-name>cacheD</object-name>
  </effect>

  <animation>
    <type>shader</type>
    <shader>chrome</shader>
    <texture>Aircraft/Generic/Effects/glass_shader.png</texture>
    <object-name>verriere</object-name>
  </animation>

  <animation>
    <type>noshadow</type>
    <object-name>verriere</object-name>
    <object-name>propdisc</object-name>
    <object-name>propblur</object-name>
  </animation>

  <!-- Cranking effects -->
  <!-- Left -->
  <model>
    <path>Aircraft/Pioneer-200/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -2.277 </x-m>
      <y-m> -0.307 </y-m>
      <z-m> -0.269 </z-m>
      <roll-deg>    0 </roll-deg>
      <pitch-deg>  45 </pitch-deg>
      <heading-deg> 0 </heading-deg>
    </offsets>
  </model>

  <model>
    <path>Aircraft/Pioneer-200/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -2.277 </x-m>
      <y-m>  0.307 </y-m>
      <z-m> -0.269 </z-m>
      <roll-deg>    0 </roll-deg>
      <pitch-deg>  45 </pitch-deg>
      <heading-deg> 0 </heading-deg>
    </offsets>
  </model>

  <!-- Effets sur le sol -->
  <!-- Roue avant -->
  <model>
    <path>Aircraft/Pioneer-200/Models/Effects/ground/ground0.xml</path>
    <offsets>
      <x-m> -2.278 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -1.100 </z-m>
    </offsets>
  </model>

  <!-- Roue gauche -->
  <model>
    <path>Aircraft/Pioneer-200/Models/Effects/ground/ground1.xml</path>
    <offsets>
      <x-m> -0.898 </x-m>
      <y-m> -1.009 </y-m>
      <z-m> -1.084 </z-m>
    </offsets>
  </model>

  <!-- Roue de droite -->
  <model>
    <path>Aircraft/Pioneer-200/Models/Effects/ground/ground2.xml</path>   
    <offsets>
      <x-m> -0.898 </x-m>
      <y-m>  1.009 </y-m>
      <z-m> -1.084 </z-m>
    </offsets>
  </model>

  <!-- Interieur -->
  <model>
    <path>Aircraft/Pioneer-200/Models/Interior/interior.xml</path>
    <offsets>
      <x-m> 0 </x-m>
      <y-m> 0 </y-m>
      <z-m> 0 </z-m>
    </offsets>
  </model>

  <!-- Une ombre pour OSG -->
  <model>
    <name>shadowOSG</name>
    <path>Aircraft/Pioneer-200/Models/shadow.xml</path>
  </model>

  <!-- L'hélice --> 
  <!-- Séléction de l'objet visible en fonction des rpm -->
  <animation>
    <type>select</type>
    <object-name>propdisc</object-name>
    <condition>
      <greater-than>
        <property>engines/engine[0]/rpm</property>
        <value>1500</value>
      </greater-than>
    </condition>
  </animation>

  <animation>
    <type>select</type>
    <object-name>propblur</object-name>
    <condition>
    <and>
      <greater-than>
        <property>engines/engine[0]/rpm</property>
        <value>600.000</value>
      </greater-than>
      <less-than>
        <property>engines/engine[0]/rpm</property>
        <value>1500.001</value>
      </less-than>
    </and>
    </condition>
  </animation>

  <animation>
    <type>select</type>
    <object-name>helice</object-name>
    <condition>
      <less-than>
        <property>engines/engine[0]/rpm</property>
	<value>1500</value>
      </less-than>
    </condition>
  </animation>

  <animation>
    <name>HeliceComplete</name>
    <object-name>helice</object-name>
    <object-name>bol</object-name>
    <object-name>propdisc</object-name>
    <object-name>propblur</object-name>
  </animation>

  <animation>
    <type>spin</type>
    <object-name>HeliceComplete</object-name>
    <property>engines/engine[0]/rpm</property>
    <factor> 1 </factor>
    <center>
      <x-m> -2.924 </x-m>
      <y-m>  0.000 </y-m>
      <z-m>  0.107 </z-m>
    </center>
    <axis>
      <x> -1 </x>
      <y>  0 </y>
      <z>  0 </z>
    </axis>
  </animation>

  <!-- Gouverne de profondeur -->
  <animation>
    <type>rotate</type>
    <object-name>profondeur</object-name>
    <property>surface-positions/elevator-pos-norm</property>
    <factor> 11 </factor>
    <center>
      <x-m> 2.522 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 0.081 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 1 </y>
      <z> 0 </z>
    </axis>
  </animation>

  <!-- Gouverne de direction -->
  <animation>
    <type>rotate</type>
    <object-name>direction</object-name>
    <property>surface-positions/rudder-pos-norm</property>
    <factor> 20 </factor>
    <center>
      <x-m> 2.628 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 0.498 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 0 </y>
      <z> 1 </z>
    </axis>
  </animation>

  <!-- Animations des ailerons -->
  <animation>
    <type>rotate</type>
    <object-name>aileronG</object-name>
    <property>surface-positions/left-aileron-pos-norm</property>
    <factor> 15 </factor>
    <axis>
      <x1-m> -0.306 </x1-m>
      <y1-m> -3.398 </y1-m>
      <z1-m> -0.309 </z1-m>
      <x2-m> -0.306 </x2-m>
      <y2-m> -2.009 </y2-m>
      <z2-m> -0.358 </z2-m>
    </axis>
  </animation> 

  <animation>
    <type>rotate</type>
    <object-name>aileronD</object-name>
    <property>surface-positions/right-aileron-pos-norm</property>
    <factor> 15 </factor>
    <axis>
      <x1-m> -0.306 </x1-m>
      <y1-m>  2.009 </y1-m>
      <z1-m> -0.358 </z1-m>
      <x2-m> -0.306 </x2-m>
      <y2-m>  3.398 </y2-m>
      <z2-m> -0.309 </z2-m>
    </axis>
  </animation>

  <!-- Volets -->
  <animation>
    <type>rotate</type>
    <object-name>voletG</object-name>
    <property>surface-positions/flap-pos-norm</property>
    <factor> 45 </factor>
    <axis>
      <x1-m> -0.339 </x1-m>
      <y1-m> -2.011 </y1-m>
      <z1-m> -0.394 </z1-m>
      <x2-m> -0.339 </x2-m>
      <y2-m> -0.497 </y2-m>
      <z2-m> -0.447 </z2-m>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>voletD</object-name>
    <property>surface-positions/flap-pos-norm</property>
    <factor> 45 </factor>
    <axis>
      <x1-m> -0.339 </x1-m>
      <y1-m>  0.497 </y1-m>
      <z1-m> -0.447 </z1-m>
      <x2-m> -0.339 </x2-m>
      <y2-m>  2.011 </y2-m>
      <z2-m> -0.394 </z2-m>
    </axis>
  </animation>

  <!-- Compression -->
  <animation>
    <name>EnsembleA</name>
    <object-name>roueA</object-name>
    <object-name>cacheA</object-name>
    <object-name>troucacheA</object-name>
  </animation>

  <animation>
    <type>translate</type>
    <object-name>EnsembleA</object-name>
    <property>gear/gear[0]/compression-norm</property>
    <interpolation>
      <entry><ind> 0.0 </ind><dep> -0.05 </dep></entry>
      <entry><ind> 0.5 </ind><dep>  0.00 </dep></entry>
      <entry><ind> 1.0 </ind><dep>  0.15 </dep></entry>
    </interpolation>
    <axis>
      <x> 0 </x>
      <y> 0 </y>
      <z> 1 </z>
    </axis>
  </animation>

  <animation>
    <name>EnsembleG</name>
    <object-name>roueG</object-name>
    <object-name>cacheG</object-name>
    <object-name>axeG</object-name>
    <object-name>troucacheG</object-name>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>EnsembleG</object-name>
    <property>/gear/gear[1]/compression-norm</property>
    <interpolation>
      <entry><ind> 0.0 </ind><dep>   5 </dep></entry>
      <entry><ind> 0.5 </ind><dep>   0 </dep></entry>
      <entry><ind> 1.0 </ind><dep> -10 </dep></entry>
    </interpolation>
    <center>
      <x-m> -0.922 </x-m>
      <y-m> -0.377 </y-m>
      <z-m> -0.445 </z-m>
    </center>
    <axis>
      <x> 1 </x>
      <y> 0 </y>
      <z> 0 </z>
    </axis>
  </animation>

  <animation>
    <name>EnsembleD</name>
    <object-name>roueD</object-name>
    <object-name>cacheD</object-name>
    <object-name>axeD</object-name>
    <object-name>troucacheD</object-name>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>EnsembleD</object-name>
    <property>/gear/gear[2]/compression-norm</property>
    <interpolation>
      <entry><ind> 0.0 </ind><dep> -5 </dep></entry>
      <entry><ind> 0.5 </ind><dep>  0 </dep></entry>
      <entry><ind> 1.0 </ind><dep> 10 </dep></entry>
    </interpolation>
    <center>
      <x-m> -0.922 </x-m>
      <y-m>  0.377 </y-m>
      <z-m> -0.445 </z-m>
    </center>
    <axis>
      <x> 1 </x>
      <y> 0 </y>
      <z> 0 </z>
    </axis>
  </animation>

  <!-- Rotation de la roue avant en fonction de la gouverne de direction -->
  <animation>
    <type>rotate</type>
    <object-name>EnsembleA</object-name>
    <property>surface-positions/rudder-pos-norm</property>
    <factor> 10 </factor>
    <center>
      <x-m> -2.278 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.955 </z-m>
    </center>
    <axis>
      <x>  0 </x>
      <y>  0 </y>
      <z> -1 </z>
    </axis>
  </animation>

  <!-- Rotation des roues lors du roulage -->
  <animation>
    <type>spin</type>
    <object-name>roueA</object-name>
    <property>gear/gear[0]/rollspeed-ms</property>
    <factor> 30 </factor>
    <center>
      <x-m> -2.278 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.955 </z-m>
    </center>
    <axis>
      <x>  0 </x>
      <y> -1 </y>
      <z>  0 </z>
    </axis>
  </animation>

  <animation>
    <type>spin</type>
    <object-name>roueG</object-name>
    <property>gear/gear[1]/rollspeed-ms</property>
    <factor> 30 </factor>
    <center>
      <x-m> -0.898 </x-m>
      <y-m> -1.009 </y-m>
      <z-m> -0.931 </z-m>
    </center>
    <axis>
      <x>  0 </x>
      <y> -1 </y>
      <z>  0 </z>
    </axis>
  </animation>

  <animation>
    <type>spin</type>
    <object-name>roueD</object-name>
    <property>gear/gear[1]/rollspeed-ms</property>
    <factor> 30 </factor>
    <center>
      <x-m> -0.898 </x-m>
      <y-m>  1.009 </y-m>
      <z-m> -0.931 </z-m>
    </center>
    <axis>
      <x>  0 </x>
      <y> -1 </y>
      <z>  0 </z>
    </axis>
  </animation>

  <!-- Canopy -->
  <animation>
    <type>rotate</type>
    <object-name>verriere</object-name>
    <object-name>tourverriere</object-name>
    <property>instrumentation/doors/crew/position-norm</property>
    <factor> 50 </factor>
    <center>
      <x-m> -1.548 </x-m>
      <y-m>  0.000 </y-m>
      <z-m>  0.355 </z-m>
    </center>
    <axis>
      <x>  0 </x>
      <y> -1 </y>
      <z>  0 </z>
    </axis>
  </animation>

</PropertyList>

