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

<PropertyList>

  <path>pa32.ac</path>

  <nasal>
    <load>
      var livery_update = aircraft.livery_update.new("Aircraft/Piper-PA-32/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>direction</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>bol</object-name>
    <object-name>air</object-name>
    <object-name>porte</object-name>
    <object-name>cache</object-name>
    <object-name>piedlampe</object-name>
    <object-name>porteAG</object-name>
    <object-name>porteAD</object-name>
    <object-name>porteG</object-name>
    <object-name>porteD</object-name>

    <object-name>trous</object-name>
    <object-name>helice</object-name>
    <object-name>axeAH</object-name>
    <object-name>axeAB</object-name>
    <object-name>articuleAH</object-name>
    <object-name>articuleAB</object-name>
    <object-name>roueA</object-name>
    <object-name>axeGH</object-name>
    <object-name>axeGB</object-name>
    <object-name>articuleGH</object-name>
    <object-name>articuleGB</object-name>
    <object-name>roueG</object-name>
    <object-name>axeDH</object-name>
    <object-name>axeDB</object-name>
    <object-name>articuleDH</object-name>
    <object-name>articuleDB</object-name>
    <object-name>roueD</object-name>
    <object-name>echappe</object-name>
    <object-name>trousprof</object-name>

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

  <animation>
    <type>material</type>
    <object-name>fuselage</object-name>
    <object-name>direction</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>bol</object-name>
    <object-name>air</object-name>
    <object-name>porte</object-name>
    <object-name>cache</object-name>
    <object-name>piedlampe</object-name>
    <object-name>porteAG</object-name>
    <object-name>porteAD</object-name>
    <object-name>porteG</object-name>
    <object-name>porteD</object-name>

    <object-name>trous</object-name>
    <object-name>helice</object-name>
    <object-name>axeAH</object-name>
    <object-name>axeAB</object-name>
    <object-name>articuleAH</object-name>
    <object-name>articuleAB</object-name>
    <object-name>roueA</object-name>
    <object-name>axeGH</object-name>
    <object-name>axeGB</object-name>
    <object-name>articuleGH</object-name>
    <object-name>articuleGB</object-name>
    <object-name>roueG</object-name>
    <object-name>axeDH</object-name>
    <object-name>axeDB</object-name>
    <object-name>articuleDH</object-name>
    <object-name>articuleDB</object-name>
    <object-name>roueD</object-name>
    <object-name>echappe</object-name>
    <object-name>trousprof</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>direction</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>bol</object-name>
    <object-name>air</object-name>
    <object-name>porte</object-name>
    <object-name>cache</object-name>
    <object-name>piedlampe</object-name>
    <object-name>porteAG</object-name>
    <object-name>porteAD</object-name>
    <object-name>porteG</object-name>
    <object-name>porteD</object-name>
  </effect>

  <animation>
    <type>noshadow</type>
    <object-name>vitres</object-name>
    <object-name>vitreD</object-name>
    <object-name>propdisc</object-name>
    <object-name>propblur</object-name>
  </animation>

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

  <!-- Rentré des roues Temporairement disparition/apparition des roues
  <animation>
    <type>select</type>
    <object-name>axeGH</object-name>
    <object-name>axeGB</object-name>
    <object-name>articuleGH</object-name>
    <object-name>articuleGB</object-name>
    <object-name>roueG</object-name>
    <object-name>axeDH</object-name>
    <object-name>axeDB</object-name>
    <object-name>articuleDH</object-name>
    <object-name>articuleDB</object-name>
    <object-name>roueD</object-name>
    <condition>
      <not>
        <equals>
          <property>gear/gear[0]/position-norm</property>
          <value> 0 </value>
        </equals>
      </not>
    </condition>
  </animation> -->

  <!-- Une ombre pour OSG -->
  <model>
    <name>shadowOSG</name>
    <path>Aircraft/Piper-PA-32/Models/shadow.xml</path>
  </model>

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

  <!-- Cranking effects -->
  <model>
    <path>Aircraft/Piper-PA-32/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -3.467 </x-m>
      <y-m>  0.348 </y-m>
      <z-m> -0.823 </z-m>
      <pitch-deg> 45 </pitch-deg>
    </offsets>
  </model>

  <model>
    <path>Aircraft/Piper-PA-32/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -3.537 </x-m>
      <y-m>  0.348 </y-m>
      <z-m> -0.813 </z-m>
      <pitch-deg> 45 </pitch-deg>
    </offsets>
  </model>

  <model>
    <path>Aircraft/Piper-PA-32/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -3.607 </x-m>
      <y-m>  0.348 </y-m>
      <z-m> -0.803 </z-m>
      <pitch-deg> 45 </pitch-deg>
    </offsets>
  </model>

  <!-- Effets sur le sol -->
  <!-- Roue avant -->
  <model>
    <path>Aircraft/Piper-PA-32/Models/Effects/ground/ground0.xml</path>
    <offsets>
      <x-m> -3.149 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -1.610 </z-m>
    </offsets>
  </model>

  <!-- Roue gauche -->
  <model>
    <path>Aircraft/Piper-PA-32/Models/Effects/ground/ground1.xml</path>
    <offsets>
      <x-m> -0.765 </x-m>
      <y-m> -1.566 </y-m>
      <z-m> -1.509 </z-m>
    </offsets>
  </model>

  <!-- Roue droite -->
  <model>
    <path>Aircraft/Piper-PA-32/Models/Effects/ground/ground2.xml</path>
    <offsets>
      <x-m> -0.765 </x-m>
      <y-m>  1.566 </y-m>
      <z-m> -1.509 </z-m>
    </offsets>
  </model>

  <!-- L'hélice --> 
  <animation>
    <name>HeliceComplete</name>
    <object-name>propdisc</object-name>
    <object-name>propblur</object-name>
    <object-name>helice</object-name>
    <object-name>bol</object-name>
  </animation>

  <!-- 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>
    <type>spin</type>
    <object-name>HeliceComplete</object-name>
    <property>engines/engine[0]/rpm</property>
    <factor> 1 </factor>
    <center>
      <x-m> -3.890 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.427 </z-m>
    </center>
    <axis>
      <x> -1 </x>
      <y>  0 </y>
      <z>  0 </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.495 </x1-m>
      <y1-m> -4.309 </y1-m>
      <z1-m> -0.257 </z1-m>
      <x2-m> -0.390 </x2-m>
      <y2-m> -2.492 </y2-m>
      <z2-m> -0.529 </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.390 </x1-m>
      <y1-m>  2.492 </y1-m>
      <z1-m> -0.529 </z1-m>
      <x2-m> -0.495 </x2-m>
      <y2-m>  4.309 </y2-m>
      <z2-m> -0.257 </z2-m>
    </axis>
  </animation>

  <!-- Volets -->
  <animation>
    <type>rotate</type>
    <object-name>voletG</object-name>
    <property>surface-positions/flap-pos-norm</property>
    <factor> 40 </factor>
    <axis>
      <x1-m> -0.383 </x1-m>
      <y1-m> -2.492 </y1-m>
      <z1-m> -0.545 </z1-m>
      <x2-m> -0.383 </x2-m>
      <y2-m> -0.694 </y2-m>
      <z2-m> -0.820 </z2-m>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>voletD</object-name>
    <property>surface-positions/flap-pos-norm</property>
    <factor> 40 </factor>
    <axis>
      <x1-m> -0.383 </x1-m>
      <y1-m>  0.694 </y1-m>
      <z1-m> -0.820 </z1-m>
      <x2-m> -0.383 </x2-m>
      <y2-m>  2.492 </y2-m>
      <z2-m> -0.545 </z2-m>
    </axis>
  </animation>

  <!-- Gouverne de profondeur -->
  <animation>
    <name>AllPronfondeur</name>
    <object-name>ailes2</object-name>
    <object-name>profondeur</object-name>
    <object-name>trousprof</object-name>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>AllPronfondeur</object-name>
    <property>surface-positions/elevator-pos-norm</property>
    <factor> 15 </factor>
    <center>
      <x-m>  3.593 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.034 </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>
    <axis>
      <x1-m> 3.645 </x1-m>
      <y1-m> 0.000 </y1-m>
      <z1-m> 0.140 </z1-m>
      <x2-m> 3.872 </x2-m>
      <y2-m> 0.000 </y2-m>
      <z2-m> 1.305 </z2-m>
    </axis>
  </animation>

  <!-- Animation des portes des trains -->
  <animation>
    <type>rotate</type>
    <object-name>porteAG</object-name>
    <property>gear/gear[0]/position-norm</property>
    <interpolation>
      <entry><ind> 0.0 </ind><dep>    0 </dep></entry>
      <entry><ind> 0.1 </ind><dep> -100 </dep></entry>
      <entry><ind> 1.0 </ind><dep> -100 </dep></entry>
    </interpolation>
    <axis>
      <x1-m> -3.045 </x1-m>
      <y1-m> -0.117 </y1-m>
      <z1-m> -0.927 </z1-m>
      <x2-m> -2.224 </x2-m>
      <y2-m> -0.117 </y2-m>
      <z2-m> -0.965 </z2-m>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>porteAD</object-name>
    <property>gear/gear[0]/position-norm</property>
    <interpolation>
      <entry><ind> 0.0 </ind><dep>    0 </dep></entry>
      <entry><ind> 0.1 </ind><dep> -100 </dep></entry>
      <entry><ind> 1.0 </ind><dep> -100 </dep></entry>
    </interpolation>
    <axis>
      <x1-m> -2.224 </x1-m>
      <y1-m>  0.117 </y1-m>
      <z1-m> -0.965 </z1-m>
      <x2-m> -3.045 </x2-m>
      <y2-m>  0.117 </y2-m>
      <z2-m> -0.927 </z2-m>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>porteG</object-name>
    <property>gear/gear[1]/position-norm</property>
    <interpolation>
      <entry><ind> 0 </ind><dep>   0 </dep></entry>
      <entry><ind> 1 </ind><dep> -90 </dep></entry>
    </interpolation>
    <center>
      <x-m> -0.717 </x-m>
      <y-m> -1.619 </y-m>
      <z-m> -0.679 </z-m>
    </center>
    <axis>
      <x> 1 </x>
      <y> 0 </y>
      <z> 0 </z>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>porteD</object-name>
    <property>gear/gear[2]/position-norm</property>
    <interpolation>
      <entry><ind> 0 </ind><dep>  0 </dep></entry>
      <entry><ind> 1 </ind><dep> 90 </dep></entry>
    </interpolation>
    <center>
      <x-m> -0.717 </x-m>
      <y-m>  1.619 </y-m>
      <z-m> -0.679 </z-m>
    </center>
    <axis>
      <x> 1 </x>
      <y> 0 </y>
      <z> 0 </z>
    </axis>
  </animation>

  <!-- Rentre des roues -->
  <animation>
    <name>TrainAvant</name>
    <object-name>axeAH</object-name>
    <object-name>axeAB</object-name>
    <object-name>articuleAH</object-name>
    <object-name>articuleAB</object-name>
    <object-name>roueA</object-name>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>TrainAvant</object-name>
    <property>gear/gear[0]/position-norm</property>
    <interpolation>
      <entry><ind> 0 </ind><dep> -100 </dep></entry>
      <entry><ind> 1 </ind><dep>    0 </dep></entry>
    </interpolation>
    <center>
      <x-m> -3.051 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.788 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 1 </y>
      <z> 0 </z>
    </axis>
  </animation>
 
  <animation>
    <name>TrainGauche</name>
    <object-name>axeGH</object-name>
    <object-name>axeGB</object-name>
    <object-name>articuleGH</object-name>
    <object-name>articuleGB</object-name>
    <object-name>roueG</object-name>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>TrainGauche</object-name>
    <property>gear/gear[1]/position-norm</property>
    <interpolation>
      <entry><ind> 0 </ind><dep> 77 </dep></entry>
      <entry><ind> 1 </ind><dep>  0 </dep></entry>
    </interpolation>
    <center>
      <x-m> -0.737 </x-m>
      <y-m> -1.567 </y-m>
      <z-m> -0.588 </z-m>
    </center>
    <axis>
      <x> 1 </x>
      <y> 0 </y>
      <z> 0 </z>
    </axis>
  </animation>

  <animation>
    <name>TrainDroit</name>
    <object-name>axeDH</object-name>
    <object-name>axeDB</object-name>
    <object-name>articuleDH</object-name>
    <object-name>articuleDB</object-name>
    <object-name>roueD</object-name>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>TrainDroit</object-name>
    <property>gear/gear[2]/position-norm</property>
    <interpolation>
      <entry><ind> 0 </ind><dep> -77 </dep></entry>
      <entry><ind> 1 </ind><dep>   0 </dep></entry>
    </interpolation>
    <center>
      <x-m> -0.737 </x-m>
      <y-m>  1.567 </y-m>
      <z-m> -0.588 </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>TrainAvant</object-name>
    <property>surface-positions/rudder-pos-norm</property>
    <factor> -25 </factor>
    <axis>
      <x1-m> -3.149 </x1-m>
      <y1-m>  0.000 </y1-m>
      <z1-m> -1.428 </z1-m>
      <x2-m> -3.057 </x2-m>
      <y2-m>  0.000 </y2-m>
      <z2-m> -0.825 </z2-m>
    </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> -3.149 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -1.428 </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.765 </x-m>
      <y-m> -1.566 </y-m>
      <z-m> -1.294 </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[2]/rollspeed-ms</property>
    <factor> 30 </factor>
    <center>
      <x-m> -0.765 </x-m>
      <y-m>  1.566 </y-m>
      <z-m> -1.294 </z-m>
    </center>
    <axis>
      <x>  0 </x>
      <y> -1 </y>
      <z>  0 </z>
    </axis>
  </animation>

  <!-- Porte -->
  <animation>
    <name>PorteGauche</name>
    <object-name>porte</object-name>
    <object-name>vitreD</object-name>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>PorteGauche</object-name>
    <property>instrumentation/doors/crew/position-norm</property>
    <factor> 60 </factor>
    <center>
      <x-m> -1.672 </x-m>
      <y-m>  0.654 </y-m>
      <z-m> -0.424 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 0 </y>
      <z> 1 </z>
    </axis>
  </animation>

  <!-- Effets lumineux -->
  <model>
    <path>Aircraft/Piper-PA-32/Models/light/beacon.xml</path>
    <offsets>
      <x-m> 3.777 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 1.441 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/Piper-PA-32/Models/light/RedLight.xml</path>
    <offsets>
      <x-m> -1.041 </x-m>
      <y-m> -4.927 </y-m>
      <z-m> -0.097 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/Piper-PA-32/Models/light/GreenLight.xml</path>
    <offsets>
      <x-m> -1.041 </x-m>
      <y-m>  4.927 </y-m>
      <z-m> -0.097 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/Piper-PA-32/Models/light/StrobeWhite.xml</path>
    <offsets>
      <x-m> -1.021 </x-m>
      <y-m> -4.927 </y-m>
      <z-m> -0.097 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/Piper-PA-32/Models/light/StrobeWhite.xml</path>
    <offsets>
      <x-m> -1.021 </x-m>
      <y-m>  4.927 </y-m>
      <z-m> -0.097 </z-m>
   </offsets>
  </model>

  <!-- Gear light cone -->
  <model>
    <name>LightCone</name>
    <path>Aircraft/Piper-PA-32/Models/light/light-cone.xml</path>
    <offsets>
      <x-m> -3.673 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.701 </z-m>
      <pitch-deg> -7.5 </pitch-deg>
    </offsets>
  </model>

  <animation>
    <type>select</type>
    <object-name>LightCone</object-name>
    <condition>
      <equals>
        <property>controls/switches/landing-light</property>
        <value> 1 </value>
      </equals>
    </condition>
  </animation>

</PropertyList>

