Initial import of the balloon scenario from gooneybird
This commit is contained in:
parent
225633dfa9
commit
31df14b691
2 changed files with 30 additions and 0 deletions
29
Nasal/balloons.nas
Normal file
29
Nasal/balloons.nas
Normal file
|
@ -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");
|
||||
});
|
||||
|
||||
|
|
@ -581,6 +581,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
<ai>
|
||||
<enabled type="bool">true</enabled>
|
||||
<scenario>nimitz_demo</scenario>
|
||||
<!-- <scenario>balloon_demo</scenario> -->
|
||||
<!-- <scenario>aircraft_demo</scenario> -->
|
||||
<!-- <scenario>refueling_demo</scenario> -->
|
||||
<!-- <scenario>lead_aircraft</scenario> -->
|
||||
|
|
Loading…
Reference in a new issue