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

<PropertyList>

  <scenario>

    <name>Bombable: Four Mb 339 near you</name>

    <description>
      This scenario puts Four Mb 339 in the skies near
      your position.

      Install this scenario in the FlightGear/data/AI directory.

      BARANGER Emmanuel 08/2025
    </description>

    <nasal>
      <load>
        <![CDATA[
          var position  = geo.aircraft_position();
          var elevation = geo.elevation( position.lat(), position.lon() );
          position.set_alt( elevation != nil ? elevation : 0.0 );

          foreach( var tanker; props.globals.getNode("/ai/models",1).getChildren("tanker") ) {
            var callsign = tanker.getNode("callsign").getValue();
            if ( callsign == nil ) {
              continue;
            }
            if ( string.match(callsign,"MB*") ) {
              tanker.getNode("position/latitude-deg",1).setDoubleValue( position.lat() - (0.002 * rand()) );
              tanker.getNode("position/longitude-deg",1).setDoubleValue( position.lon() - (0.002 * rand()) );
              tanker.getNode("position/altitude-ft", 1).setDoubleValue( position.alt() + 10000 );
              }
          }
          debug.dump('Mb 339 scenario load script complete');
        ]]>
      </load>
    </nasal>

    <entry>
      <callsign type="string">MBBaron</callsign>
      <type>tanker</type>
      <class>tanker</class>
      <name     type="string">MB339_1</name>
      <model    type="string">Aircraft/Aermacchi-MB-339/Models/mb339.xml</model>
      <speed    type="double">290.0</speed>
    </entry>

    <entry>
      <callsign type="string">MBStorm</callsign>
      <type>tanker</type>
      <class>tanker</class>
      <name     type="string">MB339_2</name>
      <model    type="string">Aircraft/Aermacchi-MB-339/Models/mb339.xml</model>
      <speed    type="double">290.0</speed>
    </entry>

    <entry>
      <callsign type="string">MBWinger</callsign>
      <search-order>PREFER_AI</search-order>
      <type>tanker</type>
      <class>tanker</class>
      <name     type="string">MB339_3</name>
      <model    type="string">Aircraft/Aermacchi-MB-339/Models/mb339.xml</model>
      <speed    type="double">290.0</speed>
    </entry>

    <entry>
      <callsign type="string">MBSupport</callsign>
      <search-order>PREFER_AI</search-order>
      <type>tanker</type>
      <class>tanker</class>
      <name     type="string">MB339_4</name>
      <model    type="string">Aircraft/Aermacchi-MB-339/Models/mb339.xml</model>
      <speed    type="double">290.0</speed>
    </entry>

  </scenario>

</PropertyList>
