Merge branch 'master' into Lower-ECAM

This commit is contained in:
Joshua Davidson 2018-08-13 14:03:43 -04:00
commit c793bf5add
11 changed files with 375 additions and 289 deletions

View file

@ -473,17 +473,17 @@
</display>
<ir n="0">
<align type="bool">false</align>
<knob type="int">1</knob>
<knob type="int">0</knob>
<fault type="bool">false</fault>
</ir>
<ir n="1">
<align type="bool">false</align>
<knob type="int">1</knob>
<knob type="int">0</knob>
<fault type="bool">false</fault>
</ir>
<ir n="2">
<align type="bool">false</align>
<knob type="int">1</knob>
<knob type="int">0</knob>
<fault type="bool">false</fault>
</ir>
<onbat type="bool">false</onbat>
@ -1429,6 +1429,7 @@
<file>Aircraft/IDG-A32X/Nasal/efis.nas</file>
<file>Aircraft/IDG-A32X/Nasal/ECAM.nas</file>
<file>Aircraft/IDG-A32X/Nasal/shake.nas</file>
<file>Aircraft/IDG-A32X/Nasal/light-manager.nas</file>
</libraries>
<acconfig>
<file>Aircraft/IDG-A32X/AircraftConfig/acconfig.nas</file>

View file

@ -113,8 +113,9 @@ spinning.start();
init_dlg.open();
http.load("https://raw.githubusercontent.com/it0uchpods/IDG-A32X/master/revision.txt").done(func(r) setprop("/systems/acconfig/new-revision", r.response));
var revisionFile = (getprop("/sim/aircraft-dir")~"/revision.txt");
var revisionFile = (getprop("/sim/aircraft-dir") ~ "/revision.txt");
var current_revision = io.readfile(revisionFile);
print("IDG A32X Revision: " ~ current_revision);
setprop("/systems/acconfig/revision", current_revision);
setlistener("/systems/acconfig/new-revision", func {
@ -161,7 +162,7 @@ setlistener("/sim/signals/fdm-initialized", func {
}
mismatch_chk();
readSettings();
if (getprop("/systems/acconfig/options/revision") < current_revision) {
if (getprop("/systems/acconfig/options/revision") < current_revision and getprop("/systems/acconfig/mismatch-code") == "0x000") {
updated_dlg.open();
} else if (getprop("/systems/acconfig/out-of-date") != 1 and getprop("/systems/acconfig/mismatch-code") == "0x000" and getprop("/systems/acconfig/options/welcome-skip") != 1) {
welcome_dlg.open();

View file

@ -95,20 +95,22 @@ var canvas_MCDU_base = {
},
update: func() {
if (getprop("/systems/electrical/bus/ac1") >= 110) {
MCDU_1.page.show();
MCDU_1.update();
MCDU_1.updateFast();
updateL = 1;
MCDU_1.page.show();
} else {
MCDU_1.page.hide();
updateL = 0;
MCDU_1.page.hide();
}
if (getprop("/systems/electrical/bus/ac2") >= 110) {
MCDU_2.page.show();
MCDU_2.update();
MCDU_2.updateFast();
updateR = 1;
MCDU_2.page.show();
} else {
MCDU_2.page.hide();
updateR = 0;
MCDU_2.page.hide();
}
},
updateFast: func() {

View file

@ -447,22 +447,18 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
var vorheading = userHdgTru;
var adfheading = userHdgMag;
}
if (getprop("/instrumentation/nav[2]/heading-deg") != nil and me.get_switch("toggle_true_north") == 0) {
var nav0hdg = getprop("/instrumentation/nav[2]/heading-deg") - getprop("/orientation/heading-magnetic-deg");
} else if (getprop("/instrumentation/nav[2]/heading-deg") != nil and me.get_switch("toggle_true_north") == 1) {
if (getprop("/instrumentation/nav[2]/heading-deg") != nil) {
var nav0hdg = getprop("/instrumentation/nav[2]/heading-deg") - getprop("/orientation/heading-deg");
} else {
var nav0hdg = 0;
}
if (getprop("/instrumentation/nav[3]/heading-deg") != nil and me.get_switch("toggle_true_north") == 0) {
var nav1hdg = getprop("/instrumentation/nav[3]/heading-deg") - getprop("/orientation/heading-magnetic-deg");
} else if (getprop("/instrumentation/nav[3]/heading-deg") != nil and me.get_switch("toggle_true_north") == 1) {
if (getprop("/instrumentation/nav[3]/heading-deg") != nil) {
var nav1hdg = getprop("/instrumentation/nav[3]/heading-deg") - getprop("/orientation/heading-deg");
} else {
var nav1hdg = 0;
}
var adf0hdg=getprop("instrumentation/adf/indicated-bearing-deg");
var adf1hdg=getprop("instrumentation/adf[1]/indicated-bearing-deg");
var adf0hdg = getprop("instrumentation/adf/indicated-bearing-deg");
var adf1hdg = getprop("instrumentation/adf[1]/indicated-bearing-deg");
if(!me.get_switch("toggle_centered"))
{
if(me.in_mode("toggle_display_mode", ["PLAN"]))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

View file

@ -1,236 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="airbusNDNoMap.svg"
inkscape:version="0.48.5 r10040"
xml:space="preserve"
id="svg5180"
height="1024"
width="1024"
version="1.1"
inkscape:export-filename="/Users/artix/projects/FlightGear/Aircrafts/A330-200/Models/Instruments/ND/canvas/res/airbusNDNoMap.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><sodipodi:namedview
pagecolor="#000000"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="706"
id="namedview102"
showgrid="false"
inkscape:zoom="0.36"
inkscape:cx="-20.989482"
inkscape:cy="346.41432"
inkscape:window-x="14"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer3"
inkscape:object-nodes="true"
inkscape:snap-smooth-nodes="true"
inkscape:snap-object-midpoints="true"
inkscape:snap-grids="false"
inkscape:snap-to-guides="false"
showguides="true"
inkscape:guide-bbox="true"><sodipodi:guide
id="guide3155"
orientation="0,1"
position="512,200" /><sodipodi:guide
id="guide3167"
orientation="1,0"
position="512,811.5" /><sodipodi:guide
id="guide3177"
orientation="-0.5,-0.86602541"
position="512,200" /><sodipodi:guide
id="guide3179"
orientation="-0.866025,-0.5"
position="512,200" /><sodipodi:guide
position="512,465"
orientation="0,1"
id="guide4003" /><sodipodi:guide
orientation="-0.5,0.8660254"
position="512,200"
id="guide3537" /><sodipodi:guide
orientation="-0.8660254,0.5"
position="512,200"
id="guide3545" /><sodipodi:guide
orientation="-0.17364818,-0.98480775"
position="512,200"
id="guide3547" /></sodipodi:namedview><metadata
id="metadata5186"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title><dc:creator><cc:Agent><dc:title>Gijs de Rooy</dc:title></cc:Agent></dc:creator><cc:license
rdf:resource="" /></cc:Work></rdf:RDF></metadata><defs
id="defs5184"><marker
style="overflow:visible"
id="TriangleOutL"
refX="0.0"
refY="0.0"
orient="auto"
inkscape:stockid="TriangleOutL"><path
transform="scale(0.8)"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
id="path3957" /></marker><marker
style="overflow:visible;"
id="Arrow2Lend"
refX="0.0"
refY="0.0"
orient="auto"
inkscape:stockid="Arrow2Lend"><path
transform="scale(1.1) rotate(180) translate(1,0)"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
id="path3836" /></marker><clipPath
id="clipPath3177"><path
id="path3179"
d="m 109.44,459.54 194.4,0 0,-216 -194.4,0 0,216 z" /></clipPath><clipPath
id="clipPath3133"><path
id="path3135"
d="m 44.64,520.2 324,0 0,-6.24 -324,0 0,6.24 z" /></clipPath><clipPath
id="clipPath3109"><path
id="path3111"
d="m 44.64,36 324,0 0,-10.08 -324,0 0,10.08 z" /></clipPath><clipPath
id="clipPath3095"><path
id="path3097"
d="m 44.64,36 324,0 0,-10.08 -324,0 0,10.08 z" /></clipPath><clipPath
id="clipPath3071"><path
id="path3073"
d="m 44.64,561.24 324,0 0,-4.32 -324,0 0,4.32 z" /></clipPath><clipPath
id="clipPath3035"><path
id="path3037"
d="m 44.64,594 324,0 0,-28.8 -324,0 0,28.8 z" /></clipPath><clipPath
id="clipPath3019"><path
id="path3021"
d="m 44.64,594 324,0 0,-28.8 -324,0 0,28.8 z" /></clipPath><clipPath
id="clipPath4462"
clipPathUnits="userSpaceOnUse"><path
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
id="path4464"
d="m 246.487,713.178 0,-420 c 0,0 -0.334,-50 50,-50 l 375,0 c 50.242,0 50,50 50,50 l 0,420 c 0,0 0.359,50 -50,50 l -375,0 c -50.233,0 -50,-50 -50,-50 z"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /></clipPath></defs><g
style="display:inline"
inkscape:label="base"
id="layer3"
inkscape:groupmode="layer"><text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
id="gs"
y="53.306854"
x="101.87437"
style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr;text-anchor:start;fill:#32f519;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
xml:space="preserve"
inkscape:export-filename="/Users/artix/projects/FlightGear/Aircrafts/A330-200/Models/Instruments/ND/canvas/res/airbusNDNoMap.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><tspan
sodipodi:role="line"
id="tspan4097">---</tspan></text>
<text
xml:space="preserve"
style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr;text-anchor:start;fill:#32f519;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="248.49673"
y="53.306854"
id="tas"
sodipodi:linespacing="125%"
inkscape:label="#text7243"
inkscape:export-filename="/Users/artix/projects/FlightGear/Aircrafts/A330-200/Models/Instruments/ND/canvas/res/airbusNDNoMap.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><tspan
sodipodi:role="line"
id="tspan4099">---</tspan></text>
<text
xml:space="preserve"
style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="38.276394"
y="53.306854"
id="gsLbl"
sodipodi:linespacing="125%"
inkscape:label="#text7243"
inkscape:export-filename="/Users/artix/projects/FlightGear/Aircrafts/A330-200/Models/Instruments/ND/canvas/res/airbusNDNoMap.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><tspan
style="font-size:36px"
sodipodi:role="line"
id="tspan3817"
x="38.276394"
y="53.306854">GS</tspan></text>
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
id="tasLbl"
y="53.306854"
x="170.17084"
style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
xml:space="preserve"
inkscape:export-filename="/Users/artix/projects/FlightGear/Aircrafts/A330-200/Models/Instruments/ND/canvas/res/airbusNDNoMap.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><tspan
y="53.306854"
x="170.17084"
id="tspan3821"
sodipodi:role="line"
style="font-size:36px">TAS</tspan></text>
<text
xml:space="preserve"
style="font-size:56px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;stroke:#ff0000;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
x="309.88889"
y="579.33337"
id="text4101"
sodipodi:linespacing="125%"
inkscape:export-filename="/Users/artix/projects/FlightGear/Aircrafts/A330-200/Models/Instruments/ND/canvas/res/airbusNDNoMap.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><tspan
sodipodi:role="line"
id="tspan4103"
x="309.88889"
y="579.33337">NO MAP AVAIL</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4105"
y="283.33337"
x="513.88892"
style="font-size:56px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ff0000;fill-opacity:1;stroke:#ff0000;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
xml:space="preserve"
inkscape:export-filename="/Users/artix/projects/FlightGear/Aircrafts/A330-200/Models/Instruments/ND/canvas/res/airbusNDNoMap.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><tspan
sodipodi:role="line"
id="tspan4109"
x="513.88892"
y="283.33337">HDG</tspan></text>
</g><g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="PLAN"
style="display:inline"><g
style="display:inline"
id="planArcs"
inkscape:label="#g3956"
transform="matrix(1.02827,0,0,1.0306342,-14.7256,-31.455079)"
inkscape:export-filename="/Users/artix/projects/FlightGear/Aircrafts/A330-200/Models/Instruments/ND/canvas/res/airbusNDNoMap.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"><path
style="fill:none;stroke:#ff0000;stroke-width:3.99999905000000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
d="M 542,956.688 C 767.783,941.437 946.219,753.462 946.219,523.812 946.219,294.164 767.783,106.188 542,90.9375 522,90.94783 502,90.95817 482,90.9685 256.534,106.544 78.4688,294.391 78.4688,523.812 c 0,229.423 178.0652,417.237 403.5312,432.813 20,0.021 40,0.042 60,0.063 z"
transform="matrix(0.972507,0,0,0.972507,14.3208,28.3815)"
id="path3171"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csccscc" /><path
sodipodi:nodetypes="csccscc"
inkscape:connector-curvature="0"
id="path3232"
d="M 483.06917,746.91246 C 380.39674,732.55923 301.36207,644.41995 301.36207,537.79234 c 0,-106.62762 79.0337,-194.79705 181.7071,-209.1493 19.45014,-0.0304 38.90028,-0.061 58.35042,-0.0914 102.99141,14.06829 182.34506,102.38748 182.34506,209.24072 0,106.8542 -79.35365,195.14228 -182.34506,209.21154 -11.39099,3.20745 -45.79654,1.82775 -58.35042,-0.0914"
style="fill:none;stroke:#ff0000;stroke-width:3.89002705000000004;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:32, 16" /></g></g></svg>

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -163,59 +163,61 @@ var canvas_PFD_base = {
PFD_2_mismatch.page.hide();
if (getprop("/systems/electrical/bus/ac-ess") >= 110 and getprop("/controls/lighting/DU/du1") > 0) {
if (getprop("/instrumentation/du/du1-test-time") + getprop("/instrumentation/du/du1-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) {
PFD_1.page.hide();
PFD_1_test.page.show();
PFD_1_test.update();
updateL = 0;
PFD_1.page.hide();
PFD_1_test.page.show();
} else if (getprop("/instrumentation/du/du2-test-time") + getprop("/instrumentation/du/du2-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) {
PFD_1.page.hide();
PFD_1_test.page.show();
PFD_1_test.update();
updateL = 0;
PFD_1.page.hide();
PFD_1_test.page.show();
} else {
PFD_1.updateFast();
PFD_1.update();
updateL = 1;
PFD_1_test.page.hide();
PFD_1.page.show();
PFD_1.updateFast();
updateL = 1;
}
} else {
updateL = 0;
PFD_1_test.page.hide();
PFD_1.page.hide();
updateL = 0;
}
if (getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du6") > 0) {
if (getprop("/instrumentation/du/du6-test-time") + getprop("/instrumentation/du/du6-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) {
PFD_2.page.hide();
PFD_2_test.page.show();
PFD_2_test.update();
updateR = 0;
PFD_2.page.hide();
PFD_2_test.page.show();
} else if (getprop("/instrumentation/du/du5-test-time") + getprop("/instrumentation/du/du5-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) {
PFD_2.page.hide();
PFD_2_test.page.show();
PFD_2_test.update();
updateR = 0;
PFD_2.page.hide();
PFD_2_test.page.show();
} else {
PFD_2.updateFast();
PFD_2.update();
updateR = 1;
PFD_2_test.page.hide();
PFD_2.page.show();
PFD_2.updateFast();
updateR = 1;
}
} else {
updateR = 0;
PFD_2_test.page.hide();
PFD_2.page.hide();
updateR = 0;
}
} else {
updateL = 0;
updateR = 0;
PFD_1_test.page.hide();
PFD_1.page.hide();
PFD_2_test.page.hide();
PFD_2.page.hide();
PFD_1_mismatch.page.show();
PFD_2_mismatch.page.show();
PFD_1_mismatch.update();
PFD_2_mismatch.update();
updateL = 0;
updateR = 0;
PFD_1_mismatch.page.show();
PFD_2_mismatch.page.show();
}
},
updateSlow: func() {

View file

@ -47,7 +47,6 @@ var ADIRS = {
setprop("/controls/adirs/ir[1]/fault", 0);
setprop("/controls/adirs/ir[2]/fault", 0);
setprop("/controls/adirs/onbat", 0);
setprop("/controls/adirs/mcducbtn", 0);
setprop("/controls/adirs/mcdu/mode1", ""); # INVAL ALIGN NAV ATT or off (blank)
setprop("/controls/adirs/mcdu/mode2", "");
setprop("/controls/adirs/mcdu/mode3", "");

View file

@ -516,22 +516,6 @@ var lightsLoop = maketimer(0.2, func {
} else {
nav_lights.setBoolValue(0);
}
# landing lights
landl = getprop("/controls/lighting/landing-lights[1]");
landr = getprop("/controls/lighting/landing-lights[2]");
if (landl == 1) {
setprop("/sim/rendering/als-secondary-lights/use-landing-light", 1);
} else {
setprop("/sim/rendering/als-secondary-lights/use-landing-light", 0);
}
if (landr == 1) {
setprop("/sim/rendering/als-secondary-lights/use-alt-landing-light", 1);
} else {
setprop("/sim/rendering/als-secondary-lights/use-alt-landing-light", 0);
}
});
var lTray = func {

337
Nasal/light-manager.nas Normal file
View file

@ -0,0 +1,337 @@
# provides relative vectors from eye-point to aircraft lights
# in east/north/up coordinates the renderer uses
# Thanks to BAWV12 / Thorsten
var light_manager = {
run: 0,
lat_to_m: 110952.0,
lon_to_m: 0.0,
light1_xpos: 0.0,
light1_ypos: 0.0,
light1_zpos: 0.0,
light1_r: 0.0,
light1_g: 0.0,
light1_b: 0.0,
light1_size: 0.0,
light1_stretch: 0.0,
light1_is_on: 0,
light2_xpos: 0.0,
light2_ypos: 0.0,
light2_zpos: 0.0,
light2_r: 0.0,
light2_g: 0.0,
light2_b: 0.0,
light2_size: 0.0,
light2_stretch: 0.0,
light2_is_on: 0,
light3_xpos: 0.0,
light3_ypos: 0.0,
light3_zpos: 0.0,
light3_r: 0.0,
light3_g: 0.0,
light3_b: 0.0,
light3_size: 0.0,
light3_stretch: 0.0,
light3_is_on: 0,
light3_xpos: 0.0,
light3_ypos: 0.0,
light3_zpos: 0.0,
light3_r: 0.0,
light3_g: 0.0,
light3_b: 0.0,
light3_size: 0.0,
light3_stretch: 0.0,
light4_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),
nd_ref_light1_dir: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/dir", 1),
nd_ref_light2_x: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[1]", 1),
nd_ref_light2_y: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[1]", 1),
nd_ref_light2_z: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[1]", 1),
nd_ref_light2_dir: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/dir[1]", 1),
nd_ref_light3_x: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[2]", 1),
nd_ref_light3_y: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[2]", 1),
nd_ref_light3_z: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[2]", 1),
nd_ref_light3_dir: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/dir[2]", 1),
nd_ref_light4_x: props.globals.getNode("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[3]", 1),
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),
init: func {
# define your lights here
# lights ########
# offsets to aircraft center
me.light1_xpos = 70.0;
me.light1_ypos = 3.0;
me.light1_zpos = 2.0;
me.light2_xpos = 70.0;
me.light2_ypos = -3.0;
me.light2_zpos = 2.0;
me.light3_xpos = 35.0;
me.light3_ypos = 0.5;
me.light3_zpos = 2.0;
me.light4_xpos = 35.0;
me.light4_ypos = -0.5;
me.light4_zpos = 2.0;
# color values
me.light1_r = 0.7;
me.light1_g = 0.7;
me.light1_b = 0.7;
me.light2_r = 0.7;
me.light2_g = 0.7;
me.light2_b = 0.7;
me.light3_r = 0.5;
me.light3_g = 0.5;
me.light3_b = 0.5;
me.light4_r = 0.5;
me.light4_g = 0.5;
me.light4_b = 0.5;
# spot size
me.light1_size = 12;
me.light1_stretch = 6;
me.light2_size = 12;
me.light2_stretch = 6;
me.light3_size = 6;
me.light3_stretch = 8;
me.light4_size = 9;
me.light4_stretch = 8;
setprop("sim/rendering/als-secondary-lights/flash-radius", 13);
me.start();
},
start: func {
setprop("/sim/rendering/als-secondary-lights/num-lightspots", 4);
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/stretch", me.light1_stretch);
setprop("/sim/rendering/als-secondary-lights/lightspot/stretch[1]", me.light2_stretch);
setprop("/sim/rendering/als-secondary-lights/lightspot/stretch[2]", me.light3_stretch);
setprop("/sim/rendering/als-secondary-lights/lightspot/stretch[3]", me.light4_stretch);
me.run = 1;
me.update();
},
stop: func {
me.run = 0;
},
update: func {
if (me.run == 0) {
return;
}
als_on = getprop("/sim/rendering/shaders/skydome");
alt_agl = getprop("/position/gear-agl-ft");
type_of_view = getprop("sim/current-view/internal");
if (als_on == 1 and alt_agl < 100.0) {
ll1 = getprop("controls/lighting/landing-lights[1]");
ll2 = getprop("controls/lighting/landing-lights[2]");
ll3 = getprop("sim/model/lights/nose-lights");
var apos = geo.aircraft_position();
var vpos = geo.viewer_position();
me.lon_to_m = math.cos(apos.lat()*math.pi/180.0) * me.lat_to_m;
var heading = getprop("/orientation/heading-deg") * math.pi/180.0;
var lat = apos.lat();
var lon = apos.lon();
var alt = apos.alt();
var sh = math.sin(heading);
var ch = math.cos(heading);
if (ll1 == 1) {
me.light1_on();
} else {
me.light1_off();
}
if (ll2 == 1) {
me.light2_on();
} else {
me.light2_off();
}
if (ll3 == 0.85) {
me.light3_on();
} else {
me.light3_off();
}
if (ll3 == 1) {
me.light4_on();
} else {
me.light4_off();
}
# light 1 position
#var alt_agl = getprop("/position/altitude-agl-ft");
var proj_x = alt_agl;
var proj_z = alt_agl/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);
# 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);
# 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);
}
settimer ( func me.update(), 0.0);
},
light1_on : func {
if (me.light1_is_on == 1) {return;}
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r", me.light1_r);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g", me.light1_g);
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);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g", 0.0);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b", 0.0);
me.light1_is_on = 0;
},
light2_on : func {
if (me.light2_is_on == 1) {return;}
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[1]", me.light2_r);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[1]", me.light2_g);
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);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[1]", 0.0);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[1]", 0.0);
me.light2_is_on = 0;
},
light3_on : func {
if (me.light3_is_on == 1) {return;}
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[2]", me.light3_r);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[2]", me.light3_g);
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);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[2]", 0.0);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[2]", 0.0);
me.light3_is_on = 0;
},
light4_on : func {
if (me.light4_is_on == 1) {return;}
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r[3]", me.light3_r);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[3]", me.light3_g);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[3]", me.light3_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);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g[3]", 0.0);
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[3]", 0.0);
me.light4_is_on = 0;
},
};
light_manager.init();

View file

@ -1 +1 @@
4615
4620