1
0
Fork 0

Merge branch 'master' into dg101g

This commit is contained in:
Nikolaus Kerner 2011-07-01 21:36:30 +02:00
commit 667a81efd8
40 changed files with 21152 additions and 9029 deletions

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -0,0 +1,693 @@
<?xml version="1.0"?>
<PropertyList>
<path>BC-602-A.ac</path>
<animation>
<type>range</type>
<min-m>0</min-m>
<max-property>/sim/rendering/static-lod/detailed</max-property>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-OFF</object-name>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>-0.005</dep>
</entry>
<entry>
<ind>1</ind>
<dep>0</dep>
</entry>
<entry>
<ind>2</ind>
<dep>0</dep>
</entry>
<entry>
<ind>3</ind>
<dep>0</dep>
</entry>
<entry>
<ind>4</ind>
<dep>0</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>0.0</y-m>
<z-m>-0.0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>SCR-522C-T-base</object-name>
<object-name>SCR-522C-T-handle</object-name>
<object-name>SCR-522C-T-stem</object-name>
<property>/instrumentation/comm/SCR-522C/tr</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>0</dep>
</entry>
<entry>
<ind>1</ind>
<dep>37.5</dep>
</entry>
<entry>
<ind>2</ind>
<dep>75</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>-0.01</y-m>
<z-m>0.06</z-m>
</center>
<axis>
<x>1</x>
<y>0</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>pick</type>
<object-name>SCR-522C-REM</object-name>
<visible>false</visible>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>/instrumentation/comm/SCR-522C/tr</property>
<value type="int">0</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>SCR-522C-R</object-name>
<visible>false</visible>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>/instrumentation/comm/SCR-522C/tr</property>
<value type="int">1</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>SCR-522C-T</object-name>
<visible>false</visible>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>/instrumentation/comm/SCR-522C/tr</property>
<value type="int">2</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>/instrumentation/comm/SCR-522C/tr</property>
<value type="int">1</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>SCR-522C-A</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>1</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>SCR-522C-B</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>2</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>SCR-522C-C</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>3</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>SCR-522C-D</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>4</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>SCR-522C-OFF</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>0</value>
</binding>
</action>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-A</object-name>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>0</dep>
</entry>
<entry>
<ind>1</ind>
<dep>-0.005</dep>
</entry>
<entry>
<ind>2</ind>
<dep>0</dep>
</entry>
<entry>
<ind>3</ind>
<dep>0</dep>
</entry>
<entry>
<ind>4</ind>
<dep>0</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>0.0</y-m>
<z-m>-0.0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-B</object-name>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>0</dep>
</entry>
<entry>
<ind>1</ind>
<dep>0</dep>
</entry>
<entry>
<ind>2</ind>
<dep>-0.005</dep>
</entry>
<entry>
<ind>3</ind>
<dep>0</dep>
</entry>
<entry>
<ind>4</ind>
<dep>0</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>0.0</y-m>
<z-m>-0.0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-C</object-name>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>-0</dep>
</entry>
<entry>
<ind>1</ind>
<dep>-0.0</dep>
</entry>
<entry>
<ind>2</ind>
<dep>0</dep>
</entry>
<entry>
<ind>3</ind>
<dep>-0.005</dep>
</entry>
<entry>
<ind>4</ind>
<dep>0</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>0.0</y-m>
<z-m>-0.0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-D</object-name>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>-0</dep>
</entry>
<entry>
<ind>1</ind>
<dep>-0.0</dep>
</entry>
<entry>
<ind>2</ind>
<dep>0</dep>
</entry>
<entry>
<ind>3</ind>
<dep>0</dep>
</entry>
<entry>
<ind>4</ind>
<dep>-0.005</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>0.0</y-m>
<z-m>-0.0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-A.d</object-name>
<condition>
<and>
<equals>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>1</value>
</equals>
<property>/instrumentation/comm/SCR-522C/mask</property>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-A.b</object-name>
<condition>
<and>
<equals>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>1</value>
</equals>
<not>
<property>/instrumentation/comm/SCR-522C/mask</property>
</not>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-B.d</object-name>
<condition>
<and>
<equals>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>2</value>
</equals>
<property>/instrumentation/comm/SCR-522C/mask</property>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-B.b</object-name>
<condition>
<and>
<equals>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>2</value>
</equals>
<not>
<property>/instrumentation/comm/SCR-522C/mask</property>
</not>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-C.d</object-name>
<condition>
<and>
<equals>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>3</value>
</equals>
<property>/instrumentation/comm/SCR-522C/mask</property>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-C.b</object-name>
<condition>
<and>
<equals>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>3</value>
</equals>
<not>
<property>/instrumentation/comm/SCR-522C/mask</property>
</not>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-D.d</object-name>
<condition>
<and>
<equals>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>4</value>
</equals>
<property>/instrumentation/comm/SCR-522C/mask</property>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-D.b</object-name>
<condition>
<and>
<equals>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<value>4</value>
</equals>
<not>
<property>/instrumentation/comm/SCR-522C/mask</property>
</not>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-T.d</object-name>
<condition>
<and>
<not>
<property>/instrumentation/comm/ptt</property>
</not>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<property>/instrumentation/comm/SCR-522C/mask</property>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-T.b</object-name>
<condition>
<and>
<not>
<property>/instrumentation/comm/ptt</property>
</not>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<not>
<property>/instrumentation/comm/SCR-522C/mask</property>
</not>
</and>
</condition>
</animation>
<animation>
<type>pick</type>
<object-name>SCR-522C-mask-1</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>/instrumentation/comm/SCR-522C/mask</property>
<value type="bool">true</value>
<value type="bool">false</value>
</binding>
</action>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-mask-1</object-name>
<property>/instrumentation/comm/SCR-522C/mask</property>
<interpolation>
<entry>
<ind>1</ind>
<dep>0.007</dep>
</entry>
<entry>
<ind>0</ind>
<dep>0.0</dep>
</entry>
</interpolation>
<axis>
<x>1</x>
<y>0</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>pick</type>
<object-name>SCR-522-T-Lock</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>/instrumentation/comm/SCR-522C/tr-lock</property>
<value type="bool">true</value>
<value type="bool">false</value>
</binding>
</action>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522-T-Lock</object-name>
<property>/instrumentation/comm/SCR-522C/tr-lock</property>
<interpolation>
<entry>
<ind>1</ind>
<dep>0.007</dep>
</entry>
<entry>
<ind>0</ind>
<dep>0.0</dep>
</entry>
</interpolation>
<axis>
<x>1</x>
<y>0</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>material</type>
<object-name>SCR-522C-top</object-name>
<object-name>SCR-522C-box</object-name>
<object-name>a-covers</object-name>
<object-name>SCR-522C-A</object-name>
<object-name>SCR-522C-B</object-name>
<object-name>SCR-522C-C</object-name>
<object-name>SCR-522C-D</object-name>
<object-name>SCR-522C-T-base</object-name>
<object-name>SCR-522C-T-handle</object-name>
<object-name>SCR-522C-T-stem</object-name>
<object-name>SCR-522C-light-cont-2</object-name>
<object-name>SCR-522C-light-cont-1</object-name>
<object-name>SCR-522C-OFF</object-name>
<object-name>rivet-1</object-name>
<object-name>rivet-2</object-name>
<object-name>rivet-3</object-name>
<object-name>rivet-4</object-name>
<object-name>rivet-5</object-name>
<object-name>rivet-6</object-name>
<object-name>rivet-7</object-name>
<object-name>rivet-8</object-name>
<object-name>rivet-9</object-name>
<object-name>rivet-10</object-name>
<object-name>rivet-11</object-name>
<object-name>rivet-12</object-name>
<object-name>rivet-13</object-name>
<object-name>rivet-14</object-name>
<object-name>rivet-15</object-name>
<object-name>rivet-16</object-name>
<object-name>red-placard.001</object-name>
<object-name>red-placard.002</object-name>
<object-name>black-placard.001</object-name>
<object-name>black-placard.002</object-name>
<object-name>right-outer-bracket</object-name>
<object-name>left-inner-bracket</object-name>
<object-name>left-outer-bracket</object-name>
<object-name>baseScrew1</object-name>
<object-name>baseScrew2</object-name>
<object-name>baseScrew3</object-name>
<object-name>baseScrew4</object-name>
<object-name>bigConnector</object-name>
<object-name>bigConnectorBase</object-name>
<object-name>bigConnectorScrew1</object-name>
<object-name>bigConnectorScrew2</object-name>
<object-name>bigConnectorScrew3</object-name>
<object-name>bigConnectorScrew4</object-name>
<object-name>smallConnector</object-name>
<object-name>smallConnectorBase</object-name>
<object-name>smallConnectorScrw1</object-name>
<object-name>smallConnectorScrw2</object-name>
<object-name>smallConnectorScrw3</object-name>
<object-name>smallConnectorScrw4</object-name>
<object-name>uniluminatedMaskTR</object-name>
<object-name>uniluminatedMask</object-name>
<emission>
<factor-prop>controls/lighting/cabin-norm</factor-prop>
<red>0.28</red>
<green>0.18</green>
<blue>0.18</blue>
</emission>
</animation>
<animation>
<type>material</type>
<object-name>SCR-522C-lamp-A.b</object-name>
<object-name>SCR-522C-lamp-B.b</object-name>
<object-name>SCR-522C-lamp-C.b</object-name>
<object-name>SCR-522C-lamp-D.b</object-name>
<emission>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<red>0.3</red>
<green>0.3</green>
<blue>1.0</blue>
</emission>
</animation>
<animation>
<type>material</type>
<object-name>SCR-522C-lamp-A.d</object-name>
<object-name>SCR-522C-lamp-B.d</object-name>
<object-name>SCR-522C-lamp-C.d</object-name>
<object-name>SCR-522C-lamp-D.d</object-name>
<emission>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<red>0.01</red>
<green>0.01</green>
<blue>0.25</blue>
</emission>
</animation>
<animation>
<type>material</type>
<object-name>SCR-522C-lamp-T.b</object-name>
<emission>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<red>1.0</red>
<green>1.0</green>
<blue>1.0</blue>
</emission>
</animation>
<animation>
<type>material</type>
<object-name>SCR-522C-lamp-T.d</object-name>
<emission>
<property>/instrumentation/comm/SCR-522C/frequencies/channel-selected</property>
<red>0.07</red>
<green>0.07</green>
<blue>0.07</blue>
</emission>
</animation>
</PropertyList>

View file

@ -0,0 +1,231 @@
<?xml version="1.0"?>
<PropertyList>
<name>SCR-522C-radio</name>
<width>550</width>
<modal>false</modal>
<layout>vbox</layout>
<group>
<layout>hbox</layout>
<empty>
<stretch>1</stretch>
</empty>
<text>
<label>Radio Frequencies SCR-522C (US) or TR1133 (UK)</label>
</text>
<empty>
<stretch>1</stretch>
</empty>
<button>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<legend></legend>
<keynum>27</keynum>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<text>
<label>Selected</label>
</text>
<group>
<layout>hbox</layout>
<text>
<label>Channel</label>
</text>
<text>
<label>Frequency</label>
</text>
</group>
<group>
<layout>hbox</layout>
<text>
<!--<label>xxxxxxx</label>-->
<label>Channel</label>
<live>true</live>
<!--<format>%.2f</format>-->
<property>/instrumentation/comm/SCR-522C/frequencies/channel</property>
</text>
<text>
<!--<label>xxxxxxx</label>-->
<label>MHz</label>
<live>true</live>
<format>%.2f</format>
<property>/instrumentation/comm[0]/frequencies/selected-mhz</property>
</text>
</group>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<text>
<label>Channel Assignment</label>
</text>
</group>
<group>
<layout>table</layout>
<!-- headers -->
<!--<text>
<row>0</row>
<col>4</col>
<label>Standby</label>
</text>-->
<!-- Dummy label to stretch table, as layout manager doesn't handle labels well -->
<text>
<row>0</row>
<col>6</col>
<label></label>
</text>
<text>
<row>1</row>
<col>0</col>
<halign>right</halign>
<label>A</label>
</text>
<input>
<name>channel A</name>
<row>1</row>
<col>1</col>
<width>75</width>
<height>25</height>
<label>MHz</label>
<property>/instrumentation/comm/channels/A-mhz</property>
</input>
<text>
<row>1</row>
<col>3</col>
<halign>right</halign>
<label>B</label>
</text>
<input>
<name>channel B</name>
<row>1</row>
<col>4</col>
<width>75</width>
<height>25</height>
<label>MHz</label>
<property>/instrumentation/comm/channels/B-mhz</property>
</input>
<text>
<row>2</row>
<col>0</col>
<halign>right</halign>
<label>C</label>
</text>
<input>
<name>channel C</name>
<row>2</row>
<col>1</col>
<width>75</width>
<height>25</height>
<label>MHz</label>
<property>/instrumentation/comm/channels/C-mhz</property>
</input>
<text>
<row>2</row>
<col>3</col>
<halign>right</halign>
<label>D</label>
</text>
<input>
<name>channel D</name>
<row>2</row>
<col>4</col>
<width>75</width>
<height>25</height>
<label>MHz</label>
<property>/instrumentation/comm/channels/D-mhz</property>
</input>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<button>
<legend>ATC Services in range</legend>
<binding>
<command>ATC-freq-search</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<default-padding>6</default-padding>
<empty>
<stretch>true</stretch>
</empty>
<button>
<legend>OK</legend>
<default>true</default>
<equal>true</equal>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<legend>Apply</legend>
<equal>true</equal>
<binding>
<command>dialog-apply</command>
</binding>
</button>
<button>
<legend>Reset</legend>
<equal>true</equal>
<binding>
<command>dialog-update</command>
</binding>
</button>
<button>
<legend>Cancel</legend>
<equal>true</equal>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
<empty>
<stretch>true</stretch>
</empty>
</group>
</PropertyList>

View file

@ -0,0 +1,161 @@
#####################################################################################
# This script provides the gui to set up the TR1133/SCR-522C radio #
# using a BC-602-A control box #
# #
# Author Vivian Meazza June 2011 #
# #
# mods Hal V. Engel June 2011 #
# #
#####################################################################################
# ================================ Initalize ======================================
# Make sure all needed properties are present and accounted
# for, and that they have sane default values.
var channelA_node = props.globals.initNode("instrumentation/comm/channels/A-mhz", 0, "DOUBLE");
var channelB_node = props.globals.initNode("instrumentation/comm/channels/B-mhz", 0, "DOUBLE");
var channelC_node = props.globals.initNode("instrumentation/comm/channels/C-mhz", 0, "DOUBLE");
var channelD_node = props.globals.initNode("instrumentation/comm/channels/D-mhz", 0, "DOUBLE");
var channel_selected_node = props.globals.initNode("instrumentation/comm/SCR-522C/frequencies/channel-selected", 0, "INT");
var tr_node = props.globals.initNode("instrumentation/comm/SCR-522C/tr", 0, "INT");
props.globals.initNode("instrumentation/comm/SCR-522C/frequencies/channel", "", "STRING");
props.globals.initNode("instrumentation/comm/SCR-522C/mask", 0, "BOOL");
props.globals.initNode("instrumentation/comm/SCR-522C/tr-lock", 0, "BOOL");
# turn the radio off
props.globals.initNode("instrumentation/comm/serviceable", 0, "BOOL");
var comm_selected_node = props.globals.getNode("instrumentation/comm/frequencies/selected-mhz", 1);
var comm_standby_node = props.globals.getNode("instrumentation/comm/frequencies/standby-mhz", 1);
var comm1_selected_node = props.globals.getNode("instrumentation/comm[1]/frequencies/selected-mhz", 1);
var comm1_standby_node = props.globals.getNode("instrumentation/comm[1]/frequencies/standby-mhz", 1);
var channel = ["OFF","A","B","C","D"];
setprop("instrumentation/comm/SCR-522C/frequencies/channel", channel[channel_selected_node.getValue()]);
# override default Equipment --> radio menu item
# Radio needs to be global in scope since it needs to presist for this to work
var Radio = gui.Dialog.new("sim/gui/dialogs/SCR-522C/dialog",
"Aircraft/Instruments-3d/SCR-522C/Dialogs/radios.xml");
gui.menuBind("radio", "SCR_522C.Radio.open()");
# override controls.ptt. This implements a REMote ptt switch.
controls.ptt = func {
# T/R/REM set to REM remote ptt switch controls transmitter
# print("intercept ptt for BC-602-A");
if (getprop("instrumentation/comm/SCR-522C/tr") == 0 and # in REMote ptt switch mode
getprop("instrumentation/comm/SCR-522C/frequencies/channel-selected") > 0) # and radio is on
setprop("instrumentation/comm/ptt", arg[0]); # let remote ptt control transmitter
else # otherwise
setprop("instrumentation/comm/ptt", 0); # the remote ptt does nothing
}
# =============================== listeners ===============================
#
# listener for channel selector. Will cause the frequency of the transceiver to be changed.
# will also turn the radio on and off
var listenChannelSelected = func(n) {
var channel_no = n.getValue();
if (channel_no == nil) channel_no = 0;
# print("channel", channel_no, " ", channel[channel_no]);
setprop("instrumentation/comm/SCR-522C/frequencies/channel", channel[channel_no]);
if (channel_no == 0)
setprop("instrumentation/comm/serviceable", 0);
else {
setprop("instrumentation/comm/serviceable", 1);
if (channel_no == 1) {
setprop("instrumentation/comm/frequencies/selected-mhz", getprop("instrumentation/comm/channels/A-mhz"));
setprop("instrumentation/comm/frequencies/standby-mhz", getprop("instrumentation/comm/channels/A-mhz"));
}
else if (channel_no == 2){
setprop("instrumentation/comm/frequencies/selected-mhz", getprop("instrumentation/comm/channels/B-mhz"));
setprop("instrumentation/comm/frequencies/standby-mhz", getprop("instrumentation/comm/channels/B-mhz"));
}
else if (channel_no == 3){
setprop("instrumentation/comm/frequencies/selected-mhz", getprop("instrumentation/comm/channels/C-mhz"));
setprop("instrumentation/comm/frequencies/standby-mhz", getprop("instrumentation/comm/channels/C-mhz"));
}
else if (channel_no == 4){
setprop("instrumentation/comm/frequencies/selected-mhz", getprop("instrumentation/comm/channels/D-mhz"));
setprop("instrumentation/comm/frequencies/standby-mhz", getprop("instrumentation/comm/channels/D-mhz"));
}
}
}
# listener for the local TR switch.
var listenTr = func(t) {
var tr = t.getValue();
# print("tr ",tr);
if (tr == nil) tr = 0;
if (tr == 2 and getprop("instrumentation/comm/SCR-522C/frequencies/channel-selected") > 0)
setprop("instrumentation/comm/ptt", 1);
else if (tr == 1)
setprop("instrumentation/comm/ptt", 0);
if (tr == 0 and getprop("/instrumentation/comm/SCR-522C/tr-lock"))
setprop("/instrumentation/comm/SCR-522C/tr", 1);
}
# listener for the local TR lock.
var listenTrLock = func(i) {
var tr_lock = i.getValue();
# print("tr_lock");
if (tr_lock == nil) tr_lock = false;
if (tr_lock and getprop("/instrumentation/comm/SCR-522C/tr") == 0)
setprop("/instrumentation/comm/SCR-522C/tr", 1);
# else if (getprop("/instrumentation/comm/SCR-522C/tr") == 2)
# setprop("/instrumentation/comm/SCR-522C/tr", 1);
}
var SCR_522C_init = func(){
print ("initializing SCR-522C ...");
var channelA_init = comm_selected_node.getValue();
var channelB_init = comm_standby_node.getValue();
var channelC_init = comm1_selected_node.getValue();
var channelD_init = comm1_standby_node.getValue();
channelA_node.setValue(channelA_init);
channelB_node.setValue(channelB_init);
channelC_node.setValue(channelC_init);
channelD_node.setValue(channelD_init);
comm_selected_node.setValue(0);
comm_standby_node.setValue(0);
comm1_selected_node.setValue(0);
comm1_standby_node.setValue(0);
# over ride F12
setprop("input/keyboard/key[268]/binding/dialog-name", "SCR-522C-radio");
setprop("input/keyboard/key[268]/binding/command", "dialog-show");
# =============================== start listeners ===============================
#
setlistener("instrumentation/comm/SCR-522C/frequencies/channel-selected", listenChannelSelected, 1, 0);
setlistener("instrumentation/comm/SCR-522C/tr", listenTr, 1, 0);
setlistener("instrumentation/comm/SCR-522C/tr-lock", listenTrLock, 1, 0);
# print("... done");
} # end func initialize
# run initialization
setlistener("sim/signals/fdm-initialized", SCR_522C_init);

View file

@ -0,0 +1,29 @@
To enable full functionality of the SCR-522C/TR1133 radio there are several things
that you will need to do.
First you will need to change the <nasal> section of your *set.xml file so that it
looks like the following.
<nasal>
<!-- your other nasal files -->
<!-- the following three lines must be exactly like this -->
<SCR_522C>
<file>Aircraft/Instruments-3d/SCR-522C/Nasal/SCR-522C.nas</file>
</SCR_522C>
</nasal>
This will enable the F12 key to bring up the frequencies dialog. It will also over ride the
Equipment --> radios menu item so that it brings up the correct menu for the SCR-522C/TR1133
radios. This also implements other radio features like support for a remote TR switch, the
TR switch on the BC-602-A control box, TR switch lock, channel switching, power switch and
so on.
For dark conditions when cabin/cockpit illumination is used all of the radio models object
are illuminated in response to
<property>/controls/lighting/cabin-norm</property>
If you are using a different property for your cabin/cockpit lights you will need to map your
lighting property to /controls/lighting/cabin-norm.

File diff suppressed because it is too large Load diff

View file

@ -1,356 +0,0 @@
<?xml version="1.0"?>
<PropertyList>
<path>SCR-522C.ac</path>
<animation>
<type>range</type>
<min-m>0</min-m>
<max-m>7</max-m>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-OFF</object-name>
<property>/systems/comm/SCR-522C/frequencies/channel-selected</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>-0.005</dep>
</entry>
<entry>
<ind>1</ind>
<dep>0</dep>
</entry>
<entry>
<ind>2</ind>
<dep>0</dep>
</entry>
<entry>
<ind>3</ind>
<dep>0</dep>
</entry>
<entry>
<ind>4</ind>
<dep>0</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>0.0</y-m>
<z-m>-0.0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>SCR-522C-T-base</object-name>
<object-name>SCR-522C-T-sw-handle</object-name>
<object-name>SCR-522C-T-stem</object-name>
<property>/systems/comm/SCR-522C/tr</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>0</dep>
</entry>
<entry>
<ind>1</ind>
<dep>30</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>-0.01</y-m>
<z-m>0.05</z-m>
</center>
<axis>
<x>1</x>
<y>0</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-A</object-name>
<property>/systems/comm/SCR-522C/frequencies/channel-selected</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>0</dep>
</entry>
<entry>
<ind>1</ind>
<dep>-0.005</dep>
</entry>
<entry>
<ind>2</ind>
<dep>0</dep>
</entry>
<entry>
<ind>3</ind>
<dep>0</dep>
</entry>
<entry>
<ind>4</ind>
<dep>0</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>0.0</y-m>
<z-m>-0.0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-B</object-name>
<property>/systems/comm/SCR-522C/frequencies/channel-selected</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>0</dep>
</entry>
<entry>
<ind>1</ind>
<dep>0</dep>
</entry>
<entry>
<ind>2</ind>
<dep>-0.005</dep>
</entry>
<entry>
<ind>3</ind>
<dep>0</dep>
</entry>
<entry>
<ind>4</ind>
<dep>0</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>0.0</y-m>
<z-m>-0.0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-C</object-name>
<property>/systems/comm/SCR-522C/frequencies/channel-selected</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>-0</dep>
</entry>
<entry>
<ind>1</ind>
<dep>-0.0</dep>
</entry>
<entry>
<ind>2</ind>
<dep>0</dep>
</entry>
<entry>
<ind>3</ind>
<dep>-0.005</dep>
</entry>
<entry>
<ind>4</ind>
<dep>0</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>0.0</y-m>
<z-m>-0.0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-D</object-name>
<property>/systems/comm/SCR-522C/frequencies/channel-selected</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>-0</dep>
</entry>
<entry>
<ind>1</ind>
<dep>-0.0</dep>
</entry>
<entry>
<ind>2</ind>
<dep>0</dep>
</entry>
<entry>
<ind>3</ind>
<dep>0</dep>
</entry>
<entry>
<ind>4</ind>
<dep>-0.005</dep>
</entry>
</interpolation>
<center>
<x-m>-0.00</x-m>
<y-m>0.0</y-m>
<z-m>-0.0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-A</object-name>
<condition>
<equals>
<property>/systems/comm/SCR-522C/frequencies/channel-selected</property>
<value>1</value>
</equals>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-B</object-name>
<condition>
<equals>
<property>/systems/comm/SCR-522C/frequencies/channel-selected</property>
<value>2</value>
</equals>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-C</object-name>
<condition>
<equals>
<property>/systems/comm/SCR-522C/frequencies/channel-selected</property>
<value>3</value>
</equals>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-D</object-name>
<condition>
<equals>
<property>/systems/comm/SCR-522C/frequencies/channel-selected</property>
<value>4</value>
</equals>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>SCR-522C-lamp-T</object-name>
<condition>
<and>
<property>/systems/comm/SCR-522C/tr</property>
<greater-than>
<property>/systems/comm/SCR-522C/frequencies/channel-selected</property>
<value>0</value>
</greater-than>
</and>
</condition>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-light-cont-1</object-name>
<property>/systems/comm/SCR-522C/channel-dimmer</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>0.005</dep>
</entry>
<entry>
<ind>1.0</ind>
<dep>0</dep>
</entry>
</interpolation>
<axis>
<x>1</x>
<y>0</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>SCR-522C-light-cont-2</object-name>
<property>/systems/comm/SCR-522C/tr-dimmer</property>
<interpolation>
<entry>
<ind>0</ind>
<dep>0.005</dep>
</entry>
<entry>
<ind>1.0</ind>
<dep>0</dep>
</entry>
</interpolation>
<axis>
<x>1</x>
<y>0</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>material</type>
<object-name>SCR-522C-top</object-name>
<object-name>SCR-522C-box</object-name>
<object-name>SCR-522C-A</object-name>
<object-name>SCR-522C-B</object-name>
<object-name>SCR-522C-C</object-name>
<object-name>SCR-522C-D</object-name>
<object-name>SCR-522C-T-base</object-name>
<object-name>SCR-522C-T-sw-handle</object-name>
<object-name>SCR-522C-T-stem</object-name>
<object-name>SCR-522C-light-cont-2</object-name>
<object-name>SCR-522C-light-cont-1</object-name>
<object-name>SCR-522C-OFF</object-name>
<object-name>right-outer-bracket</object-name>
<object-name>left-inner-bracket</object-name>
<object-name>left-outer-bracket</object-name>
<emission>
<factor-prop>controls/lighting/cabin-norm</factor-prop>
<red>0.28</red>
<green>0.18</green>
<blue>0.18</blue>
</emission>
</animation>
</PropertyList>

View file

@ -49,9 +49,14 @@ var TR1133_init = func(){
comm1_selected_node.setValue(0);
comm1_standby_node.setValue(0);
# override F12
setprop("input/keyboard/key[268]/binding/command", "nasal");
setprop("input/keyboard/key[268]/binding/script", "TR1133.radio_dlg.open()");
# Disable the menu item "Equipment > radio" so we use our own gui: " > Radio".
print("Disabling Menu: Equipment -> Radios GUI use Spitfire -> Radio");
gui.menuEnable("radio",0);
print("Disabling Menu: Equipment -> Radios GUI using TR1133 -> Radio");
gui.menuBind("radio", "TR1133.radio_dlg.open()");
# =============================== listeners ===============================

View file

@ -400,6 +400,7 @@ The flags printed after the node type have the following meaning:
W -> trace write operations
A -> archive bit set
U -> user archive bit set
P -> preserved bit set (value is preserved on sim-reset)
T -> property is "tied"
Ln -> number of listeners attached to this node

View file

@ -134,8 +134,9 @@ var attributes = func(p, verbose = 1) {
var W = p.getAttribute("trace-write") ? "W" : "";
var A = p.getAttribute("archive") ? "A" : "";
var U = p.getAttribute("userarchive") ? "U" : "";
var P = p.getAttribute("preserve") ? "P" : "";
var T = p.getAttribute("tied") ? "T" : "";
var attr = r ~ w ~ R ~ W ~ A ~ U ~ T;
var attr = r ~ w ~ R ~ W ~ A ~ U ~ P ~ T;
var type = "(" ~ p.getType();
if (size(attr))
type ~= ", " ~ attr;

View file

@ -1265,6 +1265,17 @@ _setlistener("/sim/signals/screenshot", func {
}
});
var terrasync_stalled = 0;
_setlistener("/sim/terrasync/stalled", func {
var stalled = getprop("/sim/terrasync/stalled");
if (stalled and !terrasync_stalled)
{
var button = { button: { legend: "Ok", default: 1, binding: { command: "dialog-close" }}};
popupTip("Scenery download stalled. Too many errors reported. See log output.", 600, button);
}
terrasync_stalled = stalled;
});
var do_welcome = 1;
_setlistener("/sim/signals/fdm-initialized", func {
var haveTutorials = size(props.globals.getNode("/sim/tutorials", 1).getChildren("tutorial"));

902
Nasal/jetways/jetways.nas Normal file
View file

@ -0,0 +1,902 @@
###############################################################################
##
## Animated Jetway System. Spawns and manages interactive jetway models.
##
## Copyright (C) 2011 Ryan Miller
## This file is licensed under the GPL license version 2 or later.
##
###############################################################################
###############################################################################
# (See http://wiki.flightgear.org/Howto:_Animated_jetways)
#
# Special jetway definition files located in $FG_ROOT/Airports/Jetways/XXXX.xml
# for each airport are loaded when the user's aircraft is within 50 nm of the
# airport. The script dynamically generates runtime model files, writes them to
# $FG_ROOT/Models/Airport/Jetway/runtimeX.xml, and places them into the
# simulator using the model manager.
#
# Different jetway models can be defined and are placed under
# $FG_ROOT/Models/Airport/Jetway/XXX.xml.
#
# Jetways can be extended/retracted independently either by user operation or
# by automatic extension for AI models and multiplayer aircraft.
#
# UTILITY FUNCTIONS
# -----------------
#
# print_debug(<message>) - prints debug messages
# <message> - message to print
#
# print_error(<messsage>) - prints error messages
# <message> - error to print
#
# alert(<message>) - displays an alert message in-sim
# <message> - the message
#
# normdeg(<angle>) - normalizes angle measures between -180° and 180°
# <angle> - angle to normalize
#
# remove(<vector>, <item>) - removes an element from a vector
# <vector> - vector
# <index> - item
#
# isin(<vector>, <item>) - checks if an item exists in a vector
# <vector> - vector
# <item> - item
#
# putmodel(<path>, <lat>, <lon>, <alt>, <hdg>) - add a model to the scene graph (unlike geo.put_model(), models added with this function can be adjusted)
# <path> - model path
# <lat> - latitude
# <lon> - longitude
# <alt> - altitude in m
# <hdg> - heading
#
# interpolate_table(<table>, <value>) - interpolates a value within a table
# <table> - interpolation table/vector, in the format of [[<ind>, <dep>], [<ind>, <dep>], ... ]
# <value> - value
#
# get_relative_filepath(<path>, <target>) - gets a relative file path from a directory
# <path> - directory path should be relative to
# <target> - target directory
#
# find_airports(<max dist>) - gets a list of nearest airports
# <max dist> - maximum search distance in nm (currently unused)
#
# JETWAY CLASS
# ------------
#
# Jetway. - creates a new jetway object/model
# new(<airport>, <model>, <gate>, <door>,
# <airline>, <lat>, <lon>, <alt>,
# <heading>, [, <init_extend>]
# [, <init_heading>] [, <init_pitch>]
# [, <init_ent_heading>])
# <airport> - ICAO of associated airport
# <model> - jetway model definition (i.e. Models/Airport/Jetway/generic.xml)
# <gate> - gate number (i.e. "A1")
# <door> - door number (i.e. 0)
# <airline> - airline code (i.e. "AAL")
# <lat> - latitude location of model
# <lon> - longitude location of model
# <alt> - elevation of model in m
# <heading> - (optional) heading of model
# <init_extend> - (optional) initial extension of tunnel in m
# <init_heading> - (optional) initial rotation of tunnel along the Z axis
# <init_pitch> - (optional) initial pitch of tunnel (rotation along Y axis)
# <init_ent_heading> - (optional) initial rotation of entrance along the Z axis
#
# toggle(<user>, <heading>, <coord> - extends/retracts a jetway
# [, <hood>])
# <user> - whether or not jetway is toggled by user command (0/1)
# <heading> - heading of aircraft to connect to
# <coord> - a geo.Coord of the target aircraft's door
# <hood> - (optional) amount to rotate jetway hood (only required when <user> != 1)
#
# extend(<user>, <heading>, <coord> - extends a jetway (should be called by Jetway.toggle())
# [, <hood>])
# <user> - whether or not jetway is toggled by user command (0/1)
# <heading> - heading of aircraft to connect to
# <coord> - a geo.Coord of the target aircraft's door
# <hood> - (optional) amount to rotate jetway hood (only required when <user> != 1)
#
# retract(<user>) - retracts a jetway (should be called by Jetway.toggle())
# <user> - whether or not a jetway is toggled by user command (0/1)
#
# remove() - removes a jetway object and its model
#
# reload() - reloads a jetway object and its model
#
# setpos(<lat>, <lon>, <heading>, <alt>) - moves a jetway to a new location
# <lat> - new latitude
# <lon> - new longitude
# <heading> - new heading
# <alt> - new altitude in m
#
# setmodel(<model>, <airline>, <gate>) - changes the jetway model
# <model> - new model
# <airline> - new airline sign code
# <gate> - new gate number
#
# INTERACTION FUNCTIONS
# ---------------------
#
# dialog() - open settings dialog
#
# toggle_jetway(<id>) - toggles a jetway by user command (should be called by a pick animation in a jetway model)
# <id> - id number of jetway to toggle
#
# toggle_jetway_from_coord(<door>, <hood>, - toggles a jetway with the target door at the specified coordinates
# <heading>, [<lat>,
# <lon>] [<coord>])
# <door> - door number (i.e. 0)
# <hood> - amount to rotate jetway hood
# <lat> - (required or <coord>) latitude location of door
# <lon> - (required or <coord>) longitude location of door
# <coord> - (required or <lat>, <lon>) a geo.Coord of the door
#
# toggle_jetway_from_model(<model node>) - toggles a jetway using an AI model instead of the user's aircraft
# <model node> - path of AI model (i.e. /ai/models/aircraft[0])- can be the path in a string or a props.Node
#
# INTERNAL FUNCTIONS
# ------------------
#
# load_airport_jetways(<airport>) - loads jetways at an airport
# <airport> - ICAO of airport
#
# unload_airport_jetways(<airport>) - unloads jetways at an airport
# <airport> - ICAO of airport
#
# update_jetways() - interpolates model animation values
#
# load_jetways() - loads new jetway models and unloads out-of-range models every 10 seconds; also connects AI and MP aircraft
#
## Utility functions
####################
# prints debug messages
var print_debug = func(msg)
{
if (debug_switch.getBoolValue())
{
print(msg);
}
};
# prints error messages
var print_error = func(msg)
{
print("\x1b[31m" ~ msg ~ "\x1b[m");
};
# alerts the user
var alert = func(msg)
{
setprop("/sim/messages/ground", msg);
};
# normalizes headings between -180 and 180
var normdeg = func(x)
{
while (x >= 180)
{
x -= 360;
}
while (x <= -180)
{
x += 360;
}
return x;
};
# deletes an item in a vector
var remove = func(vector, item)
{
var s = size(vector);
var found = 0;
for (var i = 0; i < s; i += 1)
{
if (found)
{
vector[i - 1] = vector[i];
}
elsif (vector[i] == item)
{
found = 1;
}
}
if (found) setsize(vector, s - 1);
return vector;
};
# checks if an item is in a vector
var isin = func(vector, v)
{
for (var i = 0; i < size(vector); i += 1)
{
if (vector[i] == v) return 1;
}
return 0;
};
# adds a model
var putmodel = func(path, lat, lon, alt, hdg)
{
var models = props.globals.getNode("/models");
var model = nil;
for (var i = 0; 1; i += 1)
{
if (models.getChild("model", i, 0) == nil)
{
model = models.getChild("model", i, 1);
break;
}
}
var model_path = model.getPath();
model.getNode("path", 1).setValue(path);
model.getNode("latitude-deg", 1).setDoubleValue(lat);
model.getNode("latitude-deg-prop", 1).setValue(model_path ~ "/latitude-deg");
model.getNode("longitude-deg", 1).setDoubleValue(lon);
model.getNode("longitude-deg-prop", 1).setValue(model_path ~ "/longitude-deg");
model.getNode("elevation-ft", 1).setDoubleValue(alt * M2FT);
model.getNode("elevation-ft-prop", 1).setValue(model_path ~ "/elevation-ft");
model.getNode("heading-deg", 1).setDoubleValue(hdg);
model.getNode("heading-deg-prop", 1).setValue(model_path ~ "/heading-deg");
model.getNode("pitch-deg", 1).setDoubleValue(0);
model.getNode("pitch-deg-prop", 1).setValue(model_path ~ "/pitch-deg");
model.getNode("roll-deg", 1).setDoubleValue(0);
model.getNode("roll-deg-prop", 1).setValue(model_path ~ "/roll-deg");
model.getNode("load", 1).remove();
return model;
};
# interpolates a value
var interpolate_table = func(table, v)
{
var x = 0;
forindex (i; table)
{
if (v >= table[i][0])
{
x = i + 1 < size(table) ? (v - table[i][0]) / (table[i + 1][0] - table[i][0]) * (table[i + 1][1] - table[i][1]) + table[i][1] : table[i][1];
}
}
return x;
};
# gets a relative file path
var get_relative_filepath = func(path, target)
{
var newpath = "";
for (var i = size(path) - 1; i >= 0; i -= 1)
{
var char = substr(path, i, 1);
if (char == "/") newpath ~= "../";
}
# we can just append the target path for UNIX systems, but we need to remove the drive letter prefix for DOS systems
return newpath ~ (string.match(substr(target, 0, 3), "?:/") ? substr(target, 2, size(target) - 2) : target);
};
# gets a list of nearest airports
# TODO: Don't use /sim/airport/nearest-airport-id, which restricts the list to 1 airport
var find_airports = func(max_distance)
{
var apt = getprop("/sim/airport/closest-airport-id");
return apt == "" ? nil : [apt];
};
## Global variables
###################
var root = nil;
var home = nil;
var scenery = [];
var UPDATE_PERIOD = 0;
var LOAD_PERIOD = 10;
var LOAD_DISTANCE = 50; # in nautical miles
var LOAD_JETWAY_PERIOD = 0.05;
var NUMBER_OF_JETWAYS = 1000; # approx max number of jetways loadable in FG
var runtime_files = NUMBER_OF_JETWAYS / LOAD_PERIOD * LOAD_JETWAY_PERIOD;
runtime_files = int(runtime_files) == runtime_files ? runtime_files : int(runtime_files) + 1;
var runtime_file = 0;
var update_loopid = -1;
var load_loopid = -1;
var load_listenerid = nil;
var loadids = {};
var dialog_object = nil;
var loaded_airports = [];
var jetways = [];
# properties
var on_switch = nil;
var debug_switch = nil;
var mp_switch = nil;
var jetway_id_prop = "/sim/jetways/last-loaded-jetway";
# interpolation tables
var extend_rate = 0.5;
var extend_table = [
[0.0, 0.0],
[0.2, 0.3],
[0.6, 0.3],
[0.8, 1.0],
[1.0, 1.0]
];
var pitch_rate = 1;
var pitch_table = [
[0.0, 0.0],
[0.4, 0.7],
[0.7, 1.0],
[1.0, 1.0]
];
var heading_rate = 1;
var heading_table = [
[0.0, 0.0],
[0.2, 0.0],
[0.6, 0.7],
[0.9, 1.0],
[1.0, 1.0]
];
var heading_entrance_rate = 5;
var heading_entrance_table = [
[0.0, 0.0],
[0.3, 0.0],
[0.6, 0.7],
[0.8, 1.0],
[1.0, 1.0]
];
var hood_rate = 1;
var hood_table = [
[0.0, 0.0],
[0.9, 0.0],
[1.0, 1.0]
];
## Classes
##########
# main jetway class
var Jetway =
{
new: func(airport, model, gate, door, airline, lat, lon, alt, heading, init_extend = 0, init_heading = 0, init_pitch = 0, init_ent_heading = 0)
{
var id = 0;
for (var i = 0; 1; i += 1)
{
if (i == size(jetways))
{
setsize(jetways, i + 1);
id = i;
break;
}
elsif (jetways[i] == nil)
{
id = i;
}
}
# locate the jetway model directory and load the model tree
var model_tree = nil;
var model_file = "";
var model_dir = "";
var airline_file = "";
if (props.globals.getNode("/sim/paths/use-custom-scenery-data", 1).getBoolValue())
{
# search in scenery directories
foreach (var scenery_path; scenery)
{
model_dir = scenery_path ~ "/Models/Airport/Jetway";
model_file = model_dir ~ "/" ~ model ~ ".xml";
airline_file = model_dir ~ "/" ~ model ~ ".airline." ~ airline ~ ".xml";
print_debug("Trying to load a jetway model from " ~ model_file);
if (io.stat(model_file) == nil) continue;
model_tree = io.read_properties(model_file);
if (io.stat(airline_file) != nil) props.copy(io.read_properties(airline_file), model_tree);
break;
}
}
if (model_tree == nil)
{
model_dir = root ~ "/Models/Airport/Jetway";
model_file = model_dir ~ "/" ~ model ~ ".xml";
airline_file = model_dir ~ "/" ~ model ~ ".airline." ~ airline ~ ".xml";
print_debug("Falling back to " ~ model_file);
if (io.stat(model_file) == nil)
{
print_error("Failed to load jetway model: " ~ model);
return;
}
model_tree = io.read_properties(model_file);
if (io.stat(airline_file) != nil) props.copy(io.read_properties(airline_file), model_tree);
}
var m =
{
parents: [Jetway]
};
m._active = 1; # set this to 'true' on the first run so that the offsets can take effect
m._edit = 0;
m.airport = airport;
m.gate = gate;
m.airline = airline;
m.id = id;
m.model = model;
m.extended = 0;
m.door = door;
m.lat = lat;
m.lon = lon;
m.alt = alt;
m.heading = geo.normdeg(180 - heading);
m.init_extend = init_extend;
m.init_heading = init_heading;
m.init_pitch = init_pitch;
m.init_ent_heading = init_ent_heading;
m.target_extend = 0;
m.target_pitch = 0;
m.target_heading = 0;
m.target_ent_heading = 0;
m.target_hood = 0;
m.rotunda_x = model_tree.getNode("rotunda/x-m").getValue();
m.rotunda_y = model_tree.getNode("rotunda/y-m").getValue();
m.rotunda_z = model_tree.getNode("rotunda/z-m").getValue();
m.offset_extend = model_tree.getNode("extend-offset-m").getValue();
m.offset_entrance = model_tree.getNode("entrance-offset-m").getValue();
m.min_extend = model_tree.getNode("min-extend-m").getValue();
m.max_extend = model_tree.getNode("max-extend-m").getValue();
# get the runtime file path
if (runtime_file == runtime_files)
{
runtime_file = 0;
}
var runtime_file_path = home ~ "/runtime-jetways/" ~ runtime_file ~ ".xml";
runtime_file += 1;
# create the model node and the door object
m.node = putmodel(runtime_file_path, lat, lon, alt, geo.normdeg(360 - heading));
var node_path = m.node.getPath();
m.door_object = aircraft.door.new(node_path ~ "/jetway-position", 0);
# manipulate the model tree
model_tree.getNode("path").setValue(model_dir ~ "/" ~ model_tree.getNode("path").getValue());
model_tree.getNode("toggle-action-script").setValue("jetways.toggle_jetway(" ~ id ~ ");");
model_tree.getNode("gate").setValue(m.gate);
model_tree.getNode("extend-m").setValue(props.globals.initNode(node_path ~ "/jetway-position/extend-m", 0, "DOUBLE").getPath());
model_tree.getNode("pitch-deg").setValue(props.globals.initNode(node_path ~ "/jetway-position/pitch-deg", 0, "DOUBLE").getPath());
model_tree.getNode("heading-deg").setValue(props.globals.initNode(node_path ~ "/jetway-position/heading-deg", 0, "DOUBLE").getPath());
model_tree.getNode("entrance-heading-deg").setValue(props.globals.initNode(node_path ~ "/jetway-position/entrance-heading-deg", 0, "DOUBLE").getPath());
model_tree.getNode("hood-deg").setValue(props.globals.initNode(node_path ~ "/jetway-position/hood-deg", 0, "DOUBLE").getPath());
# airline texture
var airline_tex = model_tree.getNode("airline-texture-path", 1).getValue();
var airline_node = model_tree.getNode(model_tree.getNode("airline-prop-path", 1).getValue());
if (airline_tex != nil and airline_node != nil)
{
airline_node.setValue(get_relative_filepath(home ~ "/runtime-jetways", model_dir ~ "/" ~ airline_tex));
}
# write the model tree
io.write_properties(runtime_file_path, model_tree);
jetways[id] = m;
print_debug("Loaded jetway #" ~ id);
jetway_id_prop.setValue(id);
return m;
},
toggle: func(user, heading, coord, hood = 0)
{
me._active = 1;
if (me.extended)
{
me.retract(user, heading, coord);
}
else
{
me.extend(user, heading, coord, hood);
}
},
extend: func(user, heading, door_coord, hood = 0)
{
me.extended = 1;
# get the coordinates of the jetway and offset for the rotunda position
var jetway_coord = geo.Coord.new();
jetway_coord.set_latlon(me.lat, me.lon);
jetway_coord.apply_course_distance(me.heading, me.rotunda_x);
jetway_coord.apply_course_distance(me.heading - 90, me.rotunda_y);
jetway_coord.set_alt(me.alt + me.rotunda_z);
if (debug_switch.getBoolValue())
{
# place UFO cursors at the calculated door and jetway positions for debugging purposes
geo.put_model("Aircraft/ufo/Models/cursor.ac", door_coord);
geo.put_model("Aircraft/ufo/Models/cursor.ac", jetway_coord);
}
# offset the door for the length of the jetway entrance
door_coord.apply_course_distance(heading - 90, me.offset_entrance);
# calculate the bearing to the aircraft and the distance from the door
me.target_heading = normdeg(jetway_coord.course_to(door_coord) - me.heading - me.init_heading);
me.target_extend = jetway_coord.distance_to(door_coord) - me.offset_extend - me.init_extend;
# check if distance exceeds maximum jetway extension length
if (me.target_extend + me.init_extend > me.max_extend)
{
me.extended = 0;
me.target_extend = 0;
me.target_heading = 0;
if (user) alert("Your aircraft is too far from this jetway.");
print_debug("Jetway #" ~ me.id ~ " is too far from the door");
return;
}
# check if distance fails to meet minimum jetway extension length
if (me.target_extend + me.init_extend < me.min_extend)
{
me.extended = 0;
me.target_extend = 0;
me.target_heading = 0;
if (user) alert("Your aircraft is too close to this jetway.");
print_debug("Jetway #" ~ me.id ~ " is too close to the door");
return;
}
# calculate the jetway pitch, entrance heading, and hood
me.target_pitch = math.atan2((door_coord.alt() - jetway_coord.alt()) / (me.target_extend + me.offset_extend + me.init_extend), 1) * R2D - me.init_pitch;
me.target_ent_heading = normdeg((heading + 90) - (me.heading + (me.target_heading + me.init_heading) + me.init_ent_heading));
me.target_hood = user ? getprop("/sim/model/door[" ~ me.door ~ "]/jetway-hood-deg") : hood;
# fire up the animation
if (user) alert("Extending jetway.");
var animation_time = math.abs(me.target_extend / extend_rate) + math.abs(me.target_pitch / pitch_rate) + math.abs(me.target_heading / heading_rate) + math.abs(me.target_ent_heading / heading_entrance_rate) + math.abs(me.target_hood / hood_rate);
me.door_object.swingtime = animation_time;
me.door_object.open();
print_debug("************************************************");
print_debug("Activated jetway #" ~ me.id);
print_debug("Using door #" ~ me.door);
print_debug("Jetway heading: " ~ me.heading ~ " deg");
print_debug("Extension: " ~ me.target_extend ~ " m");
print_debug("Pitch: " ~ me.target_pitch ~ " deg");
print_debug("Heading: " ~ me.target_heading ~ " deg");
print_debug("Entrance heading: " ~ me.target_ent_heading ~ " deg");
print_debug("Hood: " ~ me.target_hood ~ " deg");
print_debug("Total animation time: " ~ animation_time ~ " sec");
print_debug("Jetway extending");
print_debug("************************************************");
},
retract: func(user)
{
if (user) alert("Retracting jetway.");
me.door_object.close();
me.extended = 0;
print_debug("************************************************");
print_debug("Activated jetway #" ~ me.id);
print_debug("Total animation time: " ~ me.door_object.swingtime ~ " sec");
print_debug("Jetway retracting");
print_debug("************************************************");
},
remove: func
{
me.node.remove();
var id = me.id;
jetways[me.id] = nil;
print_debug("Unloaded jetway #" ~ id);
},
reload: func
{
var airport = me.airport;
var model = me.model;
var gate = me.gate;
var door = me.door;
var airline = me.airline;
var lat = me.lat;
var lon = me.lon;
var alt = me.alt;
var heading = geo.normdeg(180 - (me.heading - 360));
var init_extend = me.init_extend;
var init_heading = me.init_heading;
var init_pitch = me.init_pitch;
var init_ent_heading = me.init_ent_heading;
me.remove();
Jetway.new(airport, model, gate, door, airline, lat, lon, alt, heading, init_extend, init_heading, init_pitch, init_ent_heading);
},
setpos: func(lat, lon, hdg, alt)
{
me.node.getNode("latitude-deg").setValue(lat);
me.lat = lat;
me.node.getNode("longitude-deg").setValue(lon);
me.lon = lon;
me.node.getNode("heading-deg").setValue(geo.normdeg(hdg - 180));
me.heading = hdg;
me.node.getNode("elevation-ft").setValue(alt * M2FT);
me.alt = alt;
},
setmodel: func(model, airline, gate)
{
me.airline = airline;
me.gate = gate;
me.model = model;
me.extended = 0;
me.target_extend = 0;
me.target_pitch = 0;
me.target_heading = 0;
me.target_ent_heading = 0;
me.target_hood = 0;
me.door_object.setpos(0);
me.reload();
}
};
## Interaction functions
########################
var dialog = func
{
if (dialog_object == nil) dialog_object = gui.Dialog.new("/sim/gui/dialogs/jetways/dialog", "gui/dialogs/jetways.xml");
dialog_object.open();
};
var toggle_jetway = func(n)
{
var jetway = jetways[n];
if (jetway == nil) return;
var door = props.globals.getNode("/sim/model/door[" ~ jetway.door ~ "]");
if (door == nil)
{
alert("Your aircraft does not define the location of door " ~ (jetway.door + 1) ~ ", cannot extend this jetway.");
return;
}
# get the coordinates of the user's aircraft and offset for the door position and aircraft pitch
var coord = geo.aircraft_position();
var heading = getprop("/orientation/heading-deg");
var pitch = getprop("/orientation/pitch-deg");
coord.apply_course_distance(heading, -door.getChild("position-x-m").getValue());
coord.apply_course_distance(heading + 90, door.getChild("position-y-m").getValue());
coord.set_alt(coord.alt() + door.getChild("position-z-m").getValue());
coord.set_alt(coord.alt() + math.tan(pitch * D2R) * -door.getChild("position-x-m").getValue());
jetway.toggle(1, heading, coord);
};
var toggle_jetway_from_coord = func(door, hood, heading, lat, lon = nil)
{
if (isa(lat, geo.Coord))
{
var coord = lat;
}
else
{
var coord = geo.Coord.new();
coord.set_latlon(lat, lon);
}
var closest_jetway = nil;
var closest_jetway_dist = nil;
var closest_jetway_coord = nil;
for (var i = 0; i < size(jetways); i += 1)
{
if (jetways[i] == nil) continue;
var jetway = jetways[i];
var jetway_coord = geo.Coord.new();
jetway_coord.set_latlon(jetway.lat, jetway.lon);
var distance = jetway_coord.distance_to(coord);
if ((closest_jetway_dist == nil or distance < closest_jetway_dist) and jetway.door == door)
{
closest_jetway = jetway;
closest_jetway_dist = distance;
closest_jetway_coord = jetway_coord;
}
}
if (closest_jetway == nil)
{
print_debug("No jetways available");
}
elsif (!closest_jetway.extended)
{
closest_jetway.toggle(0, heading, coord, hood);
}
};
var toggle_jetway_from_model = func(model)
{
model = aircraft.makeNode(model);
var doors = model.getChildren("door");
if (doors == nil or size(doors) == 0) return;
for (var i = 0; i < size(doors); i += 1)
{
var coord = geo.Coord.new();
var hdg = model.getNode("orientation/true-heading-deg").getValue();
var lat = model.getNode("position/latitude-deg").getValue();
var lon = model.getNode("position/longitude-deg").getValue();
var alt = model.getNode("position/altitude-ft").getValue() * FT2M + doors[i].getNode("position-z-m").getValue();
coord.set_latlon(lat, lon, alt);
coord.apply_course_distance(hdg, -doors[i].getNode("position-x-m").getValue());
coord.apply_course_distance(hdg + 90, doors[i].getNode("position-y-m").getValue());
print_debug("Connecting a jetway to door #" ~ i ~ " for model " ~ model.getPath());
toggle_jetway_from_coord(i, doors[i].getNode("jetway-hood-deg").getValue(), hdg, coord);
}
};
## Internal functions
#####################
# loads jetways at an airport
var load_airport_jetways = func(airport)
{
if (isin(loaded_airports, airport)) return;
var tree = props.globals.getNode("/sim/paths/use-custom-scenery-data", 1).getBoolValue() ? io.read_airport_properties(airport, "jetways") : (io.stat(root ~ "/AI/Airports/" ~ airport ~ "/jetways.xml") == nil ? nil : io.read_properties(root ~ "/AI/Airports/" ~ airport ~ "/jetways.xml"));
if (tree == nil) return;
print_debug("Loading jetways for airport " ~ airport);
var nodes = tree.getChildren("jetway");
loadids[airport] = loadids[airport] == nil ? 0 : loadids[airport] + 1;
var i = 0;
var loop = func(id)
{
if (id != loadids[airport]) return;
if (i >= size(nodes))
{
append(loaded_airports, airport);
return;
}
var jetway = nodes[i];
var model = jetway.getNode("model", 1).getValue() or return;
var gate = jetway.getNode("gate", 1).getValue() or "";
var door = jetway.getNode("door", 1).getValue() or 0;
var airline = jetway.getNode("airline", 1).getValue() or "None";
var lat = jetway.getNode("latitude-deg", 1).getValue() or return;
var lon = jetway.getNode("longitude-deg", 1).getValue() or return;
var elev = jetway.getNode("elevation-m", 1).getValue() or 0;
var alt = geo.elevation(lat, lon) + elev;
var heading = jetway.getNode("heading-deg", 1).getValue() or 0;
var init_extend = jetway.getNode("initial-position/jetway-extension-m", 1).getValue() or 0;
var init_heading = jetway.getNode("initial-position/jetway-heading-deg", 1).getValue() or 0;
var init_pitch = jetway.getNode("initial-position/jetway-pitch-deg", 1).getValue() or 0;
var init_ent_heading = jetway.getNode("initial-position/entrance-heading-deg", 1).getValue() or 0;
Jetway.new(airport, model, gate, door, airline, lat, lon, alt, heading, init_extend, init_heading, init_pitch, init_ent_heading);
i += 1;
settimer(func loop(id), LOAD_JETWAY_PERIOD);
};
settimer(func loop(loadids[airport]), 0);
};
# unloads jetways at an airport
var unload_airport_jetways = func(airport)
{
print_debug("Unloading jetways for airport " ~ airport);
foreach (var jetway; jetways)
{
if (jetway != nil and jetway.airport == airport) jetway.remove();
}
remove(loaded_airports, airport);
};
# restarts the main update loop
var restart = func()
{
update_loopid += 1;
update_jetways(update_loopid);
settimer(func
{
load_loopid += 1;
load_jetways(load_loopid);
}, 2);
print("Animated jetways ... initialized");
};
# main update loop (runs when jetways are enable and actived)
var update_jetways = func(loopid)
{
# terminate if loopid does not match
if (loopid != update_loopid) return;
# if jetways disabled, unload jetways and terminate
if (!on_switch.getBoolValue())
{
for (var i = 0; i < size(jetways); i += 1)
{
if (jetways[i] != nil) jetways[i].remove();
}
setsize(jetways, 0);
setsize(loaded_airports, 0);
return;
}
# interpolate jetway values
for (var i = 0; i < size(jetways); i += 1)
{
var jetway = jetways[i];
if (jetway == nil) continue;
if (jetway._active or jetway._edit)
{
var position = jetway.door_object.getpos();
if (position == 0 or position == 1) jetway._active = 0;
jetway.node.getNode("jetway-position/extend-m").setValue(interpolate_table(extend_table, position) * jetway.target_extend + jetway.init_extend);
jetway.node.getNode("jetway-position/pitch-deg").setValue(interpolate_table(pitch_table, position) * jetway.target_pitch + jetway.init_pitch);
jetway.node.getNode("jetway-position/heading-deg").setValue(interpolate_table(heading_table, position) * jetway.target_heading + jetway.init_heading);
jetway.node.getNode("jetway-position/entrance-heading-deg").setValue(interpolate_table(heading_entrance_table, position) * jetway.target_ent_heading + jetway.init_ent_heading);
jetway.node.getNode("jetway-position/hood-deg").setValue(interpolate_table(hood_table, position) * jetway.target_hood);
}
}
settimer(func update_jetways(loopid), UPDATE_PERIOD);
};
# loading/unloading loop (runs continuously)
var load_jetways = func(loopid)
{
if (load_listenerid != nil) removelistener(load_listenerid);
# terminate if loopid does not match
# unloading jetways if jetways are disabled is handled by update loop
if (loopid != load_loopid or !on_switch.getBoolValue()) return;
var airports = find_airports(LOAD_DISTANCE);
if (airports == nil) return;
# search for any airports out of range and unload their jetways
foreach (var airport; loaded_airports)
{
if (!isin(airports, airport))
{
unload_airport_jetways(airport);
}
}
# load any airports in range
foreach (var airport; airports)
{
load_airport_jetways(airport);
}
var nearest_airport = airportinfo();
nearest_airport = nearest_airport == nil ? nil : nearest_airport.id;
if (isin(loaded_airports, nearest_airport))
{
# loop through the AI aircraft and extend/retract jetways
var ai_aircraft = props.globals.getNode("ai/models").getChildren("aircraft");
foreach (var aircraft; ai_aircraft)
{
if (!aircraft.getNode("valid", 1).getBoolValue()) continue;
var connected = aircraft.getNode("connected-to-jetways", 1);
var velocity = aircraft.getNode("velocities/true-airspeed-kt", 1).getValue();
# TODO: Find a better way to know when the aircraft is "parked"
if (velocity != nil and velocity > -1 and velocity < 1)
{
if (!connected.getBoolValue()) toggle_jetway_from_model(aircraft);
connected.setBoolValue(1);
}
else
{
if (connected.getBoolValue()) toggle_jetway_from_model(aircraft);
connected.setBoolValue(0);
}
}
# loop through the multiplayer aircraft and extend/retract jetways
# TODO: In the future, broadcast jetway properties over MP, making this part obselete
if (mp_switch.getBoolValue())
{
var multiplayers = props.globals.getNode("ai/models").getChildren("multiplayer");
foreach (var aircraft; multiplayers)
{
if (!aircraft.getNode("valid", 1).getBoolValue()) continue;
var connected = aircraft.getNode("connected-to-jetways", 1);
var velocity = aircraft.getNode("velocities/true-airspeed-kt", 1).getValue();
if (velocity != nil and velocity > -1 and velocity < 1)
{
if (!connected.getBoolValue()) toggle_jetway_from_model(aircraft);
connected.setBoolValue(1);
}
else
{
if (connected.getBoolValue()) toggle_jetway_from_model(aircraft);
connected.setBoolValue(0);
}
}
}
}
settimer(func load_jetways(loopid), LOAD_PERIOD);
};
## fire it up
_setlistener("/nasal/jetways/loaded", func
{
# global variables
root = string.normpath(getprop("/sim/fg-root"));
home = string.normpath(getprop("/sim/fg-home"));
foreach (var scenery_path; props.globals.getNode("/sim").getChildren("fg-scenery"))
{
append(scenery, string.normpath(scenery_path.getValue()));
}
if (size(scenery) == 0) append(scenery, root ~ "/Scenery");
# properties
on_switch = props.globals.getNode("/nasal/jetways/enabled", 1);
debug_switch = props.globals.getNode("/sim/jetways/debug", 1);
mp_switch = props.globals.getNode("/sim/jetways/interact-with-multiplay", 1);
jetway_id_prop = props.globals.getNode(jetway_id_prop, 1);
restart();
});

View file

@ -0,0 +1,600 @@
###############################################################################
##
## Animated Jetway System. Allows the user to edit jetways during runtime.
##
## Copyright (C) 2011 Ryan Miller
## This file is licensed under the GPL license version 2 or later.
##
###############################################################################
###############################################################################
# (See http://wiki.flightgear.org/Howto:_Animated_jetways)
#
### Static jetway model profiles ###
### This class specifies the offsets used when converting static jetways using the STG converter ###
var Static_jetway =
[
# Models/Airport/jetway-movable.ac
# Models/Airport/jetway-movable.xml
# Models/Airport/jetway-movable-2.ac
# Models/Airport/jetway-movable-2.xml
# Models/Airport/jetway-movable-3.ac
# Models/Airport/jetway-movable-3.xml
{
models:
[
"Models/Airport/jetway-movable.ac",
"Models/Airport/jetway-movable.xml",
"Models/Airport/jetway-movable-2.ac",
"Models/Airport/jetway-movable-2.xml",
"Models/Airport/jetway-movable-3.ac",
"Models/Airport/jetway-movable-3.xml"
],
offsets:
{
x: -2.042,
y: 0,
z: 0,
heading: 0
},
init_pos:
{
extend: 7.24,
heading: 0,
pitch: 0,
ent_heading: -90
},
model: "generic",
airline: "None"
},
# Models/Airport/jetway.xml
# Models/Airport/jetway-ba.ac
# Models/Airport/jetway-ba.xml
{
models:
[
"Models/Airport/jetway.xml",
"Models/Airport/jetway-ba.ac",
"Models/Airport/jetway-ba.xml"
],
offsets:
{
x: 0,
y: 0,
z: -0.25,
heading: 0
},
init_pos:
{
extend: 7.24,
heading: -6.7,
pitch: -3.6,
ent_heading: -83.3
},
model: "generic",
airline: "None"
},
# Models/Airport/jetway-737-ba.ac
# Models/Airport/jetway-737-ba.xml
{
models:
[
"Models/Airport/jetway-737-ba.ac",
"Models/Airport/jetway-737-ba.xml"
],
offsets:
{
x: 0,
y: 0,
z: -0.25,
heading: 0
},
init_pos:
{
extend: 7.24,
heading: -6.7,
pitch: -4,
ent_heading: -83.3
},
model: "generic",
airline: "None"
},
# Models/Airport/jetway-747-ba.ac
# Models/Airport/jetway-747-ba.xml
{
models:
[
"Models/Airport/jetway-747-ba.ac",
"Models/Airport/jetway-747-ba.xml"
],
offsets:
{
x: 0,
y: 0,
z: -0.25,
heading: 0
},
init_pos:
{
extend: 7.24,
heading: -6.7,
pitch: 2,
ent_heading: -83.3
},
model: "generic",
airline: "None"
},
# Models/Airport/jetway-a320-ba.ac
# Models/Airport/jetway-a320-ba.xml
{
models:
[
"Models/Airport/jetway-a320-ba.ac",
"Models/Airport/jetway-a320-ba.xml"
],
offsets:
{
x: 0,
y: 0,
z: -0.25,
heading: 0
},
init_pos:
{
extend: 7.24,
heading: -6.7,
pitch: -1.6,
ent_heading: -83.3
},
model: "generic",
airline: "None"
},
# Models/Airport/AutoGate-ba.ac
# Models/Airport/AutoGate.xml
{
models:
[
"Models/Airport/AutoGate-ba.ac",
"Models/Airport/AutoGate.xml"
],
offsets:
{
x: -10,
y: 25,
z: 0,
heading: -90
},
init_pos:
{
extend: 7.68,
heading: 0,
pitch: 0,
ent_heading: -90
},
model: "generic",
airline: "None"
},
# Models/Airport/DockingGate-ba.ac
# Models/Airport/DockingGate.xml
{
models:
[
"Models/Airport/DockingGate-ba.ac",
"Models/Airport/DockingGate.xml"
],
offsets:
{
x: -10,
y: 5,
z: 0,
heading: -90
},
init_pos:
{
extend: 7.68,
heading: 0,
pitch: 0,
ent_heading: -90
},
model: "generic",
airline: "None"
}
];
### Rest of script follows below ###
### Watch your step! :) ###
var dialog_object = nil;
var selected_jetway = nil;
var mouse_mmb = 0;
var kbd_shift = nil;
var kbd_ctrl = nil;
var kbd_alt = nil;
var enabled = nil;
var FLASH_PERIOD = 0.3;
var FLASH_NUM = 3;
var filedialog_listener = 0;
var click = func(pos)
{
if (kbd_alt.getBoolValue())
{
if (selected_jetway == nil) return;
selected_jetway.setpos(pos.lat(), pos.lon(), selected_jetway.heading, pos.alt());
}
elsif (kbd_shift.getBoolValue())
{
selected_jetway = nil;
}
elsif (kbd_ctrl.getBoolValue())
{
var nearest_jetway = nil;
var min_dist = geo.ERAD;
for (var i = 0; i < size(jetways.jetways); i += 1)
{
var jetway = jetways.jetways[i];
if (jetway == nil) continue;
var dist = geo.Coord.new().set_latlon(jetway.lat, jetway.lon, jetway.alt).direct_distance_to(pos);
if (dist < min_dist)
{
min_dist = dist;
nearest_jetway = jetway;
}
}
if (nearest_jetway != nil)
{
if (selected_jetway != nil) selected_jetway._edit = 0;
selected_jetway = nearest_jetway;
setprop("/sim/jetways/adjust/model", selected_jetway.model);
setprop("/sim/jetways/adjust/door", selected_jetway.door);
setprop("/sim/jetways/adjust/airline", selected_jetway.airline);
setprop("/sim/jetways/adjust/gate", selected_jetway.gate);
selected_jetway._edit = 1;
flash(nearest_jetway);
}
}
else
{
var airport = getprop("/sim/airport/closest-airport-id");
if (airport == "") return;
selected_jetway = jetways.Jetway.new(airport, "generic", "FG", 0, "FGFS", pos.lat(), pos.lon(), pos.alt(), 0);
selected_jetway._edit = 1;
if (!jetways.isin(jetways.loaded_airports, airport)) append(jetways.loaded_airports, airport);
setprop("/sim/jetways/adjust/model", selected_jetway.model);
setprop("/sim/jetways/adjust/door", selected_jetway.door);
setprop("/sim/jetways/adjust/airline", selected_jetway.airline);
setprop("/sim/jetways/adjust/gate", selected_jetway.gate);
flash(selected_jetway);
}
};
var delete = func
{
if (selected_jetway == nil) return;
selected_jetway.remove();
selected_jetway = nil;
};
var adjust = func(name, value)
{
if (selected_jetway == nil) return;
if (name == "longitudinal")
{
var jetway_pos = geo.Coord.new();
jetway_pos.set_latlon(selected_jetway.lat, selected_jetway.lon, selected_jetway.alt);
var dir = geo.aircraft_position().course_to(jetway_pos);
jetway_pos.apply_course_distance(dir, value);
selected_jetway.setpos(jetway_pos.lat(), jetway_pos.lon(), selected_jetway.heading, selected_jetway.alt);
}
elsif (name == "transversal")
{
var jetway_pos = geo.Coord.new();
jetway_pos.set_latlon(selected_jetway.lat, selected_jetway.lon, selected_jetway.alt);
var dir = geo.aircraft_position().course_to(jetway_pos) + 90;
jetway_pos.apply_course_distance(dir, value);
selected_jetway.setpos(jetway_pos.lat(), jetway_pos.lon(), selected_jetway.heading, selected_jetway.alt);
}
elsif (name == "altitude")
{
var alt = selected_jetway.alt + value * 0.4;
selected_jetway.setpos(selected_jetway.lat, selected_jetway.lon, selected_jetway.heading, alt);
}
elsif (name == "heading")
{
var hdg = geo.normdeg(selected_jetway.heading + value * 4);
selected_jetway.setpos(selected_jetway.lat, selected_jetway.lon, hdg, selected_jetway.alt);
}
elsif (name == "initial-extension")
{
var newvalue = selected_jetway.init_extend + value;
if (newvalue > selected_jetway.max_extend)
{
gui.popupTip("Value exceeds maximum jetway extension limit");
}
elsif (newvalue < selected_jetway.min_extend)
{
gui.popupTip("Value lower than minimum jetway extension limit");
}
else
{
selected_jetway.init_extend = newvalue;
}
}
elsif (name == "initial-pitch")
{
selected_jetway.init_pitch += value;
}
elsif (name == "initial-heading")
{
selected_jetway.init_heading += value;
}
elsif (name == "initial-entrance-heading")
{
selected_jetway.init_ent_heading += value;
}
elsif (name == "model")
{
selected_jetway.setmodel(value, selected_jetway.airline, selected_jetway.gate);
selected_jetway = jetways.jetways[getprop("/sim/jetways/last-loaded-jetway")];
}
elsif (name == "door")
{
selected_jetway.door = value;
}
elsif (name == "airline")
{
selected_jetway.setmodel(selected_jetway.model, value, selected_jetway.gate);
selected_jetway = jetways.jetways[getprop("/sim/jetways/last-loaded-jetway")];
}
elsif (name == "gate")
{
selected_jetway.setmodel(selected_jetway.model, selected_jetway.airline, value);
selected_jetway = jetways.jetways[getprop("/sim/jetways/last-loaded-jetway")];
}
};
var export = func
{
var path = getprop("/sim/fg-home") ~ "/Export/";
var airports = {};
var airportarray = [];
foreach (var jetway; jetways.jetways)
{
if (jetway == nil) continue;
if (airports[jetway.airport] == nil)
{
airports[jetway.airport] = [];
append(airportarray, jetway.airport);
}
var node = props.Node.new();
node.getNode("model", 1).setValue(jetway.model);
node.getNode("gate", 1).setValue(jetway.gate);
node.getNode("door", 1).setIntValue(jetway.door);
node.getNode("airline", 1).setValue(jetway.airline);
node.getNode("latitude-deg", 1).setDoubleValue(jetway.lat);
node.getNode("longitude-deg", 1).setDoubleValue(jetway.lon);
var alt = jetway.alt;
jetway.setpos(jetway.lat, jetway.lon, jetway.heading, -geo.ERAD);
node.getNode("elevation-m", 1).setDoubleValue(alt - geo.elevation(jetway.lat, jetway.lon));
jetway.setpos(jetway.lat, jetway.lon, jetway.heading, alt);
node.getNode("heading-deg", 1).setDoubleValue(geo.normdeg(180 - jetway.heading));
node.getNode("initial-position/jetway-extension-m", 1).setDoubleValue(jetway.init_extend);
node.getNode("initial-position/jetway-heading-deg", 1).setDoubleValue(jetway.init_heading);
node.getNode("initial-position/jetway-pitch-deg", 1).setDoubleValue(jetway.init_pitch);
node.getNode("initial-position/entrance-heading-deg", 1).setDoubleValue(jetway.init_ent_heading);
append(airports[jetway.airport], node);
}
foreach (var airport; airportarray)
{
var file = path ~ airport ~ ".xml";
var args = props.Node.new({ filename: file });
var nodes = airports[airport];
foreach (var node; nodes)
{
var data = args.getNode("data", 1);
for (var i = 0; 1; i += 1)
{
if (data.getChild("jetway", i, 0) == nil)
{
props.copy(node, data.getChild("jetway", i, 1));
break;
}
}
}
fgcommand("savexml", args);
print("jetway definitions for airport " ~ airport ~ " exported to " ~ file);
}
};
var convert_stg = func
{
fgcommand("dialog-show", props.Node.new({ "dialog-name": "file-select" }));
setprop("/sim/gui/dialogs/file-select/path", "");
filedialog_listener = setlistener("/sim/gui/dialogs/file-select/path", func(n)
{
removelistener(filedialog_listener);
var path = n.getValue();
if (path == "") return;
var stg = io.readfile(path);
var stg_lines = [[]];
var current_word = "";
for (var i = 0; i < size(stg); i += 1)
{
var char = substr(stg, i, 1);
if (char == " " or char == "\n")
{
append(stg_lines[size(stg_lines) - 1], current_word);
current_word = "";
if (char == "\n") append(stg_lines, []);
}
else
{
current_word ~= char;
}
}
var jetway_array = [];
foreach (var line; stg_lines)
{
if (size(line) < 6 or line[0] != "OBJECT_SHARED") continue;
var foundmodel = 0;
var jetway = nil;
foreach (var profile; Static_jetway)
{
foreach (var model; profile.models)
{
if (model == line[1]) foundmodel = 1;
}
if (foundmodel)
{
jetway = profile;
break;
}
}
if (jetway == nil) continue;
var heading = num(line[5]);
var coord = geo.Coord.new();
coord.set_latlon(line[3], line[2], line[4]);
coord.apply_course_distance(360 - heading, -jetway.offsets.x);
coord.apply_course_distance(360 - heading + 90, jetway.offsets.y);
coord.set_alt(coord.alt() + jetway.offsets.z);
var hash = {};
hash.coord = coord;
hash.heading = heading + jetway.offsets.heading;
hash.init_extend = jetway.init_pos.extend;
hash.init_heading = jetway.init_pos.heading;
hash.init_pitch = jetway.init_pos.pitch;
hash.init_ent_heading = jetway.init_pos.ent_heading;
hash.model = jetway.model;
hash.airline = jetway.airline;
append(jetway_array, hash);
}
var airport = getprop("/sim/jetways/closest-airport-id");
if (airport == "") return;
var i = 0;
var loop = func
{
if (i >= size(jetway_array)) return;
var jetway = jetway_array[i];
jetways.Jetway.new(airport, jetway.model, "", 0, jetway.airline, jetway.coord.lat(), jetway.coord.lon(), jetway.coord.alt(), jetway.heading, jetway.init_extend, jetway.init_heading, jetway.init_pitch, jetway.init_ent_heading);
if (!jetways.isin(jetways.loaded_airports, airport)) append(jetways.loaded_airports, airport);
i += 1;
settimer(loop, jetways.LOAD_JETWAY_PERIOD);
};
settimer(loop, 0);
jetways.alert("Creating " ~ size(jetway_array) ~ " jetways for airport " ~ airport);
}, 0, 1);
};
var flash = func(jetway)
{
if (!contains(jetway, "_flashnum") or jetway._flashnum == -1)
{
jetway._alt = jetway.alt;
jetway.setpos(jetway.lat, jetway.lon, jetway.heading, -geo.ERAD);
jetway._flashnum = 0;
settimer(func flash(jetway), FLASH_PERIOD);
}
elsif (!contains(jetway, "_alt"))
{
jetway._flashnum = -1;
jetway.setpos(jetway.lat, jetway.lon, jetway.heading, geo.elevation(jetway.lat, jetway.lon));
return;
}
elsif (jetway._flashnum == FLASH_NUM + 1)
{
jetway.setpos(jetway.lat, jetway.lon, jetway.heading, jetway._alt);
jetway._alt = nil;
jetway._flashnum = -1;
}
else
{
if (jetway.alt == -geo.ERAD)
{
jetway.setpos(jetway.lat, jetway.lon, jetway.heading, jetway._alt);
}
else
{
jetway.setpos(jetway.lat, jetway.lon, jetway.heading, -geo.ERAD);
}
jetway._flashnum += 1;
settimer(func flash(jetway), FLASH_PERIOD);
}
};
var dialog = func
{
if (dialog_object == nil) dialog_object = gui.Dialog.new("/sim/gui/dialogs/jetways-adjust/dialog", "gui/dialogs/jetways-adjust.xml");
dialog_object.open();
};
var print_help = func
{
print("JETWAY EDITOR HELP");
print("*******************************************************");
print("See: http://wiki.flightgear.org/Howto:_Animated_jetways");
print("");
print("Adjust position, heading, and altitude with top sliders");
print("Adjust initial jetway positions with bottom sliders");
print("");
print("<Model> model of selected jetway");
print("<Door> aircraft door number of selected jetway");
print("<Airline sign> airline sign code of selected jetway");
print("<Gate> gate number of selected jetway");
print("");
print("[Center sliders] apply slider offsets and return sliders to 0");
print("[Export] export jetway definition file(s)");
print("[STG converter] convert static jetways in STG files to animated jetways");
print("[?] show this help text");
print("");
print("Click add jetway on click position");
print("Alt-click move selected jetway to click position");
print("Ctrl-click select a jetway near click position");
print("Shift-click deselect selected jetway");
print("Backspace delete selected jetway");
print("*******************************************************");
};
_setlistener("/nasal/jetways_edit/loaded", func
{
print("Animated jetway editor ... loaded");
kbd_shift = props.globals.getNode("/devices/status/keyboard/shift");
kbd_ctrl = props.globals.getNode("/devices/status/keyboard/ctrl");
kbd_alt = props.globals.getNode("/devices/status/keyboard/alt");
enabled = props.globals.getNode("/nasal/jetways_edit/enabled");
setlistener("/sim/jetways/adjust/model", func(n)
{
var v = n.getValue();
if (selected_jetway != nil and v != selected_jetway.model)
{
adjust("model", v);
}
}, 0, 0);
setlistener("/sim/jetways/adjust/door", func(n)
{
var v = n.getValue();
if (selected_jetway != nil and v != selected_jetway.door)
{
adjust("door", v);
}
}, 0, 0);
setlistener("/sim/jetways/adjust/airline", func(n)
{
var v = n.getValue();
if (selected_jetway != nil and v != selected_jetway.airline)
{
adjust("airline", v);
}
}, 0, 0);
setlistener("/sim/jetways/adjust/gate", func(n)
{
var v = n.getValue();
if (selected_jetway != nil and v != selected_jetway.gate)
{
adjust("gate", v);
}
}, 0, 0);
setlistener("/devices/status/keyboard/event", func(event)
{
if (!event.getNode("pressed").getValue()) return;
if (enabled.getBoolValue() and event.getNode("key").getValue() == 8) delete();
});
setlistener("/devices/status/mice/mouse/button[1]", func(n) mouse_mmb = n.getBoolValue(), 1, 0);
setlistener("/sim/signals/click", func if (!mouse_mmb and enabled.getBoolValue()) click(geo.click_position()));
});

View file

@ -67,8 +67,19 @@
# The compatibility layer is currently work in progress and will be extended as new Nasal
# APIs are being added to FlightGear.
var weather_dynamics = nil;
var weather_tile_management = nil;
var compat_layer = nil;
var weather_tiles = nil;
_setlistener("/nasal/local_weather/loaded", func {
compat_layer = local_weather;
weather_dynamics = local_weather;
weather_tile_management = local_weather;
weather_tiles = local_weather;
_setlistener("/sim/signals/nasal-dir-initialized", func {
var result = "yes";
@ -81,10 +92,16 @@ else
print("* can set light saturation: "~result);
if (props.globals.getNode("/rendering/scene/scattering", 0) == nil)
{result = "no"; features.can_set_scattering = 0;}
else
{result = "yes"; features.can_set_scattering = 1;}
print("* can set horizon scattering: "~result);
if (props.globals.getNode("/environment/terrain", 0) == nil)
{result = "no"; features.terrain_presampling = 0;}
else
{result = "yes"; features.terrain_presampling = 1;}
{result = "yes"; features.terrain_presampling = 1;setprop("/environment/terrain/area[0]/enabled",1);}
print("* hard coded terrain presampling: "~result);
if ((props.globals.getNode("/environment/terrain/area[0]/enabled",1).getBoolValue() == 1) and (features.terrain_presampling ==1))
@ -100,12 +117,13 @@ else
{result = "yes"; features.can_disable_environment = 1;}
print("* can disable global weather: "~result);
#if (features.terrain_presampling_active == 1)
# {
# setlistener("/environment/terrain/area[0]/output/valid", func {local_weather.manage_hardcoded_presampling(); });
# }
print("Compatibility layer: tests done.");
# do actual startup()
local_weather.updateMenu();
local_weather.startup();
});
@ -328,6 +346,32 @@ if (features.can_set_light == 1)
}
}
####################################
# set horizon scattering
####################################
var setScattering = func (s) {
if (features.can_set_scattering == 1)
{
setprop("/rendering/scene/scattering",s);
}
}
####################################
# set overcast haze
####################################
var setOvercast = func (o) {
if (features.can_set_scattering == 1)
{
setprop("/rendering/scene/overcast",o);
}
}
###########################################################
# set wind to given direction and speed
###########################################################

View file

@ -56,6 +56,7 @@
# set_texture_mix to determine the texture mix between smooth and rough cloud appearance
# create_effect_volume to create an effect volume
# set_weather_station to specify a weather station for interpolation
# set_atmosphere_ipoint to specify an interpolation point for visibility, haze and shading in the atmosphere
# set_wind_ipoint to set an aloft wind interpolation point
# set_wind_ipoint_metar to set a wind interpolation point from available ground METAR info where aloft is modelled
# showDialog to pop up a dialog window
@ -74,6 +75,7 @@
# object purpose
# weatherStation to store info about weather conditions
# atmopshereIpoint to store info about haze and light propagation in the atmosphere
# windIpoint to store an interpolation point of the windfield
# effectVolume to store effect volume info and provide methods to move and time-evolve effect volumes
# thermalLift to store thermal info and provide methods to move and time-evolve a thermal
@ -109,6 +111,9 @@ return (x*x + y*y);
var effect_volume_loop = func (index, n_active) {
if (local_weather_running_flag == 0) {return;}
var n = 25;
@ -415,14 +420,11 @@ return f_slow;
var interpolation_loop = func {
if (local_weather_running_flag == 0) {return;}
var viewpos = geo.aircraft_position();
var sum_alt = 0.0;
var sum_vis = 0.0;
var sum_T = 0.0;
var sum_p = 0.0;
var sum_D = 0.0;
var sum_norm = 0.0;
var vis_before = getprop(lwi~"visibility-m");
@ -453,6 +455,12 @@ else
# get an inverse distance weighted average from all defined weather stations
var sum_alt = 0.0;
var sum_vis = 0.0;
var sum_T = 0.0;
var sum_p = 0.0;
var sum_D = 0.0;
var sum_norm = 0.0;
var n_stations = size(weatherStationArray);
@ -502,40 +510,145 @@ var D = sum_D/sum_norm;
var T = sum_T/sum_norm;
# get an inverse distance weighted average from all defined atmospheric condition points
sum_norm = 0.0;
var sum_vis_aloft = 0.0;
var sum_vis_alt1 = 0.0;
var sum_vis_ovcst = 0.0;
var sum_ovcst = 0.0;
var sum_ovcst_alt_low = 0.0;
var sum_ovcst_alt_high = 0.0;
var sum_scatt = 0.0;
var sum_scatt_alt_low = 0.0;
var sum_scatt_alt_high = 0.0;
var n_iPoints = size(atmosphereIpointArray);
for (var i = 0; i < n_iPoints; i=i+1) {
a = atmosphereIpointArray[i];
var apos = geo.Coord.new();
apos.set_latlon(a.lat,a.lon,0.0);
var d = viewpos.distance_to(apos);
if (d <100.0) {d = 100.0;} # to prevent singularity at zero
sum_norm = sum_norm + 1./d * a.weight;
sum_vis_aloft = sum_vis_aloft + (a.vis_aloft/d) * a.weight;
sum_vis_alt1 = sum_vis_alt1 + (a.vis_alt1/d) * a.weight;
sum_vis_ovcst = sum_vis_ovcst + (a.vis_ovcst/d) * a.weight;
sum_ovcst = sum_ovcst + (a.ovcst/d) * a.weight;
sum_ovcst_alt_low = sum_ovcst_alt_low + (a.ovcst_alt_low/d) * a.weight;
sum_ovcst_alt_high = sum_ovcst_alt_high + (a.ovcst_alt_high/d) * a.weight;
sum_scatt = sum_scatt + (a.scatt/d) * a.weight;
sum_scatt_alt_low = sum_scatt_alt_low + (a.scatt_alt_low/d) * a.weight;
sum_scatt_alt_high = sum_scatt_alt_high + (a.scatt_alt_high/d) * a.weight;
# gradually fade in the interpolation weight of newly added stations to
# avoid sudden jumps
if (a.weight < 1.0) {a.weight = a.weight + 0.02;}
# automatically delete stations out of range
# take care not to unload if weird values appear for a moment
# never unload if only one station left
if ((d > distance_to_unload) and (d < (distance_to_unload + 20000.0)) and (n_iPoints > 1))
{
if (debug_output_flag == 1)
{print("Distance to atmosphere interpolation point ", d, " m, unloading ...", i);}
atmosphereIpointArray = weather_tile_management.delete_from_vector(atmosphereIpointArray,i);
i = i-1; n_iPoints = n_iPoints -1;
}
}
setprop(lwi~"atmosphere-ipoint-number", i+1);
var vis_aloft = sum_vis_aloft/sum_norm;
var vis_alt1 = sum_vis_alt1/sum_norm;
var vis_ovcst = sum_vis_ovcst/sum_norm;
var ovcst_max = sum_ovcst/sum_norm;
var ovcst_alt_low = sum_ovcst_alt_low/sum_norm;
var ovcst_alt_high = sum_ovcst_alt_high/sum_norm;
var scatt_max = sum_scatt/sum_norm;
var scatt_alt_low = sum_scatt_alt_low/sum_norm;
var scatt_alt_high = sum_scatt_alt_high/sum_norm;
# altitude model for visibility - increase above the lowest inversion layer to simulate ground haze
var altitude = getprop("position/altitude-ft");
var current_tile_index = getprop(lw~"tiles/tile[4]/tile-index");
#if (presampling_flag == 1)
# {var current_mean_terrain_elevation = alt_20_array[current_tile_index -1];}
#else
# {var current_mean_terrain_elevation = getprop(lw~"tmp/tile-alt-offset-ft");}
current_mean_terrain_elevation = ialt;
var alt1 = weather_dynamics.tile_convective_altitude[current_tile_index -1];
var alt1 = vis_alt1;
var alt2 = alt1 + 1500.0;
var inc1 = 0.1;
var inc2 = 5.0;
var inc3 = 0.5;
#var inc1 = 0.15;
#var inc2 = 5.0;
#var inc3 = 0.7;
var alt_above_mean = altitude - current_mean_terrain_elevation;
# compute the visibility gradients
var inc1 = 0.1 * (vis_aloft - vis)/(vis_alt1 - ialt);
var inc2 = 0.9 * (vis_aloft - vis)/1500.0;
var inc3 = (vis_ovcst - vis_aloft)/(ovcst_alt_high - vis_alt1+1500);
var inc4 = 0.5;
# compute the visibility
if (altitude < alt1)
{vis = vis + inc1 * altitude;}
else if (altitude < alt2)
{
vis = vis + inc1 * alt1 + inc2 * (altitude - alt1);
}
else if (altitude < ovcst_alt_high)
{
vis = vis + inc1 * alt1 + inc2 * (alt2-alt1) + inc3 * (altitude - alt2);
}
else if (altitude > ovcst_alt_high)
{
vis = vis + inc1 * alt1 + inc2 * (alt2-alt1) + inc3 * (ovcst_alt_high - alt2) + inc4 * (altitude - ovcst_alt_high);
}
# compute the horizon shading
if (altitude < scatt_alt_low)
{
var scatt = scatt_max;
}
else if (altitude < scatt_alt_high)
{
var scatt = scatt_max + (0.95 - scatt_max) * (altitude - scatt_alt_low)/(scatt_alt_high-scatt_alt_low);
}
else
{var scatt = 0.95;}
# compute the overcast haze
if (altitude < ovcst_alt_low)
{
var ovcst = ovcst_max;
}
else if (altitude < ovcst_alt_high)
{
var ovcst = ovcst_max - ovcst_max * (altitude - ovcst_alt_low)/(ovcst_alt_high-ovcst_alt_low);
}
else
{var ovcst = 0.0;}
if (alt_above_mean < alt1)
{vis = vis + inc1 * alt_above_mean;}
else if (alt_above_mean < alt2)
{vis = vis + inc1 * alt1 + inc2 * (alt_above_mean - alt1);}
else if (alt_above_mean > alt2)
{vis = vis + inc1 * alt1 + inc2 * (alt2-alt1) + inc3 * (alt_above_mean - alt2);}
# limit relative changes of the visibility, will make for gradual transitions
if (vis/vis_before > vlimit)
{vis = vlimit * vis_before;}
else if (vis/vis_before < (2.0-vlimit))
@ -543,6 +656,7 @@ else if (vis/vis_before < (2.0-vlimit))
# write all properties into the weather interpolation record in the property tree
setprop(lwi~"mean-terrain-altitude-ft",ialt);
@ -552,9 +666,11 @@ setprop(lwi~"dewpoint-degc",D);
if (p > 10.0) {setprop(lwi~"pressure-sea-level-inhg",p);}
setprop(lwi~"turbulence",0.0);
compat_layer.setScattering(scatt);
compat_layer.setOvercast(ovcst);
# now check if an effect volume writes the property and set only if not
#flag = props.globals.getNode("local-weather/effect-volumes/number-active-vis").getValue();
flag = getprop("local-weather/effect-volumes/number-active-vis");
if ((flag ==0) and (vis > 0.0) and (getprop(lw~"lift-loop-flag") == 0))
@ -564,39 +680,32 @@ if ((flag ==0) and (vis > 0.0) and (getprop(lw~"lift-loop-flag") == 0))
compat_layer.setVisibility(vis);
}
#flag = props.globals.getNode("local-weather/effect-volumes/number-active-turb").getValue();
flag = getprop("local-weather/effect-volumes/number-active-turb");
if ((flag ==0))
{
#cNode.getNode("turbulence").setValue(0.0);
setprop(lw~"current/turbulence",0.0);
compat_layer.setTurbulence(0.0);
}
#flag = props.globals.getNode("local-weather/effect-volumes/number-active-lift").getValue();
flag = getprop("local-weather/effect-volumes/number-active-lift");
if (flag ==0)
{
#cNode.getNode("thermal-lift").setValue(0.0);
setprop(lw~"current/thermal-lift",0.0);
}
# no need to check for these, as they are not modelled in effect volumes
#cNode.getNode("temperature-degc",1).setValue(T);
setprop(lw~"current/temperature-degc",T);
compat_layer.setTemperature(T);
#cNode.getNode("dewpoint-degc",1).setValue(D);
setprop(lw~"current/dewpoint-degc", D);
compat_layer.setDewpoint(D);
if (p>0.0)
{
#cNode.getNode("pressure-sea-level-inhg",1).setValue(p);
setprop(lw~"current/pressure-sea-level-inhg",p);
compat_layer.setPressure(p);
}
@ -794,6 +903,8 @@ if (getprop(lw~"lift-loop-flag") == 0)
var thermal_lift_loop = func {
if (local_weather_running_flag == 0) {return;}
var apos = geo.aircraft_position();
var tlat = thermal.lat;
@ -915,6 +1026,8 @@ if (getprop(lw~"wave-loop-flag") == 0)
var wave_lift_loop = func {
if (local_weather_running_flag == 0) {return;}
var lat = getprop("position/latitude-deg");
var lon = getprop("position/longitude-deg");
var alt = getprop("position/altitude-ft");
@ -1719,13 +1832,6 @@ foreach (var m; modelNode)
}
# clear effect volumes
#props.globals.getNode("local-weather/effect-volumes", 1).removeChildren("effect-volume");
# reset pressure continuity
weather_tiles.last_pressure = 0.0;
@ -1745,12 +1851,13 @@ setprop(lw~"convective-loop-flag",0);
weather_dynamics.convective_loop_kill_flag = 1; # long-running loop needs a different scheme to end
# also remove rain snow and saturation effects
# also remove rain, snow, haze and light effects
compat_layer.setRain(0.0);
compat_layer.setSnow(0.0);
compat_layer.setLight(1.0);
# set placement indices to zero
setprop(lw~"clouds/placement-index",0);
@ -1783,11 +1890,14 @@ settimer ( func {
setsize(weather_dynamics.tile_convective_strength,0);
setsize(weatherStationArray,0);
setsize(windIpointArray,0);
setsize(atmosphereIpointArray,0);
setprop(lw~"clouds/buffer-count",0);
setprop(lw~"clouds/cloud-scenery-count",0);
weather_tile_management.n_cloudSceneryArray = 0;
#props.globals.getNode("local-weather/interpolation", 1).removeChildren("wind");
compat_layer.setScattering(0.8);
compat_layer.setOvercast(0.0);
setprop(lwi~"ipoint-number",0);
setprop(lwi~"atmosphere-ipoint-number", 0);
},1.1);
setprop(lw~"tmp/presampling-status", "idle");
@ -1928,6 +2038,8 @@ else
var cumulus_loop = func (blat, blon, balt, nc, size) {
if (local_weather_running_flag == 0) {return;}
var n = int(25/cumulus_efficiency_factor);
if (nc < 0)
@ -1939,7 +2051,6 @@ if (nc < 0)
return;
}
#print("nc is now: ",nc);
create_cumulus(blat, blon, balt, n, size);
settimer( func {cumulus_loop(blat, blon, balt, nc-n, size) },0);
@ -1963,6 +2074,13 @@ var detail_flag = detailed_clouds_flag;
var alpha = getprop(lw~"tmp/tile-orientation-deg") * math.pi/180.0; # the tile orientation
if (detailed_terrain_interaction_flag == 1)
{
var alt_min = getprop(lw~"tmp/tile-alt-min-ft");
var alt_mean = getprop(lw~"tmp/tile-alt-mean-ft");
var alt_var = alt_mean - alt_min;
}
var sec_to_rad = 2.0 * math.pi/86400; # conversion factor for sinusoidal dependence on daytime
calc_geo(blat);
@ -2016,9 +2134,26 @@ while (i < nc) {
}}
else {continue;}
# apply some optional corrections, biases clouds towards higher elevations
var terrain_altitude_factor = 1.0;
if (detailed_terrain_interaction_flag == 1)
{
var elevation_enhancement = (elevation - alt_mean) / 1000.0;
if (elevation_enhancement > 0.7) {elevation_enhancement = 0.7;}
if (elevation_enhancement < -0.7) {elevation_enhancement = -0.7;}
terrain_altitude_factor = 1.0 + elevation_enhancement;
}
# then decide if the thermal energy at the spot generates an updraft and a cloud
if (rand() < (p * cumulus_efficiency_factor)) # we decide to place a cloud at this spot
if (rand() < (p * cumulus_efficiency_factor * terrain_altitude_factor)) # we decide to place a cloud at this spot
{
strength = (1.5 * rand() + (2.0 * p)) * t_factor2; # the strength of thermal activity at the spot
if (strength > 1.0)
@ -2807,6 +2942,7 @@ if (compat_layer.features.terrain_presampling_active == 1)
var terrain_presampling_loop = func (blat, blon, nc, size, alpha) {
if ((local_weather_running_flag == 0) and (local_weather_startup_flag == 0)) {return;}
var n = 25;
@ -2951,6 +3087,7 @@ if (debug_output_flag == 1)
setprop(lw~"tmp/tile-alt-offset-ft",alt_20);
setprop(lw~"tmp/tile-alt-median-ft",alt_med);
setprop(lw~"tmp/tile-alt-min-ft",alt_min);
setprop(lw~"tmp/tile-alt-mean-ft",alt_mean);
setprop(lw~"tmp/tile-alt-layered-ft",0.5 * (alt_min + alt_20));
append(alt_50_array, alt_med);
@ -2965,6 +3102,8 @@ append(alt_20_array, alt_20);
var wave_detection_loop = func (blat, blon, nx, alpha) {
if (local_weather_running_flag == 0) {return;}
var phi = alpha * math.pi/180.0;
var elevation = 0.0;
var ny = 20;
@ -3208,6 +3347,27 @@ append(weatherStationArray,s);
}
###########################################################
# set an atmosphere condition point for interpolation
###########################################################
var set_atmosphere_ipoint = func (lat, lon, vis_aloft, vis_alt1, vis_ovcst, ovcst,ovcst_alt_low, ovcst_alt_high, scatt, scatt_alt_low, scatt_alt_high) {
var a = atmosphereIpoint.new (lat, lon, vis_aloft, vis_alt1, vis_ovcst, ovcst, ovcst_alt_low, ovcst_alt_high, scatt, scatt_alt_low, scatt_alt_high);
a.index = getprop(lw~"tiles/tile-counter");
a.weight = 0.02;
# set a timestamp if needed
if (dynamics_flag == 1)
{
a.timestamp = weather_dynamics.time_lw;
}
append(atmosphereIpointArray,a);
}
###########################################################
# set a wind interpolation point
###########################################################
@ -3516,12 +3676,15 @@ var set_tile = func {
# check if another instance of local weather is running already
if (local_weather_running_flag == 1)
{
setprop("/sim/messages/pilot", "Local weather: Local weather is already running, use Clear/End before restarting. Aborting...");
return;
}
local_weather_startup_flag = 1;
var type = getprop("/local-weather/tmp/tile-type");
@ -3577,6 +3740,11 @@ if ((presampling_flag == 1) and (getprop(lw~"tmp/presampling-status") == "idle")
}
# indicate that we're up and running
local_weather_startup_flag = 0;
local_weather_running_flag = 1;
# see if we use METAR for weather setup
if ((getprop("/environment/metar/valid") == 1) and (getprop(lw~"tmp/tile-management") == "METAR"))
@ -3819,9 +3987,7 @@ if (getprop(lw~"config/buffer-flag") ==1)
}
}
# and indicate that we're up and running
local_weather_running_flag = 1;
# weather_tile_management.watchdog_loop();
@ -3929,13 +4095,16 @@ var test = func {
var lat = getprop("position/latitude-deg");
var lon = getprop("position/longitude-deg");
var pos = geo.aircraft_position();
#var pos = geo.aircraft_position();
debug.dump(geodinfo(lat, lon));
setprop("/environment/terrain/area[0]/input/latitude-deg", lat );
setprop("/environment/terrain/area[0]/input/longitude-deg", lon );
# geo.put_model("Models/Astro/Earth.ac",lat, lon);
setprop("/environment/terrain/area[0]/output/valid", 0 );
#setprop("/environment/terrain/area[0]/input/latitude-deg", lat );
#setprop("/environment/terrain/area[0]/input/longitude-deg", lon );
#setprop("/environment/terrain/area[0]/output/valid", 0 );
}
@ -3957,6 +4126,7 @@ var weatherStation = {
s.T = T;
s.D = D;
s.p = p;
s.scattering = 0.8;
return s;
},
move: func {
@ -3969,6 +4139,32 @@ var weatherStation = {
};
var atmosphereIpoint = {
new: func (lat, lon, vis_aloft, vis_alt1, vis_ovcst, ovcst, ovcst_alt_low, ovcst_alt_high, scatt, scatt_alt_low, scatt_alt_high){
var a = { parents: [atmosphereIpoint] };
a.lat = lat;
a.lon = lon;
a.vis_aloft = vis_aloft;
a.vis_alt1 = vis_alt1;
a.vis_ovcst = vis_ovcst;
a.ovcst = ovcst;
a.ovcst_alt_low = ovcst_alt_low;
a.ovcst_alt_high = ovcst_alt_high;
a.scatt = scatt;
a.scatt_alt_low = scatt_alt_low;
a.scatt_alt_high = scatt_alt_high;
return a;
},
move: func {
var windfield = weather_dynamics.get_windfield(me.index);
var dt = weather_dynamics.time_lw - me.timestamp;
me.lat = me.lat + windfield[1] * dt * local_weather.m_to_lat;
me.lon = me.lon + windfield[0] * dt * local_weather.m_to_lon;
me.timestamp = weather_dynamics.time_lw;
},
};
var windIpoint = {
new: func (lat, lon, d0, v0, d1, v1, d2, v2, d3, v3, d4, v4, d5, v5, d6, v6, d7, v7, d8, v8) {
var w = { parents: [windIpoint] };
@ -4175,7 +4371,7 @@ var ec = "/environment/config/";
# a hash map of the strength for convection associated with terrain types
var landcover_map = {BuiltUpCover: 0.35, Town: 0.35, Freeway:0.35, BarrenCover:0.3, HerbTundraCover: 0.25, GrassCover: 0.2, CropGrassCover: 0.2, EvergreenBroadCover: 0.2, EvergreenNeedleCover: 0.2, Sand: 0.25, Grass: 0.2, Ocean: 0.01, Marsh: 0.05, Lake: 0.01, ShrubCover: 0.15, Landmass: 0.2, CropWoodCover: 0.15, MixedForestCover: 0.1, DryCropPastureCover: 0.25, MixedCropPastureCover: 0.2, IrrCropPastureCover: 0.15, DeciduousBroadCover: 0.1, DeciduousNeedleCover: 0.1, Bog: 0.05, pa_taxiway : 0.35, pa_tiedown: 0.35, pc_taxiway: 0.35, pc_tiedown: 0.35, Glacier: 0.01, DryLake: 0.3, IntermittentStream: 0.2};
var landcover_map = {BuiltUpCover: 0.35, Town: 0.35, Freeway:0.35, BarrenCover:0.3, HerbTundraCover: 0.25, GrassCover: 0.2, CropGrassCover: 0.2, EvergreenBroadCover: 0.2, EvergreenNeedleCover: 0.2, Sand: 0.25, Grass: 0.2, Ocean: 0.01, Marsh: 0.05, Lake: 0.01, ShrubCover: 0.15, Landmass: 0.2, CropWoodCover: 0.15, MixedForestCover: 0.1, DryCropPastureCover: 0.25, MixedCropPastureCover: 0.2, IrrCropPastureCover: 0.15, DeciduousBroadCover: 0.1, DeciduousNeedleCover: 0.1, Bog: 0.05, pa_taxiway : 0.35, pa_tiedown: 0.35, pc_taxiway: 0.35, pc_tiedown: 0.35, Glacier: 0.01, DryLake: 0.3, IntermittentStream: 0.2, DryCrop: 0.2, Lava: 0.3};
# a hash map of average vertical cloud model sizes
@ -4218,10 +4414,11 @@ var thermal = {};
var wave = {};
# arrays of currently existing weather stations and wind interpolation points
# arrays of currently existing weather stations, wind interpolation and atmospheric condition points
var weatherStationArray = [];
var windIpointArray = [];
var atmosphereIpointArray = [];
# a flag for the wind model (so we don't have to do string comparisons all the time)
@ -4256,7 +4453,9 @@ var dynamical_convection_flag = 1;
var debug_output_flag = 1;
var metar_flag = 0;
var local_weather_running_flag = 0;
var fps_control_flag = 1;
var local_weather_startup_flag = 0;
var fps_control_flag = 0;
var detailed_terrain_interaction_flag = 1;
# globals for framerate controlled cloud management
@ -4414,10 +4613,12 @@ setprop(lw~"tiles/tile-counter",0);
setprop(lwi~"ipoint-number",0);
var updateMenu = func {
var isEnabled = getprop("/nasal/local_weather/enabled");
gui.menuEnable("local_weather", isEnabled);
gui.menuEnable("local_weather_tiles", isEnabled);
}
# wait for Nasal to be available and do what is in startup()
_setlistener("/nasal/local_weather/enabled", updateMenu);
_setlistener("/sim/signals/nasal-dir-initialized", func {
startup();
});

View file

@ -63,6 +63,8 @@ return windfield;
var timing_loop = func {
if (local_weather.local_weather_running_flag == 0) {return;}
dt_lw = getprop("/sim/time/delta-sec");
time_lw = time_lw + dt_lw;
@ -79,6 +81,7 @@ if (getprop(lw~"timing-loop-flag") ==1) {settimer(timing_loop, 0);}
var quadtree_loop = func {
if (local_weather.local_weather_running_flag == 0) {return;}
var vangle = 0.55 * getprop("/sim/current-view/field-of-view");
var viewdir = getprop("/sim/current-view/goal-heading-offset-deg");
@ -161,6 +164,8 @@ if (getprop(lw~"dynamics-loop-flag") ==1) {settimer(quadtree_loop, 0);}
var weather_dynamics_loop = func (index, cindex) {
if (local_weather.local_weather_running_flag == 0) {return;}
var n = 20;
var nc = 1;
@ -241,11 +246,16 @@ if (j >= csize) {cindex = 0;}
foreach (s; local_weather.weatherStationArray)
foreach (var s; local_weather.weatherStationArray)
{
s.move();
}
foreach (var a; local_weather.atmosphereIpointArray)
{
a.move();
}
if (getprop(lw~"dynamics-loop-flag") ==1) {settimer( func {weather_dynamics_loop(index, cindex); },0);}
}
@ -257,6 +267,8 @@ if (getprop(lw~"dynamics-loop-flag") ==1) {settimer( func {weather_dynamics_loop
var convective_loop = func {
if (local_weather.local_weather_running_flag == 0) {return;}
# a 30 second loop needs a different strategy to end, otherwise there is trouble if it is restarted while still running
if (convective_loop_kill_flag == 1)

View file

@ -34,6 +34,9 @@
var tile_management_loop = func {
if (local_weather.local_weather_running_flag == 0) {return;}
var tNode = props.globals.getNode(lw~"tiles", 1).getChildren("tile");
var viewpos = geo.aircraft_position(); # using viewpos here triggers massive tile ops for tower view...
var code = getprop(lw~"tiles/tile[4]/code");
@ -1093,6 +1096,8 @@ setprop(lw~"tiles/tile[8]/orientation-deg",alpha);
var buffer_loop = func (index) {
if (local_weather.local_weather_running_flag == 0) {return;}
var n = 5;
var n_max = size(cloudBufferArray);
var s = size(active_tile_list);
@ -1225,6 +1230,8 @@ if (getprop(lw~"buffer-loop-flag") ==1) {settimer( func {buffer_loop(i)}, 0);}
var housekeeping_loop = func (index) {
if (local_weather.local_weather_running_flag == 0) {return;}
var n = 5;
var n_max = size(cloudSceneryArray);
n_cloudSceneryArray = n_max;

View file

@ -108,9 +108,9 @@ local_weather.set_weather_station(blat, blon, alt_offset, 20000.0, 14.0, 12.0, 2
# create_2_8_cirrocumulus(blat, blon, 6000.0, 0.0);
create_detailed_small_stratocumulus_bank(blat, blon,3000.0+alt_offset,0.0);
# create_detailed_small_stratocumulus_bank(blat, blon,3000.0+alt_offset,0.0);
#create_4_8_altocumulus_perlucidus(blat, blon, 10000.0, 0.0);
create_4_8_altocumulus_perlucidus(blat, blon, 10000.0, 0.0);
#local_weather.create_effect_volume(3, blat, blon, 20000.0, 7000.0, alpha, 0.0, 80000.0, -1, -1, -1, -1, 15.0, -3,-1);
@ -118,6 +118,9 @@ create_1_8_contrails(blat, blon, 30000.0, 0.0);
# store convective altitude and strength
local_weather.set_atmosphere_ipoint(blat, blon, 45000.0, 10000.0, 45000.0, 0.2, 25000.0, 30000.0, 0.7, 10000.0, 11000.0);
append(weather_dynamics.tile_convective_altitude,3000.0);
append(weather_dynamics.tile_convective_strength,0.0);
@ -164,6 +167,7 @@ var p = 1025.0 + rand() * 6.0; p = adjust_p(p);
local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_inhg);
var alt = spread * 1000;
var strength = 0.0;
@ -192,7 +196,9 @@ if (rn > 0.8)
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
local_weather.generate_thermal_lift_flag = 2;
}
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, 25000.0, 30000.0, 0.9, alt+alt_offset, alt+alt_offset + 1500.0);
}
else if (rn > 0.6)
{
@ -204,6 +210,9 @@ else if (rn > 0.6)
create_2_8_cirrocumulus(blat, blon, alt + alt_offset + 5000.0, alpha);
create_2_8_cirrus(blat, blon, alt + alt_offset + 35000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.1, alt+alt_offset +30000.0, alt+alt_offset + 35000.0, 0.9, alt+alt_offset, alt+alt_offset + 1500.0);
}
else if (rn > 0.4)
{
@ -213,6 +222,10 @@ else if (rn > 0.4)
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
create_4_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 32000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.15, alt+alt_offset +28000.0, alt+alt_offset + 32000.0, 0.9, alt+alt_offset, alt+alt_offset + 1500.0);
}
else if (rn > 0.2)
{
@ -222,6 +235,9 @@ else if (rn > 0.2)
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
create_1_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 32000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.15, alt+alt_offset +28000.0, alt+alt_offset + 32000.0, 0.9, alt+alt_offset, alt+alt_offset + 1500.0);
}
else if (rn > 0.0)
{
@ -234,6 +250,9 @@ else if (rn > 0.0)
create_1_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 28000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +28000.0, alt+alt_offset + 33000.0, 0.9, alt+alt_offset, alt+alt_offset + 1500.0);
}
@ -320,6 +339,9 @@ if (rn > 0.8)
compat_layer.create_cloud(path, blat + get_lat(x,y,phi), blon+get_lon(x,y,phi), alt + alt_offset +25000.0 + rand() * 5000.0,alpha);
}
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +28000.0, alt+alt_offset + 30000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
}
else if (rn > 0.6)
{
@ -329,6 +351,9 @@ else if (rn > 0.6)
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
create_2_8_cirrostratus(blat, blon, alt+alt_offset+25000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.2, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
}
else if (rn > 0.4)
@ -345,6 +370,10 @@ else if (rn > 0.4)
var path = local_weather.select_cloud_model("Cirrocumulus", "large");
compat_layer.create_cloud(path, blat + get_lat(x,y,phi), blon+get_lon(x,y,phi), alt + alt_offset +24000,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 24000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
}
else if (rn > 0.2)
{
@ -354,6 +383,9 @@ else if (rn > 0.2)
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
create_4_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 25000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.15, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
}
else if (rn > 0.0)
{
@ -365,6 +397,9 @@ else if (rn > 0.0)
create_1_8_altocumulus_scattered(blat, blon, alt+alt_offset+10000.0, alpha);
create_1_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 25000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
}
# store convective altitude and strength
@ -437,6 +472,10 @@ if (rn > 0.875)
y = 2.0 * (rand()-0.5) * 5000;
local_weather.create_streak("Altocumulus",blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 12000.0+alt+alt_offset,1500.0,30,1000.0,0.2,1200.0,30,1000.0,0.2,1200.0,alpha ,1.0);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 1500.0);
}
else if (rn > 0.750)
{
@ -451,6 +490,9 @@ else if (rn > 0.750)
y = 2.0 * (rand()-0.5) * 10000;
local_weather.create_streak("Altocumulus",blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 12000.0+alt+alt_offset,1500.0,22,750.0,0.2,1000.0,8,750.0,0.2,1000.0,alpha ,1.1);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.625)
{
@ -463,6 +505,9 @@ else if (rn > 0.625)
y = 2.0 * (rand()-0.5) * 3000;
local_weather.create_streak("Cirrus",blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 22000.0+alt+alt_offset,1500.0,3,9000.0,0.0, 800.0, 1,8000.0,0.0,800,0,alpha ,1.0);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 22000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.5)
{
@ -478,6 +523,10 @@ else if (rn > 0.5)
create_cloud_bank("Cumulonimbus", blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), alt+alt_offset, 1600.0, 800.0, 3000.0, 9, alpha);
}
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.375)
{
@ -490,6 +539,9 @@ else if (rn > 0.375)
local_weather.create_streak("Stratus (structured)",blat, blon, alt+6000.0+alt_offset+size_offset,1000.0,18,0.0,0.3,20000.0,18,0.0,0.3,20000.0,0.0,1.0);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.2, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.250)
{
@ -510,6 +562,9 @@ else if (rn > 0.250)
var path = local_weather.select_cloud_model("Cirrocumulus", "large");
compat_layer.create_cloud(path, blat + get_lat(x,y,phi), blon+get_lon(x,y,phi), alt + alt_offset +20000+ alt_variation,alpha+ beta);
}
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.125)
{
@ -520,6 +575,9 @@ else if (rn > 0.125)
create_4_8_cirrocumulus_streaks(blat, blon, alt + 6000.0 + alt_offset, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.05, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.0)
{
@ -528,6 +586,10 @@ else if (rn > 0.0)
create_4_8_altocumulus_perlucidus(blat, blon, alt + 10000.0 + alt_offset, alpha);
create_2_8_cirrus(blat, blon, alt + 30000.0 + alt_offset, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.25, alt+alt_offset +26000.0, alt+alt_offset + 30000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
}
@ -605,6 +667,10 @@ if (rn > 0.857)
create_detailed_stratocumulus_bank(blat, blon, alt+alt_offset,alpha);
create_4_8_alttstratus_streaks(blat, blon, alt+alt_offset+4000.0,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.714)
{
@ -616,6 +682,9 @@ else if (rn > 0.714)
create_6_8_tstratus_undulatus(blat, blon, alt+alt_offset+4000.0,alpha);
create_2_8_alttstratus(blat, blon, alt+alt_offset+7000.0,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.571)
{
@ -625,6 +694,9 @@ else if (rn > 0.571)
create_detailed_small_stratocumulus_bank(blat, blon, alt+alt_offset,alpha);
create_4_8_alttstratus_patches(blat, blon, alt+alt_offset+4000.0,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.7, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.428)
{
@ -634,6 +706,8 @@ else if (rn > 0.428)
create_4_8_sstratus_patches(blat, blon, alt+alt_offset,alpha);
create_2_8_alttstratus(blat, blon, alt+alt_offset+7000.0,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.25, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.7, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.285)
{
@ -645,6 +719,9 @@ else if (rn > 0.285)
create_4_8_tstratus_patches(blat, blon, alt+alt_offset,alpha);
create_4_8_cirrocumulus_undulatus(blat, blon, alt+alt_offset + 12000.0,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.15, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.142)
{
@ -656,6 +733,9 @@ else if (rn > 0.142)
create_4_8_tstratus_patches(blat, blon, alt+alt_offset,alpha);
create_2_8_cirrostratus(blat, blon, alt+alt_offset + 25000.0,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.3, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
}
else
{
@ -665,6 +745,9 @@ else
create_4_8_sstratus_patches(blat, blon, alt+alt_offset,alpha);
create_2_8_cirrostratus(blat, blon, alt+alt_offset + 25000.0,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 15000.0, 0.2, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
}
@ -710,9 +793,9 @@ calc_geo(blat);
# get probabilistic values for the weather parameters
var vis = 8000.0 + rand() * 8000.0;
var vis = 7000.0 + rand() * 7000.0;
var T = 5.0 + rand() * 10.0;
var spread = 1.0 + 2.0 * rand();
var spread = 1.5 + 2.5 * rand();
var D = T - spread;
var p = 1001.0 + rand() * 6.0; p = adjust_p(p);
@ -757,6 +840,9 @@ if (rn > 0.75)
create_4_8_sstratus_undulatus(blat, blon, alt+alt_offset +3000.0, alpha);
create_2_8_tstratus(blat, blon, alt+alt_offset +6000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 17000.0, alt+alt_offset, vis + 22000.0, 0.2, alt+alt_offset +15000.0, alt+alt_offset + 20000.0, 0.7, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn >0.5)
{
@ -769,6 +855,10 @@ else if (rn >0.5)
local_weather.create_effect_volume(3, blat, blon, 18000.0, 18000.0, 0.0, 0.0, 1800.0, 8000.0, -1, -1, -1, -1, 0,-1);
local_weather.create_effect_volume(3, blat, blon, 14000.0, 14000.0, 0.0, 0.0, 1500.0, 6000.0, 0.1, -1, -1, -1,0,-1 );
create_2_8_sstratus(blat, blon, alt+alt_offset+3000,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 17000.0, alt+alt_offset, vis + 25000.0, 0.3, alt+alt_offset +15000.0, alt+alt_offset + 20000.0, 0.6, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn >0.25)
{
@ -780,6 +870,9 @@ else if (rn >0.25)
create_4_8_stratus_patches(blat, blon, alt+alt_offset+3000,alpha);
create_4_8_sstratus_undulatus(blat, blon, alt+alt_offset+6000,alpha);
create_2_8_tstratus(blat, blon, alt+alt_offset+8000,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 17000.0, alt+alt_offset, vis + 25000.0, 0.35, alt+alt_offset +10000.0, alt+alt_offset + 20000.0, 0.65, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn >0.0)
{
@ -789,6 +882,9 @@ else if (rn >0.0)
alt = alt + local_weather.cloud_vertical_size_map["Stratus"] * 0.5 * m_to_ft;
create_6_8_stratus(blat, blon, alt+alt_offset,alpha);
create_2_8_sstratus(blat, blon, alt+alt_offset+6000,alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 15000.0, alt+alt_offset, vis + 24000.0, 0.2, alt+alt_offset +15000.0, alt+alt_offset + 22000.0, 0.6, alt+alt_offset, alt+alt_offset + 2500.0);
}
# store convective altitude and strength
@ -834,7 +930,7 @@ calc_geo(blat);
var vis = 5000.0 + rand() * 5000.0;
var T = 3.0 + rand() * 7.0;
var spread = 1.0 + 1.0 * rand();
var spread = 1.5 + 1.5 * rand();
var D = T - spread;
var p = 995.0 + rand() * 6.0; p = adjust_p(p);
@ -868,6 +964,9 @@ else
if (rn > 0.5){create_4_8_stratus_patches(blat, blon, alt+alt_offset+3000.0, alpha);}
else {create_4_8_stratus(blat, blon, alt+alt_offset+3000.0, alpha);}
local_weather.set_atmosphere_ipoint(blat, blon, vis + 20000.0, alt+alt_offset, vis + 25000.0, 0.0, alt+alt_offset +15000.0, alt+alt_offset + 22000.0, 0.6, alt+alt_offset, alt+alt_offset + 3000.0);
# store convective altitude and strength
append(weather_dynamics.tile_convective_altitude,alt);
@ -932,6 +1031,9 @@ if (rn > 0.5)
# cloud scenario 1: strong Cumulus development
strength = 0.8 + rand() * 0.2;
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 8000.0, alt+alt_offset, vis + 18000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.0)
@ -953,6 +1055,9 @@ else if (rn > 0.0)
compat_layer.create_cloud(path, blat + get_lat(x,y,phi), blon+get_lon(x,y,phi), alt + alt_offset +20000+ alt_variation,alpha+ beta);
}
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 8000.0, alt+alt_offset, vis + 18000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
}
#local_weather.create_effect_volume(3, blat, blon, 20000.0, 7000.0, alpha, 0.0, 80000.0, -1, -1, -1, -1, 15.0, -3,-1);
@ -994,7 +1099,7 @@ calc_geo(blat);
# get probabilistic values for the weather parameters
var vis = 10000.0 + rand() * 8000.0;
var vis = 12000.0 + rand() * 10000.0;
var T = 16.0 + rand() * 10.0;
var spread = 2.0 + 2.0 * rand();
var D = T - spread;
@ -1020,6 +1125,9 @@ if (rn > 0.8)
strength = 0.3 + rand() * 0.2;
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
create_4_8_cirrostratus_patches(blat, blon, alt+alt_offset+25000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 1000.0, alt+alt_offset, vis + 3000.0, 0.3, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.6)
{
@ -1031,6 +1139,9 @@ else if (rn > 0.6)
create_2_8_sstratus_streak(blat, blon, alt+alt_offset + size_offset + 2000.0, alpha);
create_2_8_sstratus_streak(blat, blon, alt+alt_offset + size_offset + 4000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 1000.0, alt+alt_offset, vis + 3000.0, 0.2, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.4)
{
@ -1042,6 +1153,8 @@ else if (rn > 0.4)
create_4_8_cirrocumulus_bank(blat, blon, alt+alt_offset + size_offset + 7000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 1000.0, alt+alt_offset, vis + 3000.0, 0.35, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.75, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.2)
{
@ -1052,6 +1165,9 @@ else if (rn > 0.2)
var size_offset = 0.5 * m_to_ft * local_weather.cloud_vertical_size_map["Cirrocumulus"];
create_4_8_cirrocumulus_undulatus(blat, blon, alt+alt_offset + size_offset + 6000.0, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 1000.0, alt+alt_offset, vis + 3000.0, 0.2, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.72, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.0)
@ -1065,6 +1181,9 @@ else if (rn > 0.0)
local_weather.create_streak("Stratus (structured)",blat, blon, alt+4000.0+alt_offset+size_offset,1000.0,14,0.0,0.3,20000.0,14,0.0,0.3,20000.0,0.0,1.0);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 2000.0, alt+alt_offset, vis + 4000.0, 0.15, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.73, alt+alt_offset, alt+alt_offset + 2500.0);
}
# store convective altitude and strength
@ -1112,7 +1231,7 @@ calc_geo(blat);
# get probabilistic values for the weather parameters
var vis = 10000.0 + rand() * 10000.0;
var vis = 9000.0 + rand() * 10000.0;
var T = 20.0 + rand() * 15.0;
var spread = 3.0 + 2.0 * rand();
var D = T - spread;
@ -1137,6 +1256,9 @@ if (rn > (t_factor * t_factor * t_factor * t_factor)) # call a normal convective
{
strength = 1.0 + rand() * 0.2;
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 15000.0, alt+alt_offset, vis + 20000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.7, alt+alt_offset, alt+alt_offset + 2500.0);
}
else
@ -1172,6 +1294,9 @@ if (rn > 0.2)
else
{create_small_thunderstorm(blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), alt+alt_offset, alpha);}
}
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 12000.0, alt+alt_offset, vis + 20000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.65, alt+alt_offset, alt+alt_offset + 2500.0);
}
else if (rn > 0.0)
{
@ -1181,6 +1306,9 @@ else if (rn > 0.0)
y = 2.0 * (rand()-0.5) * 12000;
create_big_thunderstorm(blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), alt+alt_offset, alpha);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 12000.0, alt+alt_offset, vis + 20000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.65, alt+alt_offset, alt+alt_offset + 2500.0);
}
@ -1324,6 +1452,9 @@ local_weather.create_effect_volume(3, blat+get_lat(x,y,phi), blon+get_lon(x,y,ph
x=0.0; y = 5000.0;
local_weather.create_effect_volume(3, blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 20000.0, 8000.0, alpha, 0.0, alt+alt_offset, 10000.0, 0.1, -1, -1, -1,0,-1 );
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 20000.0, 0.0, alt+alt_offset +20000.0, alt+alt_offset + 25000.0, 0.6, alt+alt_offset, alt+alt_offset + 2500.0);
# store convective altitude and strength
append(weather_dynamics.tile_convective_altitude,alt);
@ -1421,6 +1552,9 @@ for (var i=0; i<6; i=i+1)
}
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 8000.0, alt+alt_offset, vis + 10000.0, rand() * 0.1, alt+alt_offset +18000.0, alt+alt_offset + 22000.0, 0.8, alt+alt_offset, alt+alt_offset + 2500.0);
# store convective altitude and strength
append(weather_dynamics.tile_convective_altitude,alt);
@ -1534,6 +1668,10 @@ var y = 8000.0;
local_weather.create_streak("Stratus",blat +get_lat(x,y,phi), blon+get_lon(x,y,phi), alt+alt_offset +5000.0,1000.0,30,0.0,0.2,20000.0,10,0.0,0.2,12000.0,alpha,1.0);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 6000.0, alt+alt_offset, vis + 8000.0, 0.15 + rand() * 0.15, alt+alt_offset +17000.0, alt+alt_offset + 21000.0, 0.7, alt+alt_offset, alt+alt_offset + 2500.0);
# store convective altitude and strength
append(weather_dynamics.tile_convective_altitude,alt);
@ -1637,6 +1775,10 @@ x=0.0; y = 10000.0;
local_weather.create_effect_volume(3, blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 20000.0, 10000.0, alpha, 0.0, alt+alt_offset, vis * 0.5, 0.3, -1, -1, -1,0,-1 );
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 6000.0, alt+alt_offset, vis + 8000.0, 0.05 + rand() * 0.05, alt+alt_offset +16000.0, alt+alt_offset + 20000.0, 0.6, alt+alt_offset, alt+alt_offset + 2500.0);
# store convective altitude and strength
append(weather_dynamics.tile_convective_altitude,alt);
@ -1736,6 +1878,9 @@ x=0.0; y = -5000.0;
local_weather.create_effect_volume(3, blat+get_lat(x,y,phi), blon+get_lon(x,y,phi), 20000.0, 15000.0, alpha, 0.0, alt+alt_offset, vis * 0.5, 0.3, -1, -1, -1,0 ,-1);
# and specify the atmosphere
local_weather.set_atmosphere_ipoint(blat, blon, vis + 10000.0, alt+alt_offset, vis + 12000.0, 0.1, alt+alt_offset +16000.0, alt+alt_offset + 20000.0, 0.5, alt+alt_offset, alt+alt_offset + 2500.0);
# store convective altitude and strength
append(weather_dynamics.tile_convective_altitude,alt);
@ -2205,6 +2350,68 @@ var set_METAR_weather_station = func {
local_weather.set_weather_station(station_lat, station_lon, metar_alt_offset, vis, T, D, p);
# get cloud layer info for lighting
var coverage1 = 8 - 2 * getprop("/environment/metar/clouds/layer[0]/coverage-type");
var layer_alt1 = getprop("/environment/metar/clouds/layer[0]/elevation-ft");
var coverage2 = 8 - 2 * getprop("/environment/metar/clouds/layer[1]/coverage-type");
var layer_alt2 = getprop("/environment/metar/clouds/layer[1]/elevation-ft");
var coverage3 = 8 - 2 * getprop("/environment/metar/clouds/layer[2]/coverage-type");
var layer_alt3 = getprop("/environment/metar/clouds/layer[2]/elevation-ft");
var coverage4 = 8 - 2 * getprop("/environment/metar/clouds/layer[3]/coverage-type");
var layer_alt4 = getprop("/environment/metar/clouds/layer[3]/elevation-ft");
# determine the altitude of the main shading layer
# default assumption - the lowest layer shades
var alt_shade = layer_alt1; var coverage_shade = coverage1; var coverage_mult = 1.0;
# if a higher layer is more opaque, it determines the shading unless it is a thin layer
if ((coverage2 >= coverage1) and (layer_alt2 < 14000.0))
{alt_shade = layer_alt2; coverage_shade = coverage2; coverage_mult = 0.9;}
if ((coverage3 >= coverage1) and (coverage3 >= coverage2) and (layer_alt3 < 14000.0))
{alt_shade = layer_alt3; coverage_shade = coverage3; coverage_mult = 0.8;}
# determine the amount of shading
# default assumption: no clouds
var shade = 1.0;
if (coverage_shade < 1) # clear sky, we need to specify an altitude for the model
{shade = 0.9; alt_shade = 9000.0;}
else if (coverage_shade < 3)
{shade = 0.8;}
else if (coverage_shade < 5)
{shade = 0.7;}
else if (coverage_shade < 8)
{shade = 0.6;}
else if (coverage_shade == 8)
{shade = 0.55;}
shade = shade * coverage_mult;
# see if we have any high-altitude clouds
var ovcst = 0.0; var ovcst_alt = 20000.0;
if (layer_alt1 > 20000.0)
{ovcst_alt = layer_alt1; ovcst = ovcst + rand() * 0.1;}
if (layer_alt2 > 20000.0)
{ovcst_alt = layer_alt2; ovcst = ovcst + rand() * 0.1;}
if (layer_alt3 > 20000.0)
{ovcst_alt = layer_alt3; ovcst = ovcst + rand() * 0.1;}
if (layer_alt4 > 20000.0)
{ovcst_alt = layer_alt4; ovcst = ovcst + rand() * 0.1;}
# and specify the atmosphere - currently default only
local_weather.set_atmosphere_ipoint(station_lat, station_lon, vis + 10000.0, metar_alt_offset + alt_shade, vis + 20000.0, ovcst, ovcst_alt+metar_alt_offset - 5000.0, ovcst_alt+metar_alt_offset, shade, layer_alt1+metar_alt_offset, alt_shade+metar_alt_offset + 2500.0);
# if we use aloft interpolated winds with METAR, also set a new wind interpolation point
if ((local_weather.wind_model_flag == 5) and (getprop(lw~"tiles/tile-counter") !=1))
@ -2346,12 +2553,12 @@ else
if (rain > 0.1)
{
local_weather.create_effect_volume(3, lat, lon, 20000.0, 20000.0, alpha, 0.0, alt+900.0, 500.0 + (1.0 - 0.5 * rain) * 5500.0, 0.5 * rain , -1, -1, -1,0 ,0.95);
local_weather.create_effect_volume(3, lat , lon, 16000.0, 16000.0, alpha, 0.0, alt - 300.0, 500.0 + (1.0-rain) * 5500.0, rain, -1, -1, -1,0 ,0.8);
local_weather.create_effect_volume(3, lat , lon, 16000.0, 16000.0, alpha, 0.0, alt - 300.0, 500.0 + (1.0-rain) * 5500.0, rain, -1, -1, -1,0 ,0.9);
}
else
{
local_weather.create_effect_volume(3, lat, lon, 20000.0, 20000.0, alpha, alt-1500.0, alt+900.0, 2000.0, -1 , -1, -1, -1,0 ,-1);
local_weather.create_effect_volume(3, lat, lon, 20000.0, 20000.0, alpha, 0.0, alt, -1, rain , -1, -1, -1,0 ,0.8);
local_weather.create_effect_volume(3, lat, lon, 20000.0, 20000.0, alpha, 0.0, alt, -1, rain , -1, -1, -1,0 ,0.9);
}
}

View file

@ -216,6 +216,7 @@ var window = {
#
# dpy.interval = 0; # update every frame
# dpy.format = "%.3g"; # max. 3 digits fractional part
# dpy.tagformat = "%-12s"; # align prop names to 12 spaces
# dpy.redraw(); # pick up new settings
#
#
@ -240,6 +241,7 @@ var display = {
m.tags = show_tags;
m.font = "HELVETICA_14";
m.color = [1, 1, 1, 1];
m.tagformat = "%s";
m.format = "%.12g";
m.interval = 0.1;
#
@ -319,9 +321,10 @@ var display = {
if (e.node.getPath() == path)
continue nextprop;
e.parent = e.node;
e.tag = me.nameof(e.node);
e.tag = sprintf(me.tagformat, me.nameof(e.node));
}
append(me.entries, { node: n, parent: n, tag: me.nameof(n),
append(me.entries, { node: n, parent: n,
tag: sprintf(me.tagformat, me.nameof(n)),
target: me.base.getChild("entry", size(me.entries), 1) });
}

View file

@ -100,7 +100,8 @@ var stepView = func(step, force = 0) {
n = size(views) - 1;
elsif (n >= size(views))
n = 0;
if (force or (var e = views[n].getNode("enabled")) == nil or e.getBoolValue())
if (force or (var e = (views[n].getNode("enabled"))) == nil or
(e.getBoolValue() and (views[n].getNode("name")!=nil)))
break;
}
setprop("/sim/current-view/view-number", n);

View file

@ -41,7 +41,8 @@ void main(void)
// http://code.google.com/p/flightgear-bugs/issues/detail?id=123
// float n = dot(normalize(-gl_LightSource[0].position.xyz),
// normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));;
float n = dot(normalize(-gl_LightSource[0].position.xyz), vec3(0.0,0.0,-1.0));
float n = dot(normalize(-gl_LightSource[0].position.xyz),
normalize(vec3(gl_ModelViewMatrix * vec4(- gl_Position.xyz,0.0))));
// Determine the position - used for fog and shading calculations
vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position);

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

View file

@ -100,6 +100,7 @@
<enable-ai-models-desc>Enable AI subsystem (required for multi-player, AI traffic and many other animations)</enable-ai-models-desc>
<disable-ai-traffic-desc>Disable artificial traffic.</disable-ai-traffic-desc>
<enable-ai-traffic-desc>Enable artificial traffic.</enable-ai-traffic-desc>
<disable-ai-scenarios>Disable all AI scenarios.</disable-ai-scenarios>
<ai-scenario>Add and enable a new scenario. Multiple options are allowed.</ai-scenario>
<disable-freeze-desc>Start in a running state</disable-freeze-desc>
<enable-freeze-desc>Start in a frozen state</enable-freeze-desc>
@ -250,6 +251,9 @@
<proxy-desc>Specify which proxy server (and port) to use. The username and password are optional and should be MD5 encoded already. This option is only useful when used in conjunction with the real-weather-fetch option.</proxy-desc>
<telnet-desc>Enable telnet server on the specified port</telnet-desc>
<jpg-httpd-desc>Enable screen shot http server on the specified port</jpg-httpd-desc>
<disable-terrasync-desc>Disable automatic scenery downloads/updates</disable-terrasync-desc>
<enable-terrasync-desc>Enable automatic scenery downloads/updates</enable-terrasync-desc>
<terrasync-dir-desc>Set target directory for scenery downloads</terrasync-dir-desc>
<!-- MultiPlayer options -->
<multiplayer-options>MultiPlayer Options</multiplayer-options>

View file

@ -18,7 +18,8 @@
{
if (substr(file, -3) == "xml")
{
append(models, substr(file, 0, size(file) - 4));
var tree = io.read_properties("Models/Airport/Jetway/" ~ file);
if (tree.getNode("is-animated-jetway", 1).getBoolValue()) append(models, substr(file, 0, size(file) - 4));
}
}
for (var i = 0; i < size(models); i += 1)

View file

@ -9,17 +9,20 @@
<nasal>
<open><![CDATA[
var self = cmdarg();
var dlgname = self.getNode("name").getValue();
var aptlist = props.globals.getNode(self.getNode("text/property").getValue(), 1);
var UPDATE_PERIOD = 1;
var loadedN = props.globals.getNode("/nasal/jetways/loaded", 1);
var UPDATE_PERIOD = 5;
var update = func
{
var list = "";
foreach (var apt; jetways.loaded_airports)
if (loadedN.getBoolValue())
{
var list = "";
foreach (var apt; jetways.loaded_airports)
{
list ~= apt ~ " ";
}
aptlist.setValue(list == "" ? "No airports loaded" : "Loaded airports: " ~ list);
}
aptlist.setValue(list == "" ? "No airports loaded" : "Loaded airports: " ~ list);
settimer(update, UPDATE_PERIOD);
};
settimer(update, 0);
@ -57,7 +60,7 @@
<checkbox>
<halign>left</halign>
<label>Enable animated jetways</label>
<property>/sim/jetways/enabled</property>
<property>/nasal/jetways/enabled</property>
<live type="bool">true</live>
<binding>
<command>dialog-apply</command>
@ -69,7 +72,7 @@
<property>/sim/jetways/interact-with-multiplay</property>
<live type="bool">true</live>
<enable>
<property>/sim/jetways/enabled</property>
<property>/nasal/jetways/enabled</property>
</enable>
<binding>
<command>dialog-apply</command>
@ -78,10 +81,10 @@
<checkbox>
<halign>left</halign>
<label>Enable jetway editor</label>
<property>/sim/jetways/enable-editor</property>
<property>/nasal/jetways_edit/enabled</property>
<live type="bool">true</live>
<enable>
<property>/sim/jetways/enabled</property>
<property>/nasal/jetways/enabled</property>
</enable>
<binding>
<command>dialog-apply</command>
@ -93,7 +96,7 @@
<property>/sim/jetways/debug</property>
<live type="bool">true</live>
<enable>
<property>/sim/jetways/enabled</property>
<property>/nasal/jetways/enabled</property>
</enable>
<binding>
<command>dialog-apply</command>
@ -106,15 +109,13 @@
<legend>Open editor</legend>
<enable>
<and>
<property>/sim/jetways/enabled</property>
<property>/sim/jetways/enable-editor</property>
<property>/nasal/jetways/enabled</property>
<property>/nasal/jetways_edit/enabled</property>
</and>
</enable>
<binding>
<command>nasal</command>
<script>
jetways_edit.dialog();
</script>
<command>dialog-show</command>
<dialog-name>jetways-adjust</dialog-name>
</binding>
</button>
</group>
@ -124,7 +125,7 @@
<text>
<halign>left</halign>
<label>No airports loaded</label>
<property>/sim/gui/dialogs/jetways/dialog/loaded-airports</property>
<property>/sim/gui/dialogs/jetways/loaded-airports</property>
<live type="bool">true</live>
</text>

View file

@ -6,10 +6,22 @@
<name>local_weather_config</name>
<width>400</width>
<height>400</height>
<height>440</height>
<modal>false</modal>
<checkbox>
<x>5</x>
<y>400</y>
<width>15</width>
<height>15</height>
<label>Enable local weather module</label>
<property>/nasal/local_weather/enabled</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<text>
<x>5</x>
<y>370</y>

116
gui/dialogs/multiplayer.xml Normal file
View file

@ -0,0 +1,116 @@
<?xml version="1.0"?>
<PropertyList>
<name>multiplayer</name>
<layout>vbox</layout>
<resizable>true</resizable>
<nasal>
<open>
</open>
<close>
</close>
</nasal>
<!-- titlebar -->
<group>
<layout>hbox</layout>
<empty><stretch>1</stretch></empty>
<text>
<label>Multiplayer Settings</label>
</text>
<empty><stretch>1</stretch></empty>
<button>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<legend></legend>
<default>1</default>
<keynum>27</keynum>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>table</layout>
<halign>center</halign>
<text>
<row>0</row><col>0</col>
<halign>right</halign>
<label>Callsign:</label>
</text>
<input>
<row>0</row><col>1</col>
<property>/sim/multiplay/callsign</property>
</input>
<text>
<row>1</row><col>0</col>
<halign>right</halign>
<label>Server:</label>
</text>
<combo>
<name>host</name>
<row>1</row><col>1</col>
<pref-width>120</pref-width>
<property>/sim/multiplay/txhost</property>
<editable>true</editable>
<properties>/sim/multiplay/servers</properties>
</combo>
<input>
<row>1</row><col>2</col>
<property>/sim/multiplay/txport</property>
</input>
<!-- status area -->
<text>
<visible>
<not><property>/sim/multiplay/online</property></not>
</visible>
<row>2</row>
<col>1</col>
<label>Not connected</label>
</text>
<text>
<visible>
<property>/sim/multiplay/online</property>
</visible>
<row>2</row>
<col>1</col>
<label>MMMMMMMMMMMMMMMMM</label>
<format>Connected to %s</format>
<property>/sim/multiplay/txhost</property>
<live>true</live>
</text>
</group>
<group>
<layout>hbox</layout>
<default-padding>10</default-padding>
<empty><stretch>true</stretch></empty>
<button>
<legend>Apply</legend>
<default>true</default>
<equal>true</equal>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>reinit</command>
<subsystem>mp</subsystem>
</binding>
</button>
</group>
</PropertyList>

431
gui/dialogs/terrasync.xml Normal file
View file

@ -0,0 +1,431 @@
<?xml version="1.0"?>
<PropertyList>
<name>terrasync</name>
<layout>vbox</layout>
<group>
<layout>hbox</layout>
<empty><stretch>1</stretch></empty>
<text>
<label>Automatic Scenery Download</label>
</text>
<empty><stretch>1</stretch></empty>
<button>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<legend></legend>
<keynum>27</keynum>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<text>
<color>
<red>1.0</red>
<green>0.4</green>
<blue>0.4</blue>
</color>
<halign>center</halign>
<label>Monitor your bandwidth or use a flat-rate when using automatic download.</label>
</text>
<group>
<layout>table</layout>
<halign>left</halign>
<equal>false</equal>
<checkbox>
<name>terrasync-enabled</name>
<halign>left</halign>
<row>1</row><col>1</col><colspan>3</colspan>
<property>/sim/terrasync/enabled</property>
<label>Enable automatic scenery download/update</label>
<live>true</live>
<binding>
<command>dialog-apply</command>
<object-name>terrasync-enabled</object-name>
</binding>
</checkbox>
<text>
<halign>right</halign>
<row>3</row><col>1</col>
<label>Target directory:</label>
</text>
<input>
<name>scenery-dir</name>
<halign>left</halign>
<row>3</row>
<col>2</col><colspan>2</colspan>
<pref-width>400</pref-width>
<property>/sim/terrasync/scenery-dir</property>
<enable>
<property>/sim/terrasync/enabled</property>
</enable>
<binding>
<command>dialog-apply</command>
<object-name>scenery-dir</object-name>
</binding>
</input>
<text>
<row>4</row>
<col>2</col><colspan>3</colspan>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
<halign>left</halign>
<label>Remember to add target directory to your 'fg-scenery' path list.</label>
</text>
<text>
<halign>right</halign>
<row>5</row><col>1</col>
<label>Remote scenery server:</label>
</text>
<input>
<name>svn-server</name>
<halign>left</halign>
<row>5</row>
<col>2</col><colspan>2</colspan>
<pref-width>400</pref-width>
<property>/sim/terrasync/svn-server</property>
<enable>
<!-- display only, editing disabled for now, since there is no reason
to change/switch between servers for now -->
<false/>
<!--property>/sim/terrasync/enabled</property-->
</enable>
<!--binding>
<command>dialog-apply</command>
<object-name>svn-server</object-name>
</binding-->
</input>
<checkbox>
<name>scenery-refresh</name>
<halign>left</halign>
<row>6</row><col>1</col><colspan>2</colspan>
<property>/sim/terrasync/refresh-display</property>
<enable>
<property>/sim/terrasync/enabled</property>
</enable>
<label>Automatic display refresh (EXPERIMENTAL!)</label>
<live>true</live>
<binding>
<command>dialog-apply</command>
<object-name>scenery-refresh</object-name>
</binding>
</checkbox>
<button>
<legend>Manual Refresh</legend>
<border>2</border>
<row>6</row><col>3</col>
<binding>
<command>reinit</command>
<subsystem>tile-manager</subsystem>
</binding>
</button>
<!--
<checkbox>
<name>internal-svn</name>
<halign>left</halign>
<row>7</row><col>1</col><colspan>3</colspan>
<property>/sim/terrasync/use-built-in-svn</property>
<label>Download using built-in SVN client</label>
<live>true</live>
<binding>
<command>dialog-apply</command>
<object-name>internal-svn</object-name>
</binding>
<enable>
<and>
<property>/sim/terrasync/built-in-svn-available</property>
<property>/sim/terrasync/enabled</property>
</and>
</enable>
</checkbox>
-->
</group>
<hrule/>
<group>
<layout>table</layout>
<halign>left</halign>
<equal>false</equal>
<text>
<row>0</row>
<col>1</col>
<halign>left</halign>
<pref-width>90</pref-width>
<label>Status:</label>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<halign>left</halign>
<row>0</row>
<col>2</col>
<label>Active:</label>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<row>0</row>
<col>3</col>
<pref-width>90</pref-width>
<halign>left</halign>
<stretch>true</stretch>
<format>%s</format>
<property>/sim/terrasync/active</property>
<live>true</live>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<halign>left</halign>
<row>0</row>
<col>4</col>
<label>Errors:</label>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<row>0</row>
<col>5</col>
<format>%s</format>
<property>/sim/terrasync/error-count</property>
<live>true</live>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<halign>left</halign>
<row>1</row>
<col>2</col>
<label>Sync in progress:</label>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<row>1</row>
<col>3</col>
<halign>left</halign>
<stretch>true</stretch>
<format>%s</format>
<property>/sim/terrasync/busy</property>
<live>true</live>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<halign>left</halign>
<row>2</row>
<col>2</col>
<label>Stalled:</label>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<row>2</row>
<col>3</col>
<halign>left</halign>
<stretch>true</stretch>
<format>%s</format>
<property>/sim/terrasync/stalled</property>
<live>true</live>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<halign>left</halign>
<row>3</row>
<col>2</col>
<label>Built-in SVN available:</label>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<row>3</row>
<col>3</col>
<halign>left</halign>
<stretch>true</stretch>
<format>%s</format>
<property>/sim/terrasync/built-in-svn-available</property>
<live>true</live>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<halign>left</halign>
<row>1</row>
<col>4</col>
<label>Processed elements:</label>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<row>1</row>
<col>5</col>
<format>%s</format>
<property>/sim/terrasync/update-count</property>
<live>true</live>
<stretch>true</stretch>
<halign>fill</halign>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<halign>left</halign>
<row>2</row>
<col>4</col>
<label>Processed scenery tiles:</label>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
<text>
<row>2</row>
<col>5</col>
<format>%s</format>
<property>/sim/terrasync/tile-count</property>
<live>true</live>
<stretch>true</stretch>
<halign>fill</halign>
<color>
<red>0.7</red>
<green>0.7</green>
<blue>0.7</blue>
<alpha>1</alpha>
</color>
</text>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<default-padding>10</default-padding>
<empty><stretch>true</stretch></empty>
<button>
<legend>OK</legend>
<border>2</border>
<equal>true</equal>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>reinit</command>
<subsystem>terrasync</subsystem>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<legend>Apply</legend>
<equal>true</equal>
<border>2</border>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>reinit</command>
<subsystem>terrasync</subsystem>
</binding>
</button>
<button>
<legend>Cancel</legend>
<border>2</border>
<equal>true</equal>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
<empty><stretch>true</stretch></empty>
</group>
</PropertyList>

View file

@ -173,7 +173,6 @@
<button>
<legend>Clock Time</legend>
<equal>true</equal>
<key>0</key>
<binding>
<command>timeofday</command>
<timeofday>real</timeofday>
@ -183,7 +182,6 @@
<button>
<legend>Dawn</legend>
<equal>true</equal>
<key>1</key>
<binding>
<command>timeofday</command>
<timeofday>dawn</timeofday>
@ -193,7 +191,6 @@
<button>
<legend>Morning</legend>
<equal>true</equal>
<key>2</key>
<binding>
<command>timeofday</command>
<timeofday>morning</timeofday>
@ -203,7 +200,6 @@
<button>
<legend>Noon</legend>
<equal>true</equal>
<key>3</key>
<binding>
<command>timeofday</command>
<timeofday>noon</timeofday>
@ -213,7 +209,6 @@
<button>
<legend>Afternoon</legend>
<equal>true</equal>
<key>4</key>
<binding>
<command>timeofday</command>
<timeofday>afternoon</timeofday>
@ -223,7 +218,6 @@
<button>
<legend>Dusk</legend>
<equal>true</equal>
<key>5</key>
<binding>
<command>timeofday</command>
<timeofday>dusk</timeofday>
@ -233,7 +227,6 @@
<button>
<legend>Evening</legend>
<equal>true</equal>
<key>6</key>
<binding>
<command>timeofday</command>
<timeofday>evening</timeofday>
@ -243,7 +236,6 @@
<button>
<legend>Night</legend>
<equal>true</equal>
<key>7</key>
<binding>
<command>timeofday</command>
<timeofday>midnight</timeofday>

View file

@ -44,30 +44,31 @@
foreach (var v; view.views) {
var index = v.getIndex();
var enabled = v.initNode("enabled", 1, "BOOL");
if (index >= 200) {
if (mode != 2) {
mode = 2;
group.getChild("hrule", 1, 1);
var t = group.getChild("text", 1, 1);
t.getNode("label", 1).setValue("Other Views");
}
} elsif (index >= 100) {
aircraft.data.add(enabled);
if (mode != 1) {
mode = 1;
group.getChild("hrule", 0, 1);
var t = group.getChild("text", 0, 1);
t.getNode("label", 1).setValue("\"" ~ ac ~ "\" Specific Views");
}
}
var target = group.getChild("checkbox", index, 1);
props.copy(group.getNode("checkbox-template"), target);
var name = v.getNode("name");
target.getNode("label").setValue(name != nil ? name.getValue() : ("** unnamed view " ~ index ~ " **"));
target.getNode("property").setValue(enabled.getPath());
if (name != nil) {
if (index >= 200) {
if (mode != 2) {
mode = 2;
group.getChild("hrule", 1, 1);
var t = group.getChild("text", 1, 1);
t.getNode("label", 1).setValue("Other Views");
}
} elsif (index >= 100) {
aircraft.data.add(enabled);
if (mode != 1) {
mode = 1;
group.getChild("hrule", 0, 1);
var t = group.getChild("text", 0, 1);
t.getNode("label", 1).setValue("\"" ~ ac ~ "\" Specific Views");
}
}
var target = group.getChild("checkbox", index, 1);
props.copy(group.getNode("checkbox-template"), target);
target.getNode("label").setValue(name != nil ? name.getValue() : ("** unnamed view " ~ index ~ " **"));
target.getNode("property").setValue(enabled.getPath());
}
}
</open>
</nasal>

View file

@ -1752,7 +1752,6 @@
</textbox>
<button>
<legend>Apply</legend>
<key>Esc</key>
<pref-width>50</pref-width>
<pref-height>50</pref-height>
<border>2</border>

View file

@ -329,7 +329,8 @@
<item>
<label>Local Weather</label>
<name>local_weather</name>
<name>local_weather_tiles</name>
<enabled>false</enabled>
<binding>
<command>dialog-show</command>
<dialog-name>local_weather_tiles</dialog-name>
@ -361,6 +362,14 @@
</binding>
</item>
<item>
<label>Scenery Download</label>
<binding>
<command>dialog-show</command>
<dialog-name>terrasync</dialog-name>
</binding>
</item>
</menu>
<menu>
@ -495,6 +504,17 @@
</binding>
</item>
<item>
<label>Jetway Settings</label>
<!-- <binding>
<command>nasal</command>
<script>jetways.jetways.dialog()</script>
</binding>-->
<binding>
<command>dialog-show</command>
<dialog-name>jetways</dialog-name>
</binding>
</item>
</menu>
@ -503,6 +523,14 @@
<label>Multiplayer</label>
<name>multiplayer</name>
<item>
<label>Multiplayer settings</label>
<binding>
<command>dialog-show</command>
<dialog-name>multiplayer</dialog-name>
</binding>
</item>
<item>
<label>Chat Dialog</label>
<binding>
@ -595,14 +623,6 @@
</binding>
</item>
<item>
<label>Reload Scenery</label>
<binding>
<command>reinit</command>
<subsystem>tile-manager</subsystem>
</binding>
</item>
<item>
<label>Nasal Console</label>
<binding>
@ -631,7 +651,10 @@
<label>Display Tutorial Marker</label>
<binding>
<command>nasal</command>
<script>tutorial.dialog()</script>
<script>
setprop("/nasal/tutorial/enabled",1); # load module on demand
tutorial.dialog();
</script>
</binding>
</item>
@ -687,6 +710,7 @@
<item>
<label>Local Weather (Test)</label>
<name>local_weather</name>
<enabled>false</enabled>
<binding>
<command>dialog-show</command>
<dialog-name>local_weather</dialog-name>

View file

@ -1177,7 +1177,6 @@ Shared parameters for various materials.
<name>GrassCover</name>
<name>BareTundraCover</name>
<name>MixedTundraCover</name>
<name>GolfCourse</name>
<name>Cemetery</name>
<effect>Effects/landmass</effect>
<texture>Terrain/tundra.png</texture>
@ -1439,7 +1438,6 @@ Shared parameters for various materials.
<effect>Effects/crop</effect>
<name>DryCropPastureCover</name>
<name>DryCrop</name>
<name>NaturalCrop</name>
<texture>Terrain/drycrop1.png</texture>
<texture>Terrain/drycrop2.png</texture>
<texture>Terrain/drycrop3.png</texture>
@ -1496,6 +1494,33 @@ Shared parameters for various materials.
<tree-width-m>12.0</tree-width-m>
</material>
<material>
<condition>
<equals>
<property>sim/startup/season</property>
<value>summer</value>
</equals>
</condition>
<name>NaturalCrop</name>
<texture>Terrain/naturalcrop1.png</texture>
<xsize>2000</xsize>
<ysize>2000</ysize>
<solid>1</solid>
<friction-factor>0.9</friction-factor>
<rolling-friction>0.1</rolling-friction>
<bumpiness>0.6</bumpiness>
<load-resistance>1e30</load-resistance>
<light-coverage>2000000.0</light-coverage>
<wood-coverage>500000.0</wood-coverage>
<wood-size>20000.0</wood-size>
<tree-density>5000.0</tree-density>
<tree-texture>Textures/Trees/mixed-summer.png</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
<tree-height-m>20.0</tree-height-m>
<tree-width-m>12.0</tree-width-m>
</material>
<material>
<condition>
<equals>
@ -1539,6 +1564,44 @@ Shared parameters for various materials.
<tree-width-m>12.0</tree-width-m>
</material>
<material>
<condition>
<equals>
<property>sim/startup/season</property>
<value>summer</value>
</equals>
</condition>
<name>GolfCourse</name>
<texture>Terrain/golfcourse1.png</texture>
<xsize>2000</xsize>
<ysize>2000</ysize>
<light-coverage>2000000.0</light-coverage>
<diffuse>
<r>0.93</r>
<g>0.95</g>
<b>0.93</b>
<a>1.0</a>
</diffuse>
<specular>
<r>0.1</r>
<g>0.12</g>
<b>0.1</b>
<a>1.0</a>
</specular>
<shininess>1.2</shininess>
<solid>1</solid>
<friction-factor>0.7</friction-factor>
<rolling-friction>0.1</rolling-friction>
<bumpiness>0.3</bumpiness>
<load-resistance>1e30</load-resistance>
<wood-coverage>500000.0</wood-coverage>
<tree-texture>Textures/Trees/mixed-summer.png</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
<tree-height-m>20.0</tree-height-m>
<tree-width-m>12.0</tree-width-m>
</material>
<material>
<condition>
<equals>
@ -2297,7 +2360,6 @@ Shared parameters for various materials.
</condition>
<name>DryCropPastureCover</name>
<name>DryCrop</name>
<name>NaturalCrop</name>
<texture>Terrain.winter/drycrop1.png</texture>
<texture>Terrain.winter/drycrop2.png</texture>
<texture>Terrain.winter/drycrop3.png</texture>
@ -2354,6 +2416,33 @@ Shared parameters for various materials.
<tree-width-m>12.0</tree-width-m>
</material>
<material>
<condition>
<equals>
<property>sim/startup/season</property>
<value>winter</value>
</equals>
</condition>
<name>NaturalCrop</name>
<texture>Terrain.winter/naturalcrop1.png</texture>
<xsize>2000</xsize>
<ysize>2000</ysize>
<solid>1</solid>
<friction-factor>0.9</friction-factor>
<rolling-friction>0.1</rolling-friction>
<bumpiness>0.6</bumpiness>
<load-resistance>1e30</load-resistance>
<light-coverage>2000000.0</light-coverage>
<wood-coverage>150000.0</wood-coverage>
<wood-size>10000.0</wood-size>
<tree-density>5000.0</tree-density>
<tree-texture>Textures/Trees/mixed-winter.png</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
<tree-height-m>20.0</tree-height-m>
<tree-width-m>12.0</tree-width-m>
</material>
<material>
<condition>
<equals>
@ -2398,6 +2487,46 @@ Shared parameters for various materials.
<tree-width-m>12.0</tree-width-m>
</material>
<material>
<condition>
<equals>
<property>sim/startup/season</property>
<value>winter</value>
</equals>
</condition>
<name>GolfCourse</name>
<texture>Terrain.winter/golfcourse.png</texture>
<xsize>2000</xsize>
<ysize>2000</ysize>
<light-coverage>2000000.0</light-coverage>
<diffuse>
<r>0.93</r>
<g>0.95</g>
<b>0.93</b>
<a>1.0</a>
</diffuse>
<specular>
<r>0.1</r>
<g>0.12</g>
<b>0.1</b>
<a>1.0</a>
</specular>
<shininess>1.2</shininess>
<solid>1</solid>
<friction-factor>0.7</friction-factor>
<rolling-friction>0.1</rolling-friction>
<bumpiness>0.3</bumpiness>
<load-resistance>1e30</load-resistance>
<wood-coverage>150000.0</wood-coverage>
<wood-size>10000.0</wood-size>
<tree-density>5000.0</tree-density>
<tree-texture>Textures/Trees/mixed-winter.png</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
<tree-height-m>20.0</tree-height-m>
<tree-width-m>12.0</tree-width-m>
</material>
<material>
<condition>
<equals>

View file

@ -78,11 +78,11 @@
</option>
<option>
<name>fg-aircraft</name>
<arg>path</arg>
<description>strings/fg-aircraft-desc</description>
<brief/>
</option>
<name>fg-aircraft</name>
<arg>path</arg>
<description>strings/fg-aircraft-desc</description>
<brief/>
</option>
<option>
<name>language</name>
@ -232,6 +232,11 @@
<description>strings/enable-ai-traffic-desc</description>
</option>
<option>
<name>disable-ai-scenarios</name>
<description>strings/disable-ai-scenarios</description>
</option>
<option>
<name>ai-scenario</name>
<arg>scenario</arg>
@ -978,6 +983,21 @@
<description>strings/jpg-httpd-desc</description>
</option>
<option>
<name>disable-terrasync</name>
<description>strings/disable-terrasync-desc</description>
</option>
<option>
<name>enable-terrasync</name>
<description>strings/enable-terrasync-desc</description>
</option>
<option>
<name>terrasync-dir</name>
<description>strings/terrasync-dir-desc</description>
</option>
</section>
<section>

View file

@ -39,29 +39,29 @@ Started September 2000 by David Megginson, david@megginson.com
<intl include="Translations/locale.xml"/>
<aircraft>c172p</aircraft>
<virtual-cockpit type="bool">false</virtual-cockpit>
<presets>
<presets preserve="y">
<airport-id>KSFO</airport-id>
<runway></runway>
<trim type="bool">true</trim>
</presets>
<startup>
<xsize type="int">800</xsize>
<ysize type="int">600</ysize>
<xsize type="int" preserve="y">800</xsize>
<ysize type="int" preserve="y">600</ysize>
<splash-screen type="bool">true</splash-screen>
<splash-progress type="bool">true</splash-progress>
<splash-title>
<!-- -->
</splash-title>
<intro-music type="bool">false</intro-music>
<game-mode type="bool">false</game-mode>
<fullscreen type="bool">false</fullscreen>
<game-mode type="bool" preserve="y">false</game-mode>
<fullscreen type="bool" preserve="y">false</fullscreen>
<units>feet</units>
<save-on-exit type="bool"
userarchive="y">true</save-on-exit>
<browser-app write="n">firefox -new-tab "%u"</browser-app>
<!-- help viewer; only used under Unix -->
<terminal-ansi-colors type="bool">true</terminal-ansi-colors>
<season type="string">summer</season>
<season type="string" preserve="y">summer</season>
</startup>
<rendering>
<debug type="bool">false</debug>
@ -655,7 +655,7 @@ Started September 2000 by David Megginson, david@megginson.com
</autovisibility>
</menubar>
<gui>
<gui preserve="y">
<current-style type="int"
userarchive="y">1</current-style>
<style n="0"
@ -722,7 +722,7 @@ Started September 2000 by David Megginson, david@megginson.com
</ai>
<multiplay>
<chat type="string">Hello</chat>
<chat type="string" preserve="y">Hello</chat>
<transmission-freq-hz type="string">118500000</transmission-freq-hz>
<chat-display type="bool"
userarchive="y">true</chat-display>
@ -732,7 +732,7 @@ Started September 2000 by David Megginson, david@megginson.com
</multiplay>
<user>
<callsign type="string">Golf Foxtrot Sierra</callsign>
<callsign type="string" preserve="y">Golf Foxtrot Sierra</callsign>
</user>
<timing-statistics>
@ -748,15 +748,26 @@ Started September 2000 by David Megginson, david@megginson.com
<!-- animated jetway options -->
<jetways>
<enabled type="bool" archive="y">false</enabled> <!-- disabled due to FPS impact -->
<enable-editor type="bool" archive="y">false</enable-editor>
<interact-with-multiplay type="bool" archive="y">true</interact-with-multiplay>
<debug type="bool" archive="y">false</debug>
<enable-editor type="bool">false</enable-editor>
<interact-with-multiplay type="bool" userarchive="y">true</interact-with-multiplay>
<debug type="bool">false</debug>
</jetways>
<terrasync preserve="y">
<enabled type="bool" userarchive="y">false</enabled>
<use-built-in-svn type="bool" userarchive="y">true</use-built-in-svn>
<refresh-display type="bool" userarchive="y">false</refresh-display>
<use-svn type="bool" userarchive="n">true</use-svn>
<svn-server userarchive="y">http://terrascenery.googlecode.com/svn/trunk/data/Scenery</svn-server>
<rsync-server userarchive="n">scenery.flightgear.org::Scenery</rsync-server>
<scenery-dir userarchive="y"><!-- INTENTIONALLY LEFT BLANK! Do NOT edit.
This (empty) value is the initial/default value only. Actual data is stored/read from
$HOME/.fgfs/autosave.xml. Use command-line option "terrasync-dir", GUI-dialog, or
property browser to configure actual directory. --></scenery-dir>
<ext-svn-utility type="string">svn</ext-svn-utility> <!-- use absolute path if "svn"
isn't on system PATH (external SVN only)-->
</terrasync>
</sim>
<!-- mouse mode -->
<devices>
<status>
@ -1233,6 +1244,15 @@ Started September 2000 by David Megginson, david@megginson.com
<atc-chatter>
<enabled type="bool" userarchive="n">false</enabled>
</atc-chatter>
<local_weather>
<enabled type="bool" userarchive="y">false</enabled>
</local_weather>
<jetways>
<enabled type="bool" userarchive="y">false</enabled>
</jetways>
<jetways_edit>
<enabled type="bool" userarchive="n">false</enabled>
</jetways_edit>
</nasal>
</PropertyList>