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

<PropertyList>

  <path>dhc3.ac</path>

  <nasal>
    <load>
      var livery_update = aircraft.livery_update.new("Aircraft/dhc3/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>bol</object-name>
    <object-name>ailes</object-name>
    <object-name>renforts</object-name>
    <object-name>ailes2</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>avantvoletG</object-name>
    <object-name>avantvoletD</object-name>
    <object-name>voletG</object-name>
    <object-name>voletD</object-name>
    <object-name>profondeur</object-name>
    <object-name>direction</object-name>
    <object-name>porteArG1</object-name>
    <object-name>porteArG2</object-name>
    <object-name>porteArD1</object-name>
    <object-name>porteArD2</object-name>
    <object-name>helice</object-name>
    <object-name>porteAvG</object-name>
    <object-name>porteAvD</object-name>
    <object-name>ampouleGD</object-name>
    <object-name>air</object-name>
    <object-name>plusailes</object-name>
    <object-name>tourechappe</object-name>
    <object-name>dessous</object-name>
    <object-name>pito</object-name>
    <object-name>antenne</object-name>

    <object-name>echappe</object-name>
    <object-name>trous</object-name>

    <!-- Objets transparents -->
    <object-name>vitres</object-name>
    <object-name>vitreAvG</object-name>
    <object-name>vitreAvD</object-name>
    <object-name>vitreArG1</object-name>
    <object-name>vitreArG2</object-name>
    <object-name>vitreArD1</object-name>
    <object-name>vitreArD2</object-name>
    <object-name>propblur</object-name>
    <object-name>propdisc</object-name>
    <object-name>lampeDG</object-name>
    <object-name>lamperouge</object-name>
    <object-name>lampeverte</object-name>
    <object-name>beacon</object-name>
  </animation>

  <animation>
    <type>material</type>
    <object-name>fuselage</object-name>
    <object-name>bol</object-name>
    <object-name>ailes</object-name>
    <object-name>renforts</object-name>
    <object-name>ailes2</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>avantvoletG</object-name>
    <object-name>avantvoletD</object-name>
    <object-name>voletG</object-name>
    <object-name>voletD</object-name>
    <object-name>profondeur</object-name>
    <object-name>direction</object-name>
    <object-name>porteArG1</object-name>
    <object-name>porteArG2</object-name>
    <object-name>porteArD1</object-name>
    <object-name>porteArD2</object-name>
    <object-name>helice</object-name>
    <object-name>porteAvG</object-name>
    <object-name>porteAvD</object-name>
    <object-name>ampouleGD</object-name>
    <object-name>air</object-name>
    <object-name>plusailes</object-name>
    <object-name>echappe</object-name>
    <object-name>tourechappe</object-name>
    <object-name>dessous</object-name>
    <object-name>pito</object-name>
    <object-name>antenne</object-name>
    <object-name>trous</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>bol</object-name>
    <object-name>ailes</object-name>
    <object-name>renforts</object-name>
    <object-name>ailes2</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>avantvoletG</object-name>
    <object-name>avantvoletD</object-name>
    <object-name>voletG</object-name>
    <object-name>voletD</object-name>
    <object-name>profondeur</object-name>
    <object-name>direction</object-name>
    <object-name>porteArG1</object-name>
    <object-name>porteArG2</object-name>
    <object-name>porteArD1</object-name>
    <object-name>porteArD2</object-name>
    <object-name>helice</object-name>
    <object-name>porteAvG</object-name>
    <object-name>porteAvD</object-name>
    <object-name>ampouleGD</object-name>
    <object-name>air</object-name>
    <object-name>plusailes</object-name>
    <object-name>tourechappe</object-name>
    <object-name>dessous</object-name>
    <object-name>pito</object-name>
    <object-name>antenne</object-name>
  </effect>

  <animation>
    <type>shader</type>
    <shader>chrome</shader>
    <texture>Aircraft/Generic/Effects/glass_shader.png</texture>
    <object-name>vitres</object-name>
    <object-name>vitreAvG</object-name>
    <object-name>vitreAvD</object-name>
    <object-name>vitreArG1</object-name>
    <object-name>vitreArG2</object-name>
    <object-name>vitreArD1</object-name>
    <object-name>vitreArD2</object-name>
    <object-name>lampeDG</object-name>
    <object-name>lamperouge</object-name>
    <object-name>lampeverte</object-name>
    <object-name>beacon</object-name>
  </animation>

  <animation>
    <type>noshadow</type>
    <object-name>vitres</object-name>
    <object-name>vitreAvG</object-name>
    <object-name>vitreAvD</object-name>
    <object-name>vitreArG1</object-name>
    <object-name>vitreArG2</object-name>
    <object-name>vitreArD1</object-name>
    <object-name>vitreArD2</object-name>
    <object-name>propblur</object-name>
    <object-name>propdisc</object-name>
    <object-name>lampeDG</object-name>
    <object-name>lamperouge</object-name>
    <object-name>lampeverte</object-name>
    <object-name>beacon</object-name>
  </animation>

  <!-- Moteur -->
  <model>
    <path>Aircraft/dhc3/Models/r1340/r1340.xml</path>
    <offsets>
      <x-m> -5.640 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.291 </z-m>
    </offsets>
  </model>

  <!-- Cranking effects -->
  <!-- Left -->
  <model>
    <path>Aircraft/dhc3/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -4.720 </x-m>
      <y-m> -0.748 </y-m>
      <z-m> -0.697 </z-m>
      <roll-deg>     0 </roll-deg>
      <pitch-deg>   20 </pitch-deg>
      <heading-deg> -5 </heading-deg>
    </offsets>
  </model>

  <model>
    <path>Aircraft/dhc3/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -4.720 </x-m>
      <y-m> -0.677 </y-m>
      <z-m> -0.805 </z-m>
      <roll-deg>     0 </roll-deg>
      <pitch-deg>   20 </pitch-deg>
      <heading-deg> -5 </heading-deg>
    </offsets>
  </model>

  <!-- Center -->
  <model>
    <path>Aircraft/dhc3/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -4.720 </x-m>
      <y-m> -0.098 </y-m>
      <z-m> -1.093 </z-m>
      <roll-deg>    0 </roll-deg>
      <pitch-deg>  20 </pitch-deg>
      <heading-deg> 0 </heading-deg>
    </offsets>
  </model>

  <model>
    <path>Aircraft/dhc3/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -4.720 </x-m>
      <y-m>  0.098 </y-m>
      <z-m> -1.093 </z-m>
      <roll-deg>    0 </roll-deg>
      <pitch-deg>  20 </pitch-deg>
      <heading-deg> 0 </heading-deg>
    </offsets>
  </model>

  <!-- Right -->
  <model>
    <path>Aircraft/dhc3/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -4.720 </x-m>
      <y-m>  0.677 </y-m>
      <z-m> -0.805 </z-m>
      <roll-deg>    0 </roll-deg>
      <pitch-deg>  20 </pitch-deg>
      <heading-deg> 5 </heading-deg>
    </offsets>
  </model>

  <model>
    <path>Aircraft/dhc3/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -4.720 </x-m>
      <y-m>  0.748 </y-m>
      <z-m> -0.697 </z-m>
      <roll-deg>    0 </roll-deg>
      <pitch-deg>  20 </pitch-deg>
      <heading-deg> 5 </heading-deg>
    </offsets>
  </model>

  <!-- Immatriculation -->
  <model>
    <path>Aircraft/dhc3/Models/Immat/immat.xml</path>
    <offsets>
      <x-m> 0 </x-m>
      <y-m> 0 </y-m>
      <z-m> 0 </z-m>
    </offsets>
  </model>

  <!-- Intérieur -->
  <model>
    <path>Aircraft/dhc3/Models/Interior/interior.xml</path>
    <offsets>
      <x-m> 0 </x-m>
      <y-m> 0 </y-m>
      <z-m> 0 </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> -6.042 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.300 </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> 15 </factor>
    <center>
      <x-m> 4.961 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 0.884 </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>
    <object-name>beacon</object-name>
    <object-name>beaconlight</object-name>
    <property>surface-positions/rudder-pos-norm</property>
    <factor> 20 </factor>
    <center>
      <x-m> 5.408 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 0.857 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 0 </y>
      <z> 1 </z>
    </axis>
  </animation>

  <!-- Ailerons et volets -->
  <animation>
    <type>rotate</type>
    <object-name>avantvoletG</object-name>
    <object-name>voletG</object-name>
    <object-name>aileronG</object-name>
    <property>surface-positions/left-flap-pos-norm</property>
    <factor> -20 </factor>
    <axis>
      <x1-m> -1.865 </x1-m>
      <y1-m> -1.933 </y1-m>
      <z1-m>  0.427 </z1-m>
      <x2-m> -1.865 </x2-m>
      <y2-m> -7.688 </y2-m>
      <z2-m>  0.743 </z2-m>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>avantvoletD</object-name>
    <object-name>voletD</object-name>
    <object-name>aileronD</object-name>
    <property>surface-positions/right-flap-pos-norm</property>
    <factor> -20 </factor>
    <axis>
      <x1-m> -1.865 </x1-m>
      <y1-m>  7.688 </y1-m>
      <z1-m>  0.743 </z1-m>
      <x2-m> -1.865 </x2-m>
      <y2-m>  1.933 </y2-m>
      <z2-m>  0.427 </z2-m>
    </axis>
  </animation>

  <!-- Animations des ailerons -->
  <animation>
    <type>rotate</type>
    <object-name>aileronG</object-name>
    <property>surface-positions/left-aileron-pos-norm</property>
    <factor> -20 </factor>
    <axis>
      <x1-m> -1.742 </x1-m>
      <y1-m> -4.576 </y1-m>
      <z1-m>  0.865 </z1-m>
      <x2-m> -1.742 </x2-m>
      <y2-m> -8.202 </y2-m>
      <z2-m>  1.073 </z2-m>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>aileronD</object-name>
    <property>surface-positions/right-aileron-pos-norm</property>
    <factor> -20 </factor>
    <axis>
      <x1-m> -1.742 </x1-m>
      <y1-m>  8.202 </y1-m>
      <z1-m>  1.073 </z1-m>
      <x2-m> -1.742 </x2-m>
      <y2-m>  4.576 </y2-m>
      <z2-m>  0.865 </z2-m>
    </axis>
  </animation>

  <!-- Volets -->
  <animation>
    <type>rotate</type>
    <object-name>voletG</object-name>
    <property>surface-positions/flap-pos-norm</property>
    <factor> -20 </factor>
    <axis>
      <x1-m> -1.742 </x1-m>
      <y1-m> -0.837 </y1-m>
      <z1-m>  0.652 </z1-m>
      <x2-m> -1.742 </x2-m>
      <y2-m> -4.576 </y2-m>
      <z2-m>  0.865 </z2-m>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>voletD</object-name>
    <property>surface-positions/flap-pos-norm</property>
    <factor> -20 </factor>
    <axis>
      <x1-m> -1.742 </x1-m>
      <y1-m>  4.576 </y1-m>
      <z1-m>  0.865 </z1-m>
      <x2-m> -1.742 </x2-m>
      <y2-m>  0.837 </y2-m>
      <z2-m>  0.652 </z2-m>
    </axis>
  </animation>

  <!-- Porte -->
  <animation>
    <type>rotate</type>
    <object-name>porteArG1</object-name>
    <object-name>vitreArG1</object-name>
    <property>instrumentation/doors/passenger/position-norm</property>
    <factor> 130 </factor>
    <center>
      <x-m> -1.324 </x-m>
      <y-m> -0.899 </y-m>
      <z-m> -0.065 </z-m>
    </center>
    <axis>
      <x>  0 </x>
      <y>  0 </y>
      <z> -1 </z>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>porteArG2</object-name>
    <object-name>vitreArG2</object-name>
    <property>instrumentation/doors/passenger/position-norm</property>
    <factor> 130 </factor>
    <center>
      <x-m> -0.268 </x-m>
      <y-m> -0.850 </y-m>
      <z-m>  0.061 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 0 </y>
      <z> 1 </z>
    </axis>
  </animation>

  <!-- Porte -->
  <animation>
    <type>rotate</type>
    <object-name>porteAvG</object-name>
    <object-name>vitreAvG</object-name>
    <property>instrumentation/doors/crew/position-norm</property>
    <factor> -130 </factor>
    <axis>
      <x1-m> -4.307 </x1-m>
      <y1-m> -0.775 </y1-m>
      <z1-m> -0.181 </z1-m>
      <x2-m> -4.314 </x2-m>
      <y2-m> -0.743 </y2-m>
      <z2-m>  0.068 </z2-m>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>porteAvD</object-name>
    <object-name>vitreAvD</object-name>
    <property>instrumentation/doors/crew/position-norm</property>
    <factor> 130 </factor>
    <axis>
      <x1-m> -4.307 </x1-m>
      <y1-m>  0.775 </y1-m>
      <z1-m> -0.181 </z1-m>
      <x2-m> -4.314 </x2-m>
      <y2-m>  0.743 </y2-m>
      <z2-m>  0.068 </z2-m>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>porteArD1</object-name>
    <object-name>vitreArD1</object-name>
    <property>instrumentation/doors/passenger/position-norm</property>
    <factor> 130 </factor>
    <center>
      <x-m> -1.324 </x-m>
      <y-m>  0.899 </y-m>
      <z-m> -0.065 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 0 </y>
      <z> 1 </z>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>porteArD2</object-name>
    <object-name>vitreArD2</object-name>
    <property>instrumentation/doors/passenger/position-norm</property>
    <factor> 130 </factor>
    <center>
      <x-m> -0.268 </x-m>
      <y-m>  0.850 </y-m>
      <z-m>  0.061 </z-m>
    </center>
    <axis>
      <x>  0 </x>
      <y>  0 </y>
      <z> -1 </z>
    </axis>
  </animation>

  <!-- Flash gauche -->
  <model>
    <path>Aircraft/dhc3/Models/lights/flash.xml</path>
    <offsets>
      <x-m> -3.287 </x-m>
      <y-m> -4.321 </y-m>
      <z-m>  0.819 </z-m>
    </offsets>
  </model>

  <!-- Flash droit -->
  <model>
    <path>Aircraft/dhc3/Models/lights/flash.xml</path>
    <offsets>
      <x-m> -3.287 </x-m>
      <y-m>  4.321 </y-m>
      <z-m>  0.819 </z-m>
    </offsets>
  </model>

  <!-- Lumière rouge -->
  <model>
    <path>Aircraft/dhc3/Models/lights/RedLight.xml</path>
    <offsets>
      <x-m> -2.623 </x-m>
      <y-m> -8.742 </y-m>
      <z-m>  1.116 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/dhc3/Models/lights/StrobeWhite.xml</path>
    <offsets>
      <x-m> -2.613 </x-m>
      <y-m> -8.742 </y-m>
      <z-m>  1.116 </z-m>
    </offsets>
  </model>

  <!-- Lumière verte -->
  <model>
    <path>Aircraft/dhc3/Models/lights/GreenLight.xml</path>
    <offsets>
      <x-m> -2.623 </x-m>
      <y-m>  8.742 </y-m>
      <z-m>  1.116 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/dhc3/Models/lights/StrobeWhite.xml</path>
    <offsets>
      <x-m> -2.613 </x-m>
      <y-m>  8.742 </y-m>
      <z-m>  1.116 </z-m>
    </offsets>
  </model>

  <!-- Beacon -->
  <model>
    <name>beaconlight</name>
    <path>Aircraft/dhc3/Models/lights/beacon.xml</path>
    <offsets>
      <x-m> 5.481 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 2.146 </z-m>
    </offsets>
  </model>

</PropertyList>

