From 7b1387d52113b3ac2fa07c5c126862638afd2426 Mon Sep 17 00:00:00 2001 From: Vivian Meazza Date: Sun, 29 Aug 2010 20:45:03 +0100 Subject: [PATCH 1/6] Add impacts Signed-off-by: Vivian Meazza --- Nasal/wildfire.nas | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Nasal/wildfire.nas b/Nasal/wildfire.nas index 710cc103a..accd57801 100644 --- a/Nasal/wildfire.nas +++ b/Nasal/wildfire.nas @@ -127,6 +127,7 @@ var MP_share_pp = "environment/wildfire/share-events"; var save_on_exit_pp = "environment/wildfire/save-on-exit"; var restore_on_startup_pp = "environment/wildfire/restore-on-startup"; var crash_fire_pp = "environment/wildfire/fire-on-crash"; +var impact_fire_pp = "environment/wildfire/fire-on-impact"; var report_score_pp = "environment/wildfire/report-score"; # Internal properties to control the models var models_enabled_pp = "environment/wildfire/models/enabled"; @@ -820,6 +821,7 @@ _setlistener("/sim/signals/nasal-dir-initialized", func { }); props.globals.initNode(MP_share_pp, 1, "BOOL"); props.globals.initNode(crash_fire_pp, 1, "BOOL"); + props.globals.initNode(impact_fire_pp, 1, "BOOL"); props.globals.initNode(save_on_exit_pp, 0, "BOOL"); props.globals.initNode(restore_on_startup_pp, 0, "BOOL"); props.globals.initNode(models_enabled_pp, 1, "BOOL"); @@ -855,6 +857,22 @@ _setlistener("/sim/signals/nasal-dir-initialized", func { wildfire.ignite(geo.aircraft_position()); }); +# Detect impact + var impact_node = props.globals.getNode("sim/ai/aircraft/impact/bomb", 1); + setlistener("sim/ai/aircraft/impact/bomb", func(n) { + + if (getprop(impact_fire_pp) and n.getBoolValue()){ + var node = props.globals.getNode(n.getValue(), 1); + var impactpos = geo.Coord.new(); + impactpos.set_latlon( + node.getNode("impact/latitude-deg").getValue(), + node.getNode("impact/longitude-deg").getValue() + ); + wildfire.ignite(impactpos); + } + + }); + printlog("info", "Wildfire ... initialized."); }); ############################################################################### @@ -917,6 +935,7 @@ var dialog = { ["Share over MP", MP_share_pp], ["Show 3d models", models_enabled_pp], ["Crash starts fire", crash_fire_pp], + ["Impact starts fire", impact_fire_pp], ["Report score", report_score_pp], ["Save on exit", save_on_exit_pp]]) { var w = content.addChild("checkbox"); From b92252c0a399c9e5591d904ef3d10241967497c6 Mon Sep 17 00:00:00 2001 From: "gral@who.net" Date: Tue, 31 Aug 2010 10:29:51 +0200 Subject: [PATCH 2/6] New checkbox transition shaders to separate rock/transition shader work from crop shaders --- Effects/forest.eff | 2 +- Effects/glacier.eff | 2 +- Effects/herbtundra.eff | 2 +- gui/dialogs/rendering.xml | 9 +++++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Effects/forest.eff b/Effects/forest.eff index e189b587a..438d30dfa 100644 --- a/Effects/forest.eff +++ b/Effects/forest.eff @@ -49,7 +49,7 @@ - /sim/rendering/crop-shader + /sim/rendering/transition-shader /sim/rendering/shader-effects diff --git a/Effects/glacier.eff b/Effects/glacier.eff index da9a06146..c5fb1f2db 100644 --- a/Effects/glacier.eff +++ b/Effects/glacier.eff @@ -49,7 +49,7 @@ - /sim/rendering/crop-shader + /sim/rendering/transition-shader /sim/rendering/shader-effects diff --git a/Effects/herbtundra.eff b/Effects/herbtundra.eff index 5f97c2112..6b819d16e 100644 --- a/Effects/herbtundra.eff +++ b/Effects/herbtundra.eff @@ -49,7 +49,7 @@ - /sim/rendering/crop-shader + /sim/rendering/transition-shader /sim/rendering/shader-effects diff --git a/gui/dialogs/rendering.xml b/gui/dialogs/rendering.xml index 114f1f0ca..29e42dbc8 100644 --- a/gui/dialogs/rendering.xml +++ b/gui/dialogs/rendering.xml @@ -270,6 +270,15 @@ dialog-apply + + + left + + /sim/rendering/transition-shader + + dialog-apply + + left From 24ea4dcd0a48365b5cb7453f07d8d3fa2b0fa471 Mon Sep 17 00:00:00 2001 From: "gral@who.net" Date: Tue, 31 Aug 2010 14:30:18 +0200 Subject: [PATCH 3/6] Change in effect cropgrass, it inherits from crop now --- Effects/cropgrass.eff | 90 +------------------------------------------ 1 file changed, 1 insertion(+), 89 deletions(-) diff --git a/Effects/cropgrass.eff b/Effects/cropgrass.eff index 72d1b554c..ee78881ce 100644 --- a/Effects/cropgrass.eff +++ b/Effects/cropgrass.eff @@ -1,7 +1,7 @@ Effects/cropgrass - Effects/terrain-default + Effects/crop Textures/Terrain/cropgrass.png @@ -18,92 +18,4 @@ /sim/rendering/snow-level-m - - - - /sim/rendering/crop-shader - /sim/rendering/shader-effects - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - material/diffuse - material/specular - ambient-and-diffuse - - transparent - transparent - smooth - back - - render-bin/bin-number - render-bin/bin-name - - - 0 - noise - - - 1 - texture[2]/image - texture[2]/filter - texture[2]/wrap-s - texture[2]/wrap-t - - texture[2]/internal-format - - - - 2 - 1d - texture[3]/image - texture[3]/filter - texture[3]/wrap-s - - texture[3]/internal-format - - - - Shaders/crop.vert - Shaders/crop.frag - - - NoiseTex - sampler-3d - 0 - - - SampleTex - sampler-2d - 1 - - - ColorsTex - sampler-1d - 2 - - - snowlevel - float - snow-level - - - From c64d1011394c42b80a6a669a5a006ed3b9d5f472 Mon Sep 17 00:00:00 2001 From: Vivian Meazza Date: Wed, 1 Sep 2010 20:26:01 +0100 Subject: [PATCH 4/6] Change render bin to 10 (default transparent bin) Signed-off-by: Vivian Meazza --- Effects/cloud.eff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Effects/cloud.eff b/Effects/cloud.eff index c1f5c4183..bb6d3c31e 100644 --- a/Effects/cloud.eff +++ b/Effects/cloud.eff @@ -36,7 +36,7 @@ false - 9 + 10 DepthSortedBin From e66aacf41756ba739142bc7fef162712120bae01 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Wed, 1 Sep 2010 22:55:43 +0200 Subject: [PATCH 5/6] Some minor changes preparing for the weather update - Use aloft altitudes to match common forecast maps - Simplify the metar interpolator rules --- Environment/environment.xml | 10 ++-- Environment/metarinterpolator.xml | 85 +++---------------------------- 2 files changed, 11 insertions(+), 84 deletions(-) diff --git a/Environment/environment.xml b/Environment/environment.xml index 71e44e61e..69884a074 100644 --- a/Environment/environment.xml +++ b/Environment/environment.xml @@ -113,7 +113,7 @@ - 3000 + 5000 300 10 16093.44 @@ -128,7 +128,7 @@ - 6000 + 10000 310 20 @@ -141,7 +141,7 @@ - 9000 + 18000 320 30 35 @@ -149,7 +149,7 @@ - 30000 + 24000 330 50 35 @@ -157,7 +157,7 @@ - 40000 + 30000 340 70 35 diff --git a/Environment/metarinterpolator.xml b/Environment/metarinterpolator.xml index 35775635f..d1b28e41f 100644 --- a/Environment/metarinterpolator.xml +++ b/Environment/metarinterpolator.xml @@ -111,7 +111,7 @@ - MetarController:wind-from-north-kt + MetarController:wind-from-north-fps exponential 30 @@ -119,22 +119,12 @@ /environment/metar/valid - - - - - /environment/metar/base-wind-dir-deg - 0.0174533 - - - - /environment/metar/base-wind-speed-kt - - /environment/metar/base-wind-from-north-kt + /environment/metar/base-wind-from-north-fps + /environment/config/boundary/entry[0]/wind-from-north-fps - MetarController:wind-from-east-kt + MetarController:wind-from-east-fps exponential 30 @@ -142,71 +132,8 @@ /environment/metar/valid - - - - - /environment/metar/base-wind-dir-deg - 0.0174533 - - - - /environment/metar/base-wind-speed-kt - - /environment/metar/base-wind-from-east-kt - - - - MetarController::wind-speed-kt - - - /environment/metar/valid - - - - - - - - - /environment/metar/base-wind-from-east-kt - /environment/metar/base-wind-from-east-kt - - - /environment/metar/base-wind-from-north-kt - /environment/metar/base-wind-from-north-kt - - - - - - /environment/config/boundary/entry[0]/wind-speed-kt - gain - 1.0 - - - - MetarController:wind-from-heading-deg - - - /environment/metar/valid - - - - - - /environment/metar/base-wind-from-east-kt - /environment/metar/base-wind-from-north-kt - - - - /environment/config/boundary/entry[0]/wind-from-heading-deg - gain - 57.3 - - 0 - 360 - + /environment/metar/base-wind-from-east-fps + /environment/config/boundary/entry[0]/wind-from-east-fps From 6837a30398ab1582dbdc874ab785a3fcc17d2c7a Mon Sep 17 00:00:00 2001 From: BARANGER Emmanuel Date: Thu, 2 Sep 2010 12:10:29 +0200 Subject: [PATCH 6/6] - a small script of Melchior that can be improved (Start from a seaport with a seaplane). --- Nasal/seaport.nas | 11 ++++ gui/dialogs/seaport.xml | 123 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 Nasal/seaport.nas create mode 100644 gui/dialogs/seaport.xml diff --git a/Nasal/seaport.nas b/Nasal/seaport.nas new file mode 100644 index 000000000..5d9cb7fdb --- /dev/null +++ b/Nasal/seaport.nas @@ -0,0 +1,11 @@ +_setlistener("/sim/presets/latitude-deg", func { + print("*** NEW LOCATION ***"); + settimer(func { + var typ = getprop("/sim/type"); + var lat = getprop("/position/latitude-deg"); + var lon = getprop("/position/longitude-deg"); + var g = geodinfo(lat, lon); + if ((g != nil and g[1] != nil and g[1].solid) and (typ == "seaplane") ) + fgcommand("dialog-show", props.Node.new({ "dialog-name": "seaport" })); + }, 8); +}, 1); diff --git a/gui/dialogs/seaport.xml b/gui/dialogs/seaport.xml new file mode 100644 index 000000000..08fab29ef --- /dev/null +++ b/gui/dialogs/seaport.xml @@ -0,0 +1,123 @@ + + + + seaport + vbox + + + + + var label = cmdarg().getNode("text/label"); + var apt = airportinfo("seaport"); + var rwys = apt.runways; + var lat = apt.lat; + var lon = apt.lon; + + label.setValue(" The nearest seaport is \"" ~ apt.name ~ "\" (" ~ apt.id ~ ") "); + + var goto_seaport = func { + var rwyid = keys(rwys)[0]; + var rwy = rwys[rwyid]; + print("SP: going to seaport ", apt.id, "/", rwyid, " (\"", apt.name, "\")"); + setprop("/sim/presets/airport-id", apt.id); + teleport(rwy.lat, rwy.lon); + settimer(verify, 4); + } + + var verify = func { + var p = geo.aircraft_position(); + if (on_water(p.lat(), p.lon())) { + print("SP: seaport center is on water"); + return; + } + + foreach (var r; keys(rwys)) { + print("SP: trying runway ", r); + var lat = rwys[r].lat; + var lon = rwys[r].lon; + if (on_water(lat, lon)) { + setprop("/sim/presets/runway", r); + setprop("/sim/presets/heading-deg", rwys[r].heading); + print("SP: runway ", r, " is on water"); + return teleport(lat, lon); + } + } + + print("SP: trying circle"); + for (var dist = 500; dist <= 1500; dist += 500) { + print("SP:\tat distance ", dist, " m"); + + for (var course = 0; course < 360; course += 60) { + print("SP:\t\tat course ", course, " degree"); + + p.set_latlon(apt.lat, apt.lon); + p.apply_course_distance(course, dist); + if (on_water(p.lat(), p.lon())) { + print("SP: found water"); + setprop("/sim/presets/heading-deg", course); + return teleport(p.lat(), p.lon()); + } + } + } + + print("SP: no water found"); + } + + var teleport = func(lat, lon) { + setprop("/sim/presets/latitude-deg", lat); + setprop("/sim/presets/longitude-deg", lon); + fgcommand("presets-commit"); + } + + var on_water = func(lat, lon) { + var g = geodinfo(lat, lon); + return g != nil and g[1] != nil and !g[1].solid; + } + + + + + hbox + 1 + + + + + + 1 + + + + + + + + + + hbox + + + + +