From 67b14bb1ae127ebd095f285d95468d506548d740 Mon Sep 17 00:00:00 2001 From: mfranz Date: Sun, 4 May 2008 21:16:48 +0000 Subject: [PATCH] Francesco BRISA (& me): add teleport function When holding the gear key or button down (as a kind of modifier) and after left-clicking on the terrain, teleport the UFO to the click position. Keep heading if no model is active, otherise look there. Keep altitude-agl. --- Aircraft/ufo/ufo-set.xml | 4 ++++ Aircraft/ufo/ufo.nas | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Aircraft/ufo/ufo-set.xml b/Aircraft/ufo/ufo-set.xml index ea6f9979e..7729afe78 100644 --- a/Aircraft/ufo/ufo-set.xml +++ b/Aircraft/ufo/ufo-set.xml @@ -107,6 +107,10 @@ Alt + mouse click move selected object(s) to new place + + g (gear) + click + teleport to click position, looking at active object + Ctrl + PgUp/PgDn cycle through model list diff --git a/Aircraft/ufo/ufo.nas b/Aircraft/ufo/ufo.nas index 6ba89eb82..a48e9193c 100644 --- a/Aircraft/ufo/ufo.nas +++ b/Aircraft/ufo/ufo.nas @@ -4,6 +4,10 @@ setlistener("/sim/panel/visibility", func(n) { }, 1); +var gear_key_down = 0; +controls.gearDown = func (x) gear_key_down = x != 0; + + @@ -319,6 +323,9 @@ var ModelMgr = { status_dialog.open(); adjust_dialog.center_sliders(); + if (gear_key_down) + return teleport(mouse_coord, me.active); + if (KbdAlt.getBoolValue()) { # move active object here (and other selected ones along with it) (me.active == nil) and return; var course = me.active.pos.course_to(me.mouse_coord); @@ -592,6 +599,15 @@ var print_model_data = func(prop) { } +var teleport = func(target, lookat) { + setprop("/position/latitude-deg", target.lat()); + setprop("/position/longitude-deg", target.lon()); + setprop("/position/altitude-ft", target.alt() * geo.M2FT + getprop("/position/altitude-agl-ft")); + view.resetView(); + if (lookat != nil) + setprop("/orientation/heading-deg", target.course_to(lookat.pos)); +} +