Merge branch 'master' of gitorious.org:fg/fgdata
This commit is contained in:
commit
b8090f16cf
9 changed files with 2403 additions and 60 deletions
1947
Aircraft/Instruments-3d/chronometer/chronometer.ac
Normal file
1947
Aircraft/Instruments-3d/chronometer/chronometer.ac
Normal file
File diff suppressed because it is too large
Load diff
BIN
Aircraft/Instruments-3d/chronometer/chronometer.png
Normal file
BIN
Aircraft/Instruments-3d/chronometer/chronometer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
344
Aircraft/Instruments-3d/chronometer/chronometer.xml
Normal file
344
Aircraft/Instruments-3d/chronometer/chronometer.xml
Normal file
|
@ -0,0 +1,344 @@
|
|||
<!--
|
||||
Boeing style chronometer, by Syd Adams
|
||||
-->
|
||||
|
||||
<PropertyList>
|
||||
|
||||
<path>chronometer.ac</path>
|
||||
|
||||
<animation>
|
||||
<type>rotate</type>
|
||||
<object-name>Chrono.needle</object-name>
|
||||
<property>instrumentation/clock/ET-sec</property>
|
||||
<factor>6</factor>
|
||||
<center>
|
||||
<x-m>0.0</x-m>
|
||||
<y-m>0</y-m>
|
||||
<z-m>0.0</z-m>
|
||||
</center>
|
||||
<axis>
|
||||
<x>-1</x>
|
||||
<y>0</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>rotate</type>
|
||||
<object-name>ET.switch</object-name>
|
||||
<property>instrumentation/clock/et-knob</property>
|
||||
<interpolation>
|
||||
<entry><ind>-1</ind><dep>-144</dep></entry>
|
||||
<entry><ind>0</ind><dep>0</dep></entry>
|
||||
<entry><ind>1</ind><dep>35</dep></entry>
|
||||
</interpolation>
|
||||
<center>
|
||||
<x-m>0</x-m>
|
||||
<y-m>-0.032</y-m>
|
||||
<z-m>-0.033</z-m>
|
||||
</center>
|
||||
<axis>
|
||||
<x>-1</x>
|
||||
<y>0</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>rotate</type>
|
||||
<object-name>SET.switch</object-name>
|
||||
<property>instrumentation/clock/set-knob</property>
|
||||
<interpolation>
|
||||
<entry><ind>0</ind><dep>0</dep></entry>
|
||||
<entry><ind>1</ind><dep>30</dep></entry>
|
||||
<entry><ind>2</ind><dep>60</dep></entry>
|
||||
<entry><ind>3</ind><dep>90</dep></entry>
|
||||
</interpolation>
|
||||
<center>
|
||||
<x-m>0</x-m>
|
||||
<y-m>0.029</y-m>
|
||||
<z-m>-0.033</z-m>
|
||||
</center>
|
||||
<axis>
|
||||
<x>-1</x>
|
||||
<y>0</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>rotate</type>
|
||||
<object-name>UTC.switch</object-name>
|
||||
<property>instrumentation/clock/time-knob</property>
|
||||
<interpolation>
|
||||
<entry><ind>-1</ind><dep>-135</dep></entry>
|
||||
<entry><ind>0</ind><dep>0</dep></entry>
|
||||
<entry><ind>1</ind><dep>35</dep></entry>
|
||||
</interpolation>
|
||||
<center>
|
||||
<x-m>0</x-m>
|
||||
<y-m>0.032</y-m>
|
||||
<z-m>0.034</z-m>
|
||||
</center>
|
||||
<axis>
|
||||
<x>-1</x>
|
||||
<y>0</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<!-- Digital displays -->
|
||||
|
||||
<animation>
|
||||
<type>textranslate</type>
|
||||
<object-name>Hr.10</object-name>
|
||||
<property>instrumentation/clock/indicated-hour</property>
|
||||
<factor>0.01</factor>
|
||||
<step>10</step>
|
||||
<axis>
|
||||
<x>0</x>
|
||||
<y>1</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>textranslate</type>
|
||||
<object-name>Hr.01</object-name>
|
||||
<property>instrumentation/clock/indicated-hour</property>
|
||||
<factor>0.1</factor>
|
||||
<step>1</step>
|
||||
<axis>
|
||||
<x>0</x>
|
||||
<y>1</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>textranslate</type>
|
||||
<object-name>Mn.10</object-name>
|
||||
<property>instrumentation/clock/indicated-min</property>
|
||||
<factor>0.01</factor>
|
||||
<step>10</step>
|
||||
<axis>
|
||||
<x>0</x>
|
||||
<y>1</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>textranslate</type>
|
||||
<object-name>Mn.01</object-name>
|
||||
<property>instrumentation/clock/indicated-min</property>
|
||||
<factor>0.1</factor>
|
||||
<step>1</step>
|
||||
<axis>
|
||||
<x>0</x>
|
||||
<y>1</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>textranslate</type>
|
||||
<object-name>ET10</object-name>
|
||||
<property>instrumentation/clock/ET-display</property>
|
||||
<factor>0.0001</factor>
|
||||
<step>1000</step>
|
||||
<axis>
|
||||
<x>0</x>
|
||||
<y>1</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>textranslate</type>
|
||||
<object-name>ET01</object-name>
|
||||
<property>instrumentation/clock/ET-display</property>
|
||||
<factor>0.001</factor>
|
||||
<step>100</step>
|
||||
<axis>
|
||||
<x>0</x>
|
||||
<y>1</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>textranslate</type>
|
||||
<object-name>ET.10</object-name>
|
||||
<property>instrumentation/clock/ET-display</property>
|
||||
<factor>0.01</factor>
|
||||
<step>10</step>
|
||||
<axis>
|
||||
<x>0</x>
|
||||
<y>1</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>textranslate</type>
|
||||
<object-name>ET.01</object-name>
|
||||
<property>instrumentation/clock/ET-display</property>
|
||||
<factor>0.1</factor>
|
||||
<step>1</step>
|
||||
<axis>
|
||||
<x>0</x>
|
||||
<y>1</y>
|
||||
<z>0</z>
|
||||
</axis>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>ET10</object-name>
|
||||
<object-name>ET01</object-name>
|
||||
<condition>
|
||||
<greater-than>
|
||||
<property>instrumentation/clock/ET-display</property>
|
||||
<value>99.99</value>
|
||||
</greater-than>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<!-- Hotspots -->
|
||||
|
||||
<hotspot-action-script>
|
||||
if (!contains(aircraft, "boeing_chronometer"))
|
||||
{
|
||||
aircraft.boeing_chronometer = aircraft.timer.new("/instrumentation/clock/ET-sec", 1);
|
||||
aircraft.boeing_chronometer.stop();
|
||||
props.globals.initNode("/instrumentation/clock/ET-display",0,"INT");
|
||||
props.globals.initNode("/instrumentation/clock/time-display",0,"INT");
|
||||
props.globals.initNode("/instrumentation/clock/time-knob",0,"INT");
|
||||
props.globals.initNode("/instrumentation/clock/et-knob",0,"INT");
|
||||
props.globals.initNode("/instrumentation/clock/set-knob",0,"INT");
|
||||
print("Boeing chronometer ... initialized");
|
||||
}
|
||||
|
||||
var tmp = props.globals.getNode("/instrumentation/clock/et-knob").getValue();
|
||||
if (tmp == -1)
|
||||
{
|
||||
aircraft.boeing_chronometer.reset();
|
||||
}
|
||||
elsif (tmp == 0)
|
||||
{
|
||||
aircraft.boeing_chronometer.stop();
|
||||
}
|
||||
elsif (tmp == 1)
|
||||
{
|
||||
aircraft.boeing_chronometer.start();
|
||||
}
|
||||
</hotspot-action-script>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>ET.run</object-name>
|
||||
<action>
|
||||
<button>0</button>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>instrumentation/clock/et-knob</property>
|
||||
<value>1</value>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script alias="../../../../hotspot-action-script" />
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>ET.hld</object-name>
|
||||
<action>
|
||||
<button>0</button>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>instrumentation/clock/et-knob</property>
|
||||
<value>0</value>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script alias="../../../../hotspot-action-script" />
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>ET.reset</object-name>
|
||||
<action>
|
||||
<button>0</button>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>instrumentation/clock/et-knob</property>
|
||||
<value>-1</value>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script alias="../../../../hotspot-action-script" />
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>instrumentation/clock/et-knob</property>
|
||||
<value>0</value>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script alias="../../../../../hotspot-action-script" />
|
||||
</binding>
|
||||
</mod-up>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>ET.switch</object-name>
|
||||
<action>
|
||||
<button>0</button>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>property-toggle</command>
|
||||
<property>instrumentation/clock/et-knob</property>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script alias="../../../../hotspot-action-script" />
|
||||
</binding>
|
||||
</action>
|
||||
<action>
|
||||
<button>1</button>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>instrumentation/clock/et-knob</property>
|
||||
<value>-1</value>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script alias="../../../../hotspot-action-script" />
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>instrumentation/clock/et-knob</property>
|
||||
<value>0</value>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script alias="../../../../../hotspot-action-script" />
|
||||
</binding>
|
||||
</mod-up>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
</PropertyList>
|
|
@ -11,24 +11,25 @@
|
|||
# Global shared variables
|
||||
#############################################################################
|
||||
|
||||
fg_root = "";
|
||||
chatter = "UK";
|
||||
chatter_dir = "";
|
||||
var fg_root = nil;
|
||||
var chatter = "UK";
|
||||
var chatter_dir = "";
|
||||
|
||||
chatter_min_interval = 20.0;
|
||||
chatter_max_interval = 40.0;
|
||||
var chatter_min_interval = 20.0;
|
||||
var chatter_max_interval = 40.0;
|
||||
var next_interval = nil;
|
||||
|
||||
chatter_index = 0;
|
||||
chatter_size = 0;
|
||||
chatter_list = 0;
|
||||
var chatter_index = 0;
|
||||
var chatter_size = 0;
|
||||
var chatter_list = 0;
|
||||
|
||||
|
||||
#############################################################################
|
||||
# Use tha nasal timer to call the initialization function once the sim is
|
||||
# up and running
|
||||
# Chatter is initialized only when actually enabled. See listener connected
|
||||
# to /sim/sound/chatter/enabled.
|
||||
#############################################################################
|
||||
|
||||
CHATTER_INIT = func {
|
||||
var chatter_init = func {
|
||||
# default values
|
||||
fg_root = getprop("/sim/fg-root");
|
||||
chatter_dir = sprintf("%s/ATC/Chatter/%s", fg_root, chatter);
|
||||
|
@ -39,14 +40,13 @@ CHATTER_INIT = func {
|
|||
srand();
|
||||
chatter_index = int( chatter_size * rand() );
|
||||
}
|
||||
settimer(CHATTER_INIT, 0);
|
||||
|
||||
|
||||
#############################################################################
|
||||
# main update function to be called each frame
|
||||
#############################################################################
|
||||
|
||||
chatter_update = func {
|
||||
var chatter_update = func {
|
||||
if ( chatter_index >= chatter_size ) {
|
||||
chatter_index = 0;
|
||||
}
|
||||
|
@ -73,15 +73,43 @@ chatter_update = func {
|
|||
|
||||
|
||||
#############################################################################
|
||||
# Use tha nasal timer to update every 10 seconds
|
||||
# Use the nasal timer to update every 10 seconds
|
||||
#############################################################################
|
||||
|
||||
nextChatter = func {
|
||||
var nextChatter = func {
|
||||
if (!getprop("/sim/sound/chatter/enabled"))
|
||||
{
|
||||
next_interval = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
# schedule next message in next min-max interval seconds so we have a bit
|
||||
# of a random pacing
|
||||
next_interval = chatter_min_interval
|
||||
+ int(rand() * (chatter_max_interval - chatter_min_interval));
|
||||
|
||||
# printlog("info", "next chatter in ", next_interval, " seconds");
|
||||
|
||||
settimer(chatter_update, next_interval );
|
||||
}
|
||||
|
||||
#############################################################################
|
||||
# Start chatter processing. Also connected to chatter/enabled property as a
|
||||
# listener.
|
||||
#############################################################################
|
||||
|
||||
var startChatter = func {
|
||||
if ( getprop("/sim/sound/chatter/enabled") ) {
|
||||
if (fg_root == nil)
|
||||
chatter_init();
|
||||
if (next_interval == nil)
|
||||
nextChatter();
|
||||
}
|
||||
}
|
||||
|
||||
# connect listener
|
||||
setlistener("/sim/sound/chatter/enabled", startChatter);
|
||||
|
||||
# start chatter immediately, if enable is already set.
|
||||
settimer(startChatter, 0);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ var update = func {
|
|||
|
||||
var selected_tanks = [];
|
||||
foreach (var t; tanks) {
|
||||
var cap = t.getNode("capacity-gal_us").getValue();
|
||||
var cap = t.getNode("capacity-gal_us",0).getValue();
|
||||
if (cap > 0.01 and t.getNode("selected").getBoolValue())
|
||||
append(selected_tanks, t);
|
||||
}
|
||||
|
|
|
@ -685,7 +685,7 @@ var setWeight = func(wgt, opt) {
|
|||
# Weights can have "tank" indices which set the capacity of the
|
||||
# corresponding tank. This code should probably be moved to
|
||||
# something like fuel.setTankCap(tank, gals)...
|
||||
if(wgt.getNode("tank") == nil) { return 0; }
|
||||
if(wgt.getNode("tank",0) == nil) { return 0; }
|
||||
var ti = wgt.getNode("tank").getValue();
|
||||
var gn = opt.getNode("gals");
|
||||
var gals = gn == nil ? 0 : gn.getValue();
|
||||
|
@ -886,10 +886,11 @@ var showWeightDialog = func {
|
|||
|
||||
var tankprop = "/consumables/fuel/tank["~i~"]";
|
||||
|
||||
var cap = t.getNode("capacity-gal_us", 1).getValue();
|
||||
var cap = t.getNode("capacity-gal_us", 0);
|
||||
|
||||
# Hack, to ignore the "ghost" tanks created by the C++ code.
|
||||
if(cap == nil or cap < 1) { continue; }
|
||||
if(cap == nil ) { continue; }
|
||||
cap = cap.getValue();
|
||||
|
||||
var title = tcell(fuelTable, "text", i+1, 0);
|
||||
title.set("label", tname);
|
||||
|
|
|
@ -48,13 +48,13 @@
|
|||
# </animation>
|
||||
#
|
||||
|
||||
dialog = nil;
|
||||
var dialog = nil;
|
||||
|
||||
colorgroup = func {
|
||||
parent = arg[0]; # pui parent
|
||||
name = arg[1]; # "diffuse"
|
||||
base = arg[2];
|
||||
undef = func { props.globals.getNode(base ~ name ~ "/" ~ arg[0]) == nil };
|
||||
var colorgroup = func {
|
||||
var parent = arg[0]; # pui parent
|
||||
var name = arg[1]; # "diffuse"
|
||||
var base = arg[2];
|
||||
var undef = func { props.globals.getNode(base ~ name ~ "/" ~ arg[0]) == nil };
|
||||
|
||||
if (undef("red") and undef("green") and undef("blue")) {
|
||||
return 0;
|
||||
|
@ -64,11 +64,11 @@ colorgroup = func {
|
|||
parent.addChild("hrule").setColor(1, 1, 1, 0.5);
|
||||
}
|
||||
|
||||
grp = parent.addChild("group");
|
||||
var grp = parent.addChild("group");
|
||||
grp.set("layout", "vbox");
|
||||
grp.addChild("text").set("label", name);
|
||||
|
||||
foreach (color; ["red", "green", "blue", "factor"]) {
|
||||
foreach (var color; ["red", "green", "blue", "factor"]) {
|
||||
mat(parent, color, base ~ name ~ "/" ~ color, "%.3f");
|
||||
}
|
||||
mat(parent, "offset", base ~ name ~ "/" ~ "offset", "%.3f", -1.0, 1.0);
|
||||
|
@ -76,19 +76,19 @@ colorgroup = func {
|
|||
}
|
||||
|
||||
|
||||
mat = func {
|
||||
parent = arg[0];
|
||||
name = arg[1];
|
||||
path = arg[2];
|
||||
format = arg[3];
|
||||
var mat = func {
|
||||
var parent = arg[0];
|
||||
var name = arg[1];
|
||||
var path = arg[2];
|
||||
var format = arg[3];
|
||||
if (props.globals.getNode(path) != nil) {
|
||||
grp = parent.addChild("group");
|
||||
var grp = parent.addChild("group");
|
||||
grp.set("layout", "hbox");
|
||||
|
||||
grp.addChild("empty").set("stretch", 1);
|
||||
grp.addChild("text").set("label", name);
|
||||
|
||||
slider = grp.addChild("slider");
|
||||
var slider = grp.addChild("slider");
|
||||
slider.set("property", path);
|
||||
slider.set("live", 1);
|
||||
if (size(arg) == 6) {
|
||||
|
@ -97,7 +97,7 @@ mat = func {
|
|||
}
|
||||
slider.setBinding("dialog-apply");
|
||||
|
||||
number = grp.addChild("text");
|
||||
var number = grp.addChild("text");
|
||||
number.set("label", "-0.123");
|
||||
number.set("format", format);
|
||||
number.set("property", path);
|
||||
|
@ -107,13 +107,13 @@ mat = func {
|
|||
}
|
||||
|
||||
|
||||
showDialog = func {
|
||||
base = arg[0];
|
||||
var showDialog = func {
|
||||
var base = arg[0];
|
||||
while (size(base) and substr(base, size(base) - 1, 1) == "/") {
|
||||
base = substr(base, 0, size(base) - 1);
|
||||
}
|
||||
parentdir = "";
|
||||
b = base;
|
||||
var parentdir = "";
|
||||
var b = base;
|
||||
while (size(b)) {
|
||||
c = substr(b, size(b) - 1, 1);
|
||||
if (c == "/") { break }
|
||||
|
@ -121,8 +121,8 @@ showDialog = func {
|
|||
parentdir = c ~ parentdir;
|
||||
}
|
||||
|
||||
title = if (size(arg) > 1 and arg[1] != nil) { arg[1] } else { parentdir };
|
||||
name = "material-" ~ parentdir;
|
||||
var title = if (size(arg) > 1 and arg[1] != nil) { arg[1] } else { parentdir };
|
||||
var name = "material-" ~ parentdir;
|
||||
base = base ~ "/";
|
||||
|
||||
dialog = gui.Widget.new();
|
||||
|
@ -131,9 +131,9 @@ showDialog = func {
|
|||
if (size(arg) > 3 and arg[3] != nil) { dialog.set("y", arg[3]) }
|
||||
dialog.set("layout", "vbox");
|
||||
|
||||
titlebar = dialog.addChild("group");
|
||||
var titlebar = dialog.addChild("group");
|
||||
titlebar.set("layout", "hbox");
|
||||
w = titlebar.addChild("text");
|
||||
var w = titlebar.addChild("text");
|
||||
w.set("label", "object \"" ~ title ~ "\"");
|
||||
titlebar.addChild("empty").set("stretch", 1);
|
||||
|
||||
|
@ -146,13 +146,13 @@ showDialog = func {
|
|||
w.set("border", 1);
|
||||
w.setBinding("dialog-close");
|
||||
|
||||
h = 0;
|
||||
var h = 0;
|
||||
h += colorgroup(dialog, "diffuse", base, h);
|
||||
h += colorgroup(dialog, "ambient", base, h);
|
||||
h += colorgroup(dialog, "emission", base, h);
|
||||
h += colorgroup(dialog, "specular", base, h);
|
||||
|
||||
undef = func { props.globals.getNode(base ~ arg[0]) == nil };
|
||||
var undef = func { props.globals.getNode(base ~ arg[0]) == nil };
|
||||
if (!(undef("shininess") and undef("transparency/alpha") and undef("threshold"))) {
|
||||
if (h) {
|
||||
dialog.addChild("hrule").setColor(1, 1, 1, 0.5);
|
||||
|
|
|
@ -14,8 +14,11 @@ var is_active = func getprop("/sim/multiplay/txport") or getprop("/sim/multiplay
|
|||
|
||||
var lastmsg = {};
|
||||
var ignore = {};
|
||||
var msg_loop_id = 0;
|
||||
var msg_timeout = 0;
|
||||
|
||||
var check_messages = func {
|
||||
var check_messages = func(loop_id) {
|
||||
if (loop_id != msg_loop_id) return;
|
||||
foreach (var mp; values(model.callsign)) {
|
||||
var msg = mp.node.getNode("sim/multiplay/chat", 1).getValue();
|
||||
if (msg and msg != lastmsg[mp.callsign]) {
|
||||
|
@ -24,11 +27,9 @@ var check_messages = func {
|
|||
lastmsg[mp.callsign] = msg;
|
||||
}
|
||||
}
|
||||
settimer(check_messages, 3);
|
||||
settimer(func check_messages(loop_id), 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
var echo_message = func(callsign, msg) {
|
||||
msg = string.trim(string.replace(msg, "\n", " "));
|
||||
|
||||
|
@ -45,7 +46,32 @@ var echo_message = func(callsign, msg) {
|
|||
setprop("/sim/multiplay/chat-history", msg);
|
||||
}
|
||||
|
||||
var timeout_handler = func()
|
||||
{
|
||||
var t = props.globals.getNode("/sim/time/elapsed-sec").getValue();
|
||||
if (t >= msg_timeout)
|
||||
{
|
||||
msg_timeout = 0;
|
||||
setprop("/sim/multiplay/chat", "");
|
||||
}
|
||||
else
|
||||
settimer(timeout_handler, msg_timeout - t);
|
||||
}
|
||||
|
||||
var chat_listener = func(n)
|
||||
{
|
||||
var msg = n.getValue();
|
||||
if (msg)
|
||||
{
|
||||
# ensure we see our own messages.
|
||||
echo_message(getprop("/sim/multiplay/callsign"), msg);
|
||||
|
||||
# set expiry time
|
||||
if (msg_timeout == 0)
|
||||
settimer(timeout_handler, 10); # need new timer
|
||||
msg_timeout = 10 + props.globals.getNode("/sim/time/elapsed-sec").getValue();
|
||||
}
|
||||
}
|
||||
|
||||
settimer(func {
|
||||
if (is_active()) {
|
||||
|
@ -70,17 +96,14 @@ settimer(func {
|
|||
io.flush(f);
|
||||
});
|
||||
}
|
||||
check_messages();
|
||||
check_messages(msg_loop_id += 1);
|
||||
}
|
||||
|
||||
# Call-back to ensure we see our own messages.
|
||||
setlistener("/sim/multiplay/chat", func(n) {
|
||||
echo_message(getprop("/sim/multiplay/callsign"), n.getValue());
|
||||
});
|
||||
setlistener("/sim/multiplay/chat", chat_listener);
|
||||
}, 1);
|
||||
|
||||
|
||||
|
||||
# Message composition function, activated using the - key.
|
||||
var prefix = "Chat Message:";
|
||||
var input = "";
|
||||
|
@ -391,8 +414,6 @@ var dialog = {
|
|||
var model = {
|
||||
init: func {
|
||||
me.L = [];
|
||||
me.warned = {};
|
||||
me.fg_root = string.normpath(getprop("/sim/fg-root")) ~ '/';
|
||||
append(me.L, setlistener("ai/models/model-added", func(n) {
|
||||
# Defer update() to the next convenient time to allow the
|
||||
# new MP entry to become fully initialized.
|
||||
|
|
|
@ -137,9 +137,10 @@ _setlistener("/sim/signals/fdm-initialized",
|
|||
}, 1);
|
||||
|
||||
setlistener("/sim/rendering/headshake/enabled", func(n) {
|
||||
if ((running_compression == 0) and n.getBoolValue())
|
||||
if ((running_compression == 0) and (running_redout == 0) and n.getBoolValue())
|
||||
{
|
||||
running_compression = 1;
|
||||
# start new timer now
|
||||
run();
|
||||
}
|
||||
else
|
||||
|
@ -149,9 +150,10 @@ _setlistener("/sim/signals/fdm-initialized",
|
|||
}, 1);
|
||||
|
||||
setlistener("/sim/rendering/redout/enabled", func(n) {
|
||||
if ((running_redout == 0) and n.getBoolValue())
|
||||
if ((running_compression == 0) and (running_redout == 0) and n.getBoolValue())
|
||||
{
|
||||
running_redout = 1;
|
||||
# start new timer now
|
||||
run();
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue