From 31df14b691ae678d69c9fc66d3a77bf7ed271291 Mon Sep 17 00:00:00 2001 From: torsten Date: Wed, 7 Apr 2010 14:15:24 +0000 Subject: [PATCH] Initial import of the balloon scenario from gooneybird --- Nasal/balloons.nas | 29 +++++++++++++++++++++++++++++ preferences.xml | 1 + 2 files changed, 30 insertions(+) create mode 100644 Nasal/balloons.nas diff --git a/Nasal/balloons.nas b/Nasal/balloons.nas new file mode 100644 index 000000000..be13b1da9 --- /dev/null +++ b/Nasal/balloons.nas @@ -0,0 +1,29 @@ +# If the balloon scenario is loaded and enabled, +# place all balloons near the aircraft to get them loaded +# +_setlistener("/sim/signals/fdm-initialized", func { + + var balloonScenarioFound = 0; + foreach( var scenario; props.globals.getNode("/sim/ai", 1 ).getChildren("scenario") ) { + if( scenario.getValue() == "balloon_demo" ) + balloonScenarioFound = 1; + } + if( balloonScenarioFound != 0 ) { + 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,"ballon*") ) { + tanker.getNode("position/latitude-deg",1).setDoubleValue( position.lat() ); + tanker.getNode("position/longitude-deg",1).setDoubleValue( position.lon() ); + tanker.getNode("position/altitude-ft", 1 ).setDoubleValue( position.alt() ); + } + } + } + delete(globals, "balloons"); +}); + + diff --git a/preferences.xml b/preferences.xml index 23af271a2..d7aeed51c 100644 --- a/preferences.xml +++ b/preferences.xml @@ -581,6 +581,7 @@ Started September 2000 by David Megginson, david@megginson.com true nimitz_demo +