From 4e94cdc9067849af7b76ce379a59930b0931fd56 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Wed, 7 Aug 2019 17:43:42 +0100 Subject: [PATCH 1/3] Nasal/multiplayer.nas: in Pilot List, added column showing id of nearest airport. Requires changes to flightgear to populate /ai/models/multiplayer[]/sim/tower/airport-id. --- Nasal/multiplayer.nas | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Nasal/multiplayer.nas b/Nasal/multiplayer.nas index 4a1ae87b2..ccd1314e8 100644 --- a/Nasal/multiplayer.nas +++ b/Nasal/multiplayer.nas @@ -188,7 +188,7 @@ var dialog = { slant: getprop("/sim/gui/selected-style/fonts/mp-list/slant") or 0, }; - me.header = ["view", " callsign", " model", func dialog.dist_hdr, func dialog.alt_hdr ~ " ", " brg", "chat", "ignore" ~ " ", " code", "ver", " set"]; + me.header = ["view", " callsign", " model", func dialog.dist_hdr, func dialog.alt_hdr ~ " ", " brg", "chat", "ignore" ~ " ", " code", "ver", "airport", " set"]; me.columns = [ { type: "checkbox", legend: "", property: "view", halign: "right", "pref-height": 14, "pref-width": 14, callback: "multiplayer.view_select", argprop: "callsign", }, { type: "text", property: "callsign", format: " %s", label: "-----------", halign: "fill" , font: me.font }, @@ -201,6 +201,7 @@ var dialog = { argprop: "callsign", label: "---------", halign: "right", font: me.font }, { type: "text", property: "id-code", format: " %s", label: "-----", halign: "fill" , font: me.font }, { type: "text", property: "sim/multiplay/protocol-version", format: " %s", label: "--", halign: "fill" , font: me.font }, + { type: "text", property: "airport-id", format: "%s", label: "----", halign: "fill" , font: me.font }, { type: "text", property: "set-loaded", format: "%s", label: "----", halign: "fill" , font: me.font }, ]; me.cs_warnings = {}; @@ -378,6 +379,11 @@ var dialog = { if (set != nil) set_numchildren = size(set.getChildren()); var set_loaded = (set_numchildren >= 2); + var airport_id = n.getNode("sim/tower/airport-id"); + if (airport_id != nil) { + airport_id = airport_id.getValue(); + } + n.setValues({ "model-short": n.getNode("model-installed").getValue() ? mp.model : "[" ~ mp.model ~ "]", "set-loaded": set_loaded ? " *" : " ", @@ -386,7 +392,8 @@ var dialog = { "distance-to-nm": distance * M2NM, "position/altitude-m": n.getNode("position/altitude-ft").getValue() * FT2M, "controls/invisible": contains(ignore, mp.callsign), - "id-code": idcode + "id-code": idcode, + "airport-id": airport_id, }); } } From ff503c1093c13eaa486a8a6d9d930122cbfefd9e Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Sun, 11 Aug 2019 23:05:14 +0100 Subject: [PATCH 2/3] Nasal/multiplayer.nas: in Pilot List, append +/- to altitude if ascending or descending. --- Nasal/multiplayer.nas | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Nasal/multiplayer.nas b/Nasal/multiplayer.nas index ccd1314e8..e8a26bf6e 100644 --- a/Nasal/multiplayer.nas +++ b/Nasal/multiplayer.nas @@ -188,18 +188,19 @@ var dialog = { slant: getprop("/sim/gui/selected-style/fonts/mp-list/slant") or 0, }; - me.header = ["view", " callsign", " model", func dialog.dist_hdr, func dialog.alt_hdr ~ " ", " brg", "chat", "ignore" ~ " ", " code", "ver", "airport", " set"]; + me.header = ["view", " callsign", " model", func dialog.dist_hdr, func dialog.alt_hdr ~ " ", "", " brg", "chat", "ignore" ~ " ", " code", "ver", "airport", " set"]; me.columns = [ { type: "checkbox", legend: "", property: "view", halign: "right", "pref-height": 14, "pref-width": 14, callback: "multiplayer.view_select", argprop: "callsign", }, { type: "text", property: "callsign", format: " %s", label: "-----------", halign: "fill" , font: me.font }, { type: "text", property: "model-short", format: " %s", label: "--------------", halign: "fill" , font: me.font }, { type: "text", property: func dialog.dist_node, format:" %8.2f", label: "---------", halign: "right", font: me.font }, { type: "text", property: func dialog.alt_node, format:" %7.0f", label: "---------", halign: "right", font: me.font }, + { type: "text", property: "ascent_descent", format: "%s", label: "-", halign: "right", font: me.font }, { type: "text", property: "bearing-to", format: " %3.0f", label: "----", halign: "right", font: me.font }, { type: "button", legend: "", halign: "right", callback: "multiplayer.compose_message", "pref-height": 14, "pref-width": 14 }, { type: "checkbox", property: "controls/invisible", callback: "multiplayer.dialog.toggle_ignore", argprop: "callsign", label: "---------", halign: "right", font: me.font }, - { type: "text", property: "id-code", format: " %s", label: "-----", halign: "fill" , font: me.font }, + { type: "text", property: "id-code", format: " %s", label: "-", halign: "fill" , font: me.font }, { type: "text", property: "sim/multiplay/protocol-version", format: " %s", label: "--", halign: "fill" , font: me.font }, { type: "text", property: "airport-id", format: "%s", label: "----", halign: "fill" , font: me.font }, { type: "text", property: "set-loaded", format: "%s", label: "----", halign: "fill" , font: me.font }, @@ -384,6 +385,17 @@ var dialog = { airport_id = airport_id.getValue(); } + var ascent_descent = n.getNode("velocities/vertical-speed-fps"); + if (ascent_descent == nil) { + ascent_descent = ''; + } + else { + ascent_descent = ascent_descent.getValue(); + if (ascent_descent > 1) ascent_descent = '+'; + else if (ascent_descent < -1) ascent_descent = '-'; + else ascent_descent = ''; + } + n.setValues({ "model-short": n.getNode("model-installed").getValue() ? mp.model : "[" ~ mp.model ~ "]", "set-loaded": set_loaded ? " *" : " ", @@ -391,6 +403,7 @@ var dialog = { "distance-to-km": distance / 1000.0, "distance-to-nm": distance * M2NM, "position/altitude-m": n.getNode("position/altitude-ft").getValue() * FT2M, + "ascent_descent": ascent_descent, "controls/invisible": contains(ignore, mp.callsign), "id-code": idcode, "airport-id": airport_id, From 81fc15d8e733c4ccb9e71b5e56e36ab3bc0bb4c0 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Mon, 12 Aug 2019 08:50:20 +0100 Subject: [PATCH 3/3] Nasal/view.nas: fix for regression in handling of /sim/current-view/?-offset-m. resetViewPos(): set /sim/current-view/?-offset-m to /sim/view[]/config/?-offset-m, not zeros. This requires corresponding change to flightgear to compensate for the extra offset, and fixes things when aircraft implement custom views by writing to /sim/current-view/?-offset-m. --- Nasal/view.nas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Nasal/view.nas b/Nasal/view.nas index c8209f080..f6f5a6f3d 100644 --- a/Nasal/view.nas +++ b/Nasal/view.nas @@ -114,9 +114,9 @@ var resetFOV = func { var resetViewPos = func { var v = current.getNode("config"); - setprop("/sim/current-view/x-offset-m", 0); - setprop("/sim/current-view/y-offset-m", 0); - setprop("/sim/current-view/z-offset-m", 0); + setprop("/sim/current-view/x-offset-m", v.getNode("x-offset-m", 1).getValue() or 0); + setprop("/sim/current-view/y-offset-m", v.getNode("y-offset-m", 1).getValue() or 0); + setprop("/sim/current-view/z-offset-m", v.getNode("z-offset-m", 1).getValue() or 0); } var resetViewDir = func {