<?xml version="1.0" encoding="ISO-8859-1"?>

<PropertyList>

  <path>mc72.ac</path>

  <nasal>
    <load>
      var livery_update = aircraft.livery_update.new("Aircraft/Macchi-Castoldi-MC72/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>aile</object-name>
    <object-name>aile2</object-name>
    <object-name>floteurs</object-name>
    <object-name>sousfloteurs</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>direction</object-name>
    <object-name>profondeur</object-name>
    <object-name>poteau</object-name>
    <object-name>tourvitre</object-name>
    <object-name>appuis</object-name>
    <object-name>bol1</object-name>
    <object-name>bol2</object-name>

    <object-name>echappe</object-name>
    <object-name>helice1</object-name>
    <object-name>helice2</object-name>
    <object-name>cables</object-name>

    <!-- Objets transparents -->
    <object-name>vitres</object-name>
    <object-name>propdisc1</object-name>
    <object-name>propblur1</object-name>
    <object-name>propdisc2</object-name>
    <object-name>propblur2</object-name>
  </animation>

  <animation>
    <type>material</type>
    <object-name>fuselage</object-name>
    <object-name>aile</object-name>
    <object-name>aile2</object-name>
    <object-name>floteurs</object-name>
    <object-name>sousfloteurs</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>direction</object-name>
    <object-name>profondeur</object-name>
    <object-name>poteau</object-name>
    <object-name>cables</object-name>
    <object-name>tourvitre</object-name>
    <object-name>appuis</object-name>
    <object-name>echappe</object-name>
    <object-name>bol1</object-name>
    <object-name>bol2</object-name>
    <object-name>helice1</object-name>
    <object-name>helice2</object-name>

    <property-base>sim/model/livery</property-base>
    <texture-prop>texture</texture-prop>
    <texture>texture.png</texture>
    <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>
  </animation>

  <effect>
    <inherits-from>Aircraft/Generic/Effects/Fuselagereflect</inherits-from>
    <condition>
      <not><property>sim/rendering/rembrandt/enabled</property></not>
    </condition>
    <object-name>fuselage</object-name>
    <object-name>aile</object-name>
    <object-name>aile2</object-name>
    <object-name>floteurs</object-name>
    <object-name>sousfloteurs</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>direction</object-name>
    <object-name>profondeur</object-name>
    <object-name>poteau</object-name>
    <object-name>tourvitre</object-name>
    <object-name>appuis</object-name>
    <object-name>bol1</object-name>
    <object-name>bol2</object-name>
  </effect>

  <effect>
    <inherits-from>Effects/model-combined-deferred</inherits-from>
    <condition>
      <property>sim/rendering/rembrandt/enabled</property>
    </condition>
    <object-name>fuselage</object-name>
    <object-name>aile</object-name>
    <object-name>aile2</object-name>
    <object-name>floteurs</object-name>
    <object-name>sousfloteurs</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>direction</object-name>
    <object-name>profondeur</object-name>
    <object-name>poteau</object-name>
    <object-name>tourvitre</object-name>
    <object-name>appuis</object-name>
    <object-name>bol1</object-name>
    <object-name>bol2</object-name>
  </effect>

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

  <animation>
    <type>noshadow</type>
    <object-name>vitres</object-name>
    <object-name>propdisc1</object-name>
    <object-name>propblur1</object-name>
    <object-name>propdisc2</object-name>
    <object-name>propblur2</object-name>
  </animation>

  <!-- working for Rembrandt -->
  <effect>
    <inherits-from>Effects/model-transparent</inherits-from>
    <condition>
      <property>sim/rendering/rembrandt/enabled</property>
    </condition>
    <object-name>vitres</object-name>
    <object-name>propdisc1</object-name>
    <object-name>propblur1</object-name>
    <object-name>propdisc2</object-name>
    <object-name>propblur2</object-name>
  </effect>

  <!-- Une ombre pour OSG -->
  <model>
    <path>Aircraft/Macchi-Castoldi-MC72/Models/shadow.xml</path>
    <offsets>
      <x-m>  0.0 </x-m>
      <y-m>  0.0 </y-m>
      <z-m> -1.1 </z-m>
    </offsets>
  </model>

  <!-- Intérieur -->
  <model>
    <name>Interieur</name>
    <path>Aircraft/Macchi-Castoldi-MC72/Models/Interior/interior.xml</path>
  </model>

  <!-- For Rembrandt -->
  <animation>
    <type>noshadow</type>
    <object-name>Interieur</object-name>
  </animation>

  <!-- Trainée gauche -->
  <model>
    <path>Aircraft/Macchi-Castoldi-MC72/Models/Effects/wakes/wakeG.xml</path>
    <offsets>
      <x-m>  2.096 </x-m>
      <y-m> -1.373 </y-m>
      <z-m> -0.999 </z-m>
      <pitch-deg> -45 </pitch-deg>
    </offsets>
  </model> 

  <!-- Trainée droite -->
  <model>
    <path>Aircraft/Macchi-Castoldi-MC72/Models/Effects/wakes/wakeD.xml</path>
    <offsets>
      <x-m>  2.096 </x-m>
      <y-m>  1.373 </y-m>
      <z-m> -0.999 </z-m>
      <pitch-deg> -45 </pitch-deg>
    </offsets>
  </model> 

  <!-- Cranking effects -->
  <model>
    <path>Aircraft/Macchi-Castoldi-MC72/Models/Effects/cranking/all-cranking.xml</path>
  </model> 

  <!-- L'hélice du moteur 1--> 
  <animation>
    <name>HeliceComplete1</name>
    <object-name>propdisc1</object-name>
    <object-name>propblur1</object-name>
    <object-name>helice1</object-name>
    <object-name>bol1</object-name>
  </animation>

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

  <animation>
    <type>select</type>
    <object-name>propblur1</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>helice1</object-name>
    <condition>
      <less-than>
        <property>engines/engine[0]/rpm</property>
	<value>1500</value>
      </less-than>
    </condition>
  </animation>

  <animation>
    <type>spin</type>
    <object-name>HeliceComplete1</object-name>
    <condition>
      <greater-than>
        <property>engines/engine[0]/rpm</property>
        <value> 5 </value>
      </greater-than>
    </condition>
    <property>engines/engine[0]/rpm</property>
    <factor> 1 </factor>
    <center>
      <x-m> -3.285 </x-m>
      <y-m>  0.000 </y-m>
      <z-m>  0.530 </z-m>
    </center>
    <axis>
      <x> 1 </x>
      <y> 0 </y>
      <z> 0 </z>
    </axis>
  </animation>

  <!-- L'hélice du moteur 2--> 
  <animation>
    <name>HeliceComplete2</name>
    <object-name>propdisc2</object-name>
    <object-name>propblur2</object-name>
    <object-name>helice2</object-name>
    <object-name>bol2</object-name>
  </animation>

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

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

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

  <animation>
    <type>spin</type>
    <object-name>HeliceComplete2</object-name>
    <condition>
      <greater-than>
        <property>engines/engine[1]/rpm</property>
        <value> 5 </value>
      </greater-than>
    </condition>
    <property>engines/engine[1]/rpm</property>
    <factor> 1 </factor>
    <center>
      <x-m> -3.583 </x-m>
      <y-m>  0.000 </y-m>
      <z-m>  0.530 </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> 3.696 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 0.539 </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> 3.626 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 0.811 </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>
    <center>
      <x-m> -0.284 </x-m>
      <y-m> -3.287 </y-m>
      <z-m>  0.012 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 1 </y>
      <z> 0 </z>
    </axis>
  </animation> 

  <!-- Animations des ailerons -->
  <animation>
    <type>rotate</type>
    <object-name>aileronD</object-name>
    <property>surface-positions/right-aileron-pos-norm</property>
    <factor> 15 </factor>
    <center>
      <x-m> -0.284 </x-m>
      <y-m>  3.287 </y-m>
      <z-m>  0.012 </z-m>
    </center>    <axis>
      <x> 0 </x>
      <y> 1 </y>
      <z> 0 </z>
    </axis>
  </animation> 

  <!-- Canopy -->
  <animation>
    <type>pick</type>
    <object-name>tourvitre</object-name>
    <object-name>vitres</object-name>
    <visible>true</visible>
    <action>
      <button>0</button>
      <repeatable>false</repeatable>
      <binding>
        <command>nasal</command>
        <script>doors.crew.toggle();</script>
      </binding>
    </action>
  </animation>
 
  <animation>
    <type>rotate</type>
    <object-name>tourvitre</object-name>
    <object-name>vitres</object-name>
    <property>sim/model/door-positions/crew/position-norm</property>
    <factor> -162 </factor>
    <center>
      <x-m> 0.249 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 0.866 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 1 </y>
      <z> 0 </z>
    </axis>
  </animation>

</PropertyList>
