Nasal: More code cleaning, change turn indicator interval
This commit is contained in:
parent
514e36871f
commit
5af48faf68
|
@ -12,7 +12,7 @@ var cur_alt = 0;
|
|||
var light_manager = {
|
||||
|
||||
run: 0,
|
||||
|
||||
|
||||
lat_to_m: 110952.0,
|
||||
lon_to_m: 0.0,
|
||||
|
||||
|
@ -35,7 +35,7 @@ var light_manager = {
|
|||
light2_size: 0.0,
|
||||
light2_stretch: 0.0,
|
||||
light2_is_on: 0,
|
||||
|
||||
|
||||
light3_xpos: 0.0,
|
||||
light3_ypos: 0.0,
|
||||
light3_zpos: 0.0,
|
||||
|
@ -45,7 +45,7 @@ var light_manager = {
|
|||
light3_size: 0.0,
|
||||
light3_stretch: 0.0,
|
||||
light3_is_on: 0,
|
||||
|
||||
|
||||
light4_xpos: 0.0,
|
||||
light4_ypos: 0.0,
|
||||
light4_zpos: 0.0,
|
||||
|
@ -55,7 +55,7 @@ var light_manager = {
|
|||
light4_size: 0.0,
|
||||
light4_stretch: 0.0,
|
||||
light4_is_on: 0,
|
||||
|
||||
|
||||
light5_xpos: 0.0,
|
||||
light5_ypos: 0.0,
|
||||
light5_zpos: 0.0,
|
||||
|
@ -65,10 +65,10 @@ var light_manager = {
|
|||
light5_size: 0.0,
|
||||
light5_stretch: 0.0,
|
||||
light5_is_on: 0,
|
||||
|
||||
|
||||
flcpt: 0,
|
||||
prev_view : 1,
|
||||
|
||||
|
||||
nd_ref_light1_x: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m", 1),
|
||||
nd_ref_light1_y: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m", 1),
|
||||
nd_ref_light1_z: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m", 1),
|
||||
|
@ -88,56 +88,56 @@ var light_manager = {
|
|||
nd_ref_light4_y: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[3]", 1),
|
||||
nd_ref_light4_z: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[3]", 1),
|
||||
nd_ref_light4_dir: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/dir[3]", 1),
|
||||
|
||||
|
||||
nd_ref_light5_x: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[4]", 1),
|
||||
nd_ref_light5_y: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[4]", 1),
|
||||
nd_ref_light5_z: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[4]", 1),
|
||||
nd_ref_light5_dir: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/dir[4]", 1),
|
||||
|
||||
|
||||
init: func {
|
||||
# define your lights here
|
||||
|
||||
# lights ########
|
||||
# offsets to aircraft center
|
||||
|
||||
|
||||
me.light1_xpos = 30.0;
|
||||
me.light1_ypos = 0.0;
|
||||
me.light1_zpos = 2.0;
|
||||
|
||||
|
||||
me.light2_xpos = 15.0;
|
||||
me.light2_ypos = 0.0;
|
||||
me.light2_zpos = 2.0;
|
||||
|
||||
|
||||
me.light3_xpos = -2.0;
|
||||
me.light3_ypos = 18.0;
|
||||
me.light3_zpos = 2.0;
|
||||
|
||||
|
||||
me.light4_xpos = -2.0;
|
||||
me.light4_ypos = -18.0;
|
||||
me.light4_zpos = 2.0;
|
||||
|
||||
|
||||
me.light5_xpos = -25.0;
|
||||
me.light5_ypos = 0.0;
|
||||
me.light5_zpos = 2.0;
|
||||
|
||||
|
||||
|
||||
|
||||
# color values
|
||||
me.light1_r = 0.7;
|
||||
me.light1_g = 0.7;
|
||||
me.light1_b = 0.7;
|
||||
|
||||
|
||||
me.light2_r = 0.6;
|
||||
me.light2_g = 0.6;
|
||||
me.light2_b = 0.6;
|
||||
|
||||
|
||||
me.light3_r = 0.4;
|
||||
me.light3_g = 0.0;
|
||||
me.light3_b = 0.0;
|
||||
|
||||
|
||||
me.light4_r = 0.0;
|
||||
me.light4_g = 0.4;
|
||||
me.light4_b = 0.0;
|
||||
|
||||
|
||||
me.light5_r = 0.4;
|
||||
me.light5_g = 0.4;
|
||||
me.light5_b = 0.4;
|
||||
|
@ -145,15 +145,15 @@ var light_manager = {
|
|||
# spot size
|
||||
me.light1_size = 12;
|
||||
me.light1_stretch = 3;
|
||||
|
||||
|
||||
me.light2_size = 6;
|
||||
me.light2_stretch = 2.1;
|
||||
|
||||
|
||||
me.light3_size = 4;
|
||||
me.light4_size = 4;
|
||||
me.light5_size = 5;
|
||||
|
||||
|
||||
|
||||
|
||||
setprop("sim/rendering/als-secondary-lights/flash-radius", 13);
|
||||
|
||||
me.start();
|
||||
|
@ -161,17 +161,17 @@ var light_manager = {
|
|||
|
||||
start: func {
|
||||
setprop("/sim/rendering/als-secondary-lights/num-lightspots", 5);
|
||||
|
||||
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/size", me.light1_size);
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/size[1]", me.light2_size);
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/size[2]", me.light3_size);
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/size[3]", me.light4_size);
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/size[4]", me.light5_size);
|
||||
|
||||
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/stretch", me.light1_stretch);
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/stretch[1]", me.light2_stretch);
|
||||
|
||||
me.run = 1;
|
||||
|
||||
me.run = 1;
|
||||
me.update();
|
||||
},
|
||||
|
||||
|
@ -183,16 +183,16 @@ var light_manager = {
|
|||
if (me.run == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cur_alt = alt_agl.getValue();
|
||||
if (als_on.getValue() == 1 and alt_agl.getValue() < 100.0) {
|
||||
|
||||
|
||||
highBeam = getprop("controls/lighting/highBeam");
|
||||
headlight = getprop("controls/lighting/headlight-als");
|
||||
|
||||
|
||||
ll3 = getprop("sim/model/lights/nose-lights");
|
||||
nav = getprop("/sim/model/lights/nav-lights");
|
||||
|
||||
|
||||
var apos = geo.aircraft_position();
|
||||
var vpos = geo.viewer_position();
|
||||
|
||||
|
@ -206,7 +206,7 @@ var light_manager = {
|
|||
|
||||
var sh = math.sin(heading);
|
||||
var ch = math.cos(heading);
|
||||
|
||||
|
||||
if (highBeam == 1) {
|
||||
me.light1_ypos = 0.0;
|
||||
me.light1_setSize(6);
|
||||
|
@ -214,7 +214,7 @@ var light_manager = {
|
|||
} else {
|
||||
me.light1_off();
|
||||
}
|
||||
|
||||
|
||||
if (headlight == 1) {
|
||||
me.light2_ypos = 0.0;
|
||||
me.light2_xpos = 5.0;
|
||||
|
@ -233,8 +233,8 @@ var light_manager = {
|
|||
props.getNode("/controls/lighting/headlight", 1).setValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (nav == 1) {
|
||||
me.light3_on();
|
||||
me.light4_on();
|
||||
|
@ -244,85 +244,85 @@ var light_manager = {
|
|||
me.light4_off();
|
||||
me.light5_off();
|
||||
}
|
||||
|
||||
|
||||
|
||||
# light 1 position
|
||||
var proj_x = cur_alt;
|
||||
var proj_z = cur_alt/10.0;
|
||||
|
||||
|
||||
apos.set_lat(lat + ((me.light1_xpos + proj_x) * ch + me.light1_ypos * sh) / me.lat_to_m);
|
||||
apos.set_lon(lon + ((me.light1_xpos + proj_x)* sh - me.light1_ypos * ch) / me.lon_to_m);
|
||||
|
||||
|
||||
delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
|
||||
delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
|
||||
var delta_z = apos.alt()- proj_z - vpos.alt();
|
||||
|
||||
|
||||
me.nd_ref_light1_x.setValue(delta_x);
|
||||
me.nd_ref_light1_y.setValue(delta_y);
|
||||
me.nd_ref_light1_z.setValue(delta_z);
|
||||
me.nd_ref_light1_dir.setValue(heading);
|
||||
me.nd_ref_light1_dir.setValue(heading);
|
||||
|
||||
|
||||
|
||||
|
||||
# light 2 position
|
||||
|
||||
|
||||
apos.set_lat(lat + (me.light2_xpos * ch + me.light2_ypos * sh) / me.lat_to_m);
|
||||
apos.set_lon(lon + (me.light2_xpos * sh - me.light2_ypos * ch) / me.lon_to_m);
|
||||
|
||||
|
||||
delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
|
||||
delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
|
||||
delta_z = apos.alt() - vpos.alt();
|
||||
|
||||
|
||||
me.nd_ref_light2_x.setValue(delta_x);
|
||||
me.nd_ref_light2_y.setValue(delta_y);
|
||||
me.nd_ref_light2_z.setValue(delta_z);
|
||||
me.nd_ref_light2_dir.setValue(heading);
|
||||
|
||||
|
||||
|
||||
# light 3 position
|
||||
|
||||
|
||||
apos.set_lat(lat + (me.light3_xpos * ch + me.light3_ypos * sh) / me.lat_to_m);
|
||||
apos.set_lon(lon + (me.light3_xpos * sh - me.light3_ypos * ch) / me.lon_to_m);
|
||||
|
||||
|
||||
delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
|
||||
delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
|
||||
delta_z = apos.alt() - vpos.alt();
|
||||
|
||||
|
||||
me.nd_ref_light3_x.setValue(delta_x);
|
||||
me.nd_ref_light3_y.setValue(delta_y);
|
||||
me.nd_ref_light3_z.setValue(delta_z);
|
||||
me.nd_ref_light3_dir.setValue(heading);
|
||||
|
||||
me.nd_ref_light3_dir.setValue(heading);
|
||||
|
||||
|
||||
# light 4 position
|
||||
|
||||
|
||||
apos.set_lat(lat + (me.light4_xpos * ch + me.light4_ypos * sh) / me.lat_to_m);
|
||||
apos.set_lon(lon + (me.light4_xpos * sh - me.light4_ypos * ch) / me.lon_to_m);
|
||||
|
||||
|
||||
delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
|
||||
delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
|
||||
delta_z = apos.alt() - vpos.alt();
|
||||
|
||||
|
||||
me.nd_ref_light4_x.setValue(delta_x);
|
||||
me.nd_ref_light4_y.setValue(delta_y);
|
||||
me.nd_ref_light4_z.setValue(delta_z);
|
||||
me.nd_ref_light4_dir.setValue(heading);
|
||||
|
||||
|
||||
# light 5 position
|
||||
|
||||
|
||||
apos.set_lat(lat + (me.light5_xpos * ch + me.light5_ypos * sh) / me.lat_to_m);
|
||||
apos.set_lon(lon + (me.light5_xpos * sh - me.light5_ypos * ch) / me.lon_to_m);
|
||||
|
||||
|
||||
delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
|
||||
delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
|
||||
delta_z = apos.alt() - vpos.alt();
|
||||
|
||||
|
||||
me.nd_ref_light5_x.setValue(delta_x);
|
||||
me.nd_ref_light5_y.setValue(delta_y);
|
||||
me.nd_ref_light5_z.setValue(delta_z);
|
||||
me.nd_ref_light5_dir.setValue(heading);
|
||||
}
|
||||
|
||||
|
||||
settimer ( func me.update(), 0.00);
|
||||
},
|
||||
|
||||
|
@ -333,7 +333,7 @@ var light_manager = {
|
|||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b", me.light1_b);
|
||||
me.light1_is_on = 1;
|
||||
},
|
||||
|
||||
|
||||
light1_off : func {
|
||||
if (me.light1_is_on == 0) {return;}
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r", 0.0);
|
||||
|
@ -341,11 +341,11 @@ var light_manager = {
|
|||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b", 0.0);
|
||||
me.light1_is_on = 0;
|
||||
},
|
||||
|
||||
|
||||
light1_setSize : func(size) {
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/size[0]", size);
|
||||
},
|
||||
|
||||
|
||||
light2_on : func {
|
||||
if (me.light2_is_on == 1) {return;}
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[1]", me.light2_r);
|
||||
|
@ -353,7 +353,7 @@ var light_manager = {
|
|||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[1]", me.light2_b);
|
||||
me.light2_is_on = 1;
|
||||
},
|
||||
|
||||
|
||||
light2_off : func {
|
||||
if (me.light2_is_on == 0) {return;}
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[1]", 0.0);
|
||||
|
@ -361,11 +361,11 @@ var light_manager = {
|
|||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[1]", 0.0);
|
||||
me.light2_is_on = 0;
|
||||
},
|
||||
|
||||
|
||||
light2_setSize : func(size) {
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/size[1]", size);
|
||||
},
|
||||
|
||||
|
||||
light3_on : func {
|
||||
if (me.light3_is_on == 1) {return;}
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[2]", me.light3_r);
|
||||
|
@ -373,7 +373,7 @@ var light_manager = {
|
|||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[2]", me.light3_b);
|
||||
me.light3_is_on = 1;
|
||||
},
|
||||
|
||||
|
||||
light3_off : func {
|
||||
if (me.light3_is_on == 0) {return;}
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[2]", 0.0);
|
||||
|
@ -389,7 +389,7 @@ var light_manager = {
|
|||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[3]", me.light4_b);
|
||||
me.light4_is_on = 1;
|
||||
},
|
||||
|
||||
|
||||
light4_off : func {
|
||||
if (me.light4_is_on == 0) {return;}
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[3]", 0.0);
|
||||
|
@ -397,7 +397,7 @@ var light_manager = {
|
|||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[3]", 0.0);
|
||||
me.light4_is_on = 0;
|
||||
},
|
||||
|
||||
|
||||
light5_on : func {
|
||||
if (me.light5_is_on == 1) {return;}
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[4]", me.light5_r);
|
||||
|
@ -405,7 +405,7 @@ var light_manager = {
|
|||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[4]", me.light5_b);
|
||||
me.light5_is_on = 1;
|
||||
},
|
||||
|
||||
|
||||
light5_off : func {
|
||||
if (me.light5_is_on == 0) {return;}
|
||||
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[4]", 0.0);
|
||||
|
@ -416,6 +416,3 @@ var light_manager = {
|
|||
};
|
||||
|
||||
light_manager.init();
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -56,9 +56,9 @@ aircraft.door.toggle = func(){
|
|||
beacon_switch = props.globals.getNode("controls/switches/warninglight", 2);
|
||||
var beacon = aircraft.light.new( "/sim/model/lights/warning", [0.5, 0.5], "/controls/lighting/warning" );
|
||||
beacon_switch = props.globals.getNode("controls/switches/indicator-left", 2);
|
||||
var beacon = aircraft.light.new( "/sim/model/lights/indicator-left", [0.8, 0.5], "/controls/lighting/indicator-left");
|
||||
var beacon = aircraft.light.new( "/sim/model/lights/indicator-left", [0.5, 0.5], "/controls/lighting/indicator-left");
|
||||
beacon_switch = props.globals.getNode("controls/switches/indicator-right", 2);
|
||||
var beacon = aircraft.light.new( "/sim/model/lights/indicator-right", [0.8, 0.5], "/controls/lighting/indicator-right");
|
||||
var beacon = aircraft.light.new( "/sim/model/lights/indicator-right", [0.5, 0.5], "/controls/lighting/indicator-right");
|
||||
|
||||
props.getNode("/",1).setValue("/controls/lighting/indicator-left", 0);
|
||||
props.getNode("/",1).setValue("/controls/lighting/indicator-right", 0);
|
||||
|
@ -108,7 +108,6 @@ props.getNode("systems/auto_hold_working", 1).setValue(0);
|
|||
#
|
||||
#};
|
||||
|
||||
|
||||
var Indicator = {
|
||||
|
||||
# Usage: #
|
||||
|
@ -190,9 +189,6 @@ var IndicatorController = {
|
|||
name: "Left",
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
saveLedMessage: func(){
|
||||
me.savedMessage.texture = me.ledMessage.getValue();
|
||||
me.savedMessage.file = me.ledMessageFile.getValue();
|
||||
|
|
Loading…
Reference in New Issue