flightgear-addon-vfrnavigator/addon-main.nas

30 lines
874 B
Plaintext
Raw Normal View History

#
# VFR Navigator addon
#
# Slawek Mikula, August 2018
var main = func( addon ) {
var root = addon.basePath;
var my_addon_id = addon.id;
var my_settings_root_path = "/addons/by-id/" ~ my_addon_id ~ "/addon-devel/";
# persistent save of enable flag
props.globals.getNode(my_settings_root_path ~ "/showvfrstarter", 1).setAttribute("userarchive", "y");
var fdm_init_listener = _setlistener("/sim/signals/fdm-initialized", func {
removelistener(fdm_init_listener);
if (getprop(my_settings_root_path ~ "/showvfrstarter") == 1) {
gui.showDialog("vfrstarter");
}
});
var reinit_listener = _setlistener("/sim/signals/reinit", func {
removelistener(reinit_listener);
if (getprop(my_settings_root_path ~ "/showvfrstarter") == 1) {
gui.showDialog("vfrstarter");
}
});
}