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

<PropertyList>

  <path>main.ac</path>

  <nasal>
    <load>
      var livery_update = aircraft.livery_update.new("Aircraft/Tecnam-P92/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>
    <object-name>fuselage</object-name>
    <object-name>porteG</object-name>
    <object-name>porteD</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>direction</object-name>
    <object-name>profondeur</object-name>
    <object-name>trimprof</object-name>
    <object-name>bol</object-name>
    <object-name>supportbeacon</object-name>
    <object-name>supportlampes</object-name>

    <object-name>trous</object-name>
    <object-name>trimtrous</object-name>
    <object-name>helice</object-name>

    <!-- Transparence -->
    <object-name>vitres</object-name>
    <object-name>vitreG</object-name>
    <object-name>vitreD</object-name>
    <object-name>propblur</object-name>
    <object-name>propdisc</object-name>
    <object-name>beacon</object-name>
    <object-name>lampeverte</object-name>
    <object-name>lamperouge</object-name>
    <object-name>lampesblanches</object-name>
  </animation>

  <animation>
    <type>material</type>
    <object-name>fuselage</object-name>
    <object-name>porteG</object-name>
    <object-name>porteD</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>direction</object-name>
    <object-name>profondeur</object-name>
    <object-name>trimprof</object-name>
    <object-name>bol</object-name>
    <object-name>supportbeacon</object-name>
    <object-name>supportlampes</object-name>

    <object-name>trous</object-name>
    <object-name>trimtrous</object-name>
    <object-name>helice</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>porteG</object-name>
    <object-name>porteD</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>direction</object-name>
    <object-name>profondeur</object-name>
    <object-name>trimprof</object-name>
    <object-name>bol</object-name>
    <object-name>supportbeacon</object-name>
    <object-name>supportlampes</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>vitreG</object-name>
    <object-name>vitreD</object-name>
  </animation>

  <animation>
    <type>noshadow</type>
    <object-name>vitres</object-name>
    <object-name>vitreG</object-name>
    <object-name>vitreD</object-name>
    <object-name>propblur</object-name>
    <object-name>propdisc</object-name>
    <object-name>beacon</object-name>
    <object-name>lampeverte</object-name>
    <object-name>lamperouge</object-name>
    <object-name>lampesblanches</object-name>
  </animation>

  <!-- explosion -->
  <model>
    <name>Fire</name>
    <path>Aircraft/Tecnam-P92/Models/Effects/fire/fire.xml</path>
  </model>

  <!-- Intérieur -->
  <model>
    <path>Aircraft/Tecnam-P92/Models/Interior/interior.xml</path>
  </model>

  <!-- Immatriculatoin -->
  <model>
    <path>Aircraft/Tecnam-P92/Models/Immat/immat.xml</path>
  </model>

  <!-- L'hélice --> 
  <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>

  <!-- 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>900</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>300.000</value>
      </greater-than>
      <less-than>
        <property>/engines/engine[0]/rpm</property>
        <value>900.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>900</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.081 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.133 </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.411 </x1-m>
      <y1-m> -4.447 </y1-m>
      <z1-m>  0.499 </z1-m>
      <x2-m> -0.411 </x2-m>
      <y2-m> -2.429 </y2-m>
      <z2-m>  0.469 </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.411 </x1-m>
      <y1-m>  2.429 </y1-m>
      <z1-m>  0.469 </z1-m>
      <x2-m> -0.411 </x2-m>
      <y2-m>  4.447 </y2-m>
      <z2-m>  0.499 </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.423 </x1-m>
      <y1-m> -2.430 </y1-m>
      <z1-m>  0.457 </z1-m>
      <x2-m> -0.423 </x2-m>
      <y2-m> -0.427 </y2-m>
      <z2-m>  0.423 </z2-m>
    </axis>
  </animation>0.416

  <animation>
    <type>rotate</type>
    <object-name>voletD</object-name>
    <property>surface-positions/flap-pos-norm</property>
    <factor> 40 </factor>
    <axis>
      <x1-m> -0.423 </x1-m>
      <y1-m>  0.427 </y1-m>
      <z1-m>  0.423 </z1-m>
      <x2-m> -0.423 </x2-m>
      <y2-m>  2.430 </y2-m>
      <z2-m>  0.457 </z2-m>
    </axis>
  </animation>

  <!-- Gouverne de profondeur -->
  <animation>
    <name>ProfComplet</name>
    <object-name>profondeur</object-name>
    <object-name>trimprof</object-name>
    <object-name>trimtrous</object-name>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>trimprof</object-name>
    <property>surface-positions/elevator-trim-norm</property>
    <factor> 25 </factor>
    <center>
      <x-m>  3.192 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.145 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 1 </y>
      <z> 0 </z>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>ProfComplet</object-name>
    <property>surface-positions/elevator-pos-norm</property>
    <factor> 20 </factor>
    <center>
      <x-m>  2.801 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.144 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 1 </y>
      <z> 0 </z>
    </axis>
  </animation>

  <!-- Gouvernes de direction -->
  <animation>
    <type>rotate</type>
    <object-name>direction</object-name>
    <property>surface-positions/rudder-pos-norm</property>
    <factor> 20 </factor>
    <axis>
      <x1-m>  2.661 </x1-m>
      <y1-m>  0.000 </y1-m>
      <z1-m> -0.005 </z1-m>
      <x2-m>  3.027 </x2-m>
      <y2-m>  0.000 </y2-m>
      <z2-m>  1.215 </z2-m>
    </axis>
  </animation>

  <!-- Porte -->
  <animation>
    <name>PorteGauche</name>
    <object-name>porteG</object-name>
    <object-name>vitreG</object-name>
  </animation>

  <animation>
    <type>pick</type>
    <object-name>PorteGauche</object-name>
    <action>
      <button>0</button>
      <repeatable>false</repeatable>  
      <binding>
        <command>nasal</command>
        <script>doors.doorsystem.crewexport();</script>
      </binding>
    </action>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>PorteGauche</object-name>
    <property>instrumentation/doors/crew/position-norm</property>
    <factor> -120 </factor>
    <center>
      <x-m> -1.790 </x-m>
      <y-m> -0.470 </y-m>
      <z-m> -0.293 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 0 </y>
      <z> 1 </z>
    </axis>
  </animation>

  <animation>
    <name>PorteDroite</name>
    <object-name>porteD</object-name>
    <object-name>vitreD</object-name>
  </animation>

  <animation>
    <type>pick</type>
    <object-name>PorteDroite</object-name>
    <action>
      <button>0</button>
      <repeatable>false</repeatable>  
      <binding>
        <command>nasal</command>
        <script>doors.doorsystem.passengerexport();</script>
      </binding>
    </action>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>PorteDroite</object-name>
    <property>instrumentation/doors/passenger/position-norm</property>
    <factor> 120 </factor>
    <center>
      <x-m> -1.790 </x-m>
      <y-m>  0.470 </y-m>
      <z-m> -0.293 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 0 </y>
      <z> 1 </z>
    </axis>
  </animation>

  <!-- Ajout des effets lumineux -->
  <model>
    <path>Aircraft/Tecnam-P92/Models/light/WhiteLight.xml</path>
    <offsets>
      <x-m> 2.937 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 1.243 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/Tecnam-P92/Models/light/RedLight.xml</path>
    <offsets>
      <x-m> -1.492 </x-m>
      <y-m> -4.674 </y-m>
      <z-m>  0.522 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/Tecnam-P92/Models/light/WhiteLight.xml</path>
    <offsets>
      <x-m> -1.462 </x-m>
      <y-m> -4.697 </y-m>
      <z-m>  0.522 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/Tecnam-P92/Models/light/GreenLight.xml</path>
    <offsets>
      <x-m> -1.492 </x-m>
      <y-m>  4.674 </y-m>
      <z-m>  0.522 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/Tecnam-P92/Models/light/WhiteLight.xml</path>
    <offsets>
      <x-m> -1.462 </x-m>
      <y-m>  4.697 </y-m>
      <z-m>  0.522 </z-m>
    </offsets>
  </model>

</PropertyList>

