From f3b8c92db1d150741aadd516d04e0bc9b7cae431 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 27 Oct 2016 23:49:59 +0200 Subject: [PATCH] Split speed into horizontal and vetical components --- init.lua | 16 +++++++++++----- locale/de.txt | 4 ++-- locale/template.txt | 5 +++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/init.lua b/init.lua index fd56a01..f8bfe07 100644 --- a/init.lua +++ b/init.lua @@ -278,15 +278,21 @@ function update_hud_displays(player) str_time = "" end - local speed + local speed_hor, speed_ver + local v local attach = player:get_attach() if attach == nil then - speed = vector.length(player:get_player_velocity()) + v = player:get_player_velocity() else - speed = vector.length(attach:getvelocity()) + v = attach:getvelocity() end + speed_ver = v.y + v.y = 0 + speed_hor = vector.length(v) + if speedometer or quadcorder then - str_speed = string.format(S("Speed: %.1f %s"), speed, orienteering.settings.speed_unit) + local u = orienteering.settings.speed_unit + str_speed = string.format(S("Speed: hor.: %.1f %s, vert.: %.1f %s"), speed_hor, u, speed_ver, u) else str_speed = "" end @@ -337,7 +343,7 @@ if minetest.get_modpath("doc_items") ~= nil then ["orienteering:altimeter"] = S("It shows you your current elevation (Y)."), ["orienteering:triangulator"] = S("It shows you the coordinates of your current position in the horizontal plane (X and Z)."), ["orienteering:gps"] = S("The GPS device shows you your coordinates (X, Y and Z), your yaw (horizontal viewing angle) and the time."), - ["orienteering:speedometer"] = S("It shows you your current speed in meters per second, where one meter is the side length of a single cube."), + ["orienteering:speedometer"] = S("It shows you your current horizontal (“hor.”) and vertical (“ver.”) speed in meters per second, where one meter is the side length of a single cube."), ["orienteering:watch"] = S("It shows you the current time."), ["orienteering:quadcorder"] = S("This is the ultimate orientieering tool. It shows you your coordinates (X, Y and Z), shows your yaw and pitch (horizontal and vertical viewing angles), the current time, your current speed and it enables you to access the minimap."), ["orienteering:automapper"] = S("The automapper automatically creates a map of the area around you and enables you to view a minimap of your surroundings. It also has a built-in radar."), diff --git a/locale/de.txt b/locale/de.txt index 9711db3..0d1eb0a 100644 --- a/locale/de.txt +++ b/locale/de.txt @@ -19,7 +19,7 @@ a.m. = AM Time: %i:%02i %s = Uhrzeit: %i:%02i %s Time: %02i:%02i = Uhrzeit: %02i:%02i -Speed: %.1f %s = Tempo: %.1f %s +Speed: hor.: %.1f %s, vert.: %.1f %s = Tempo: hor.: %.1f %s, vert.: %.1f %s m = m m/s = m/s @@ -36,7 +36,7 @@ It shows you your pitch (vertical viewing angle) in degrees. = Er zeigt Ihnen Ih It shows you your current elevation (Y). = Er zeigt Ihnen Ihre momentane Höhe (Y). It shows you the coordinates of your current position in the horizontal plane (X and Z). = Er zeigt Ihnen die Koordinaten Ihrer aktuellen Position auf der horizontalen Ebene (X und Z). The GPS device shows you your coordinates (X, Y and Z), your yaw (horizontal viewing angle) and the time. = Das GPS-Gerät zeigt Ihnen Ihre Koordinaten (X, Y und Z), Ihre Gierung (horizontaler Blickwinkel) und die Zeit. -It shows you your current speed in meters per second, where one meter is the side length of a single cube. = Er zeigt Ihnen ihre aktuelle Geschwindigkeit in Metern pro Sekunde, wobei hier ein Meter die Kantenlänge eines einzelnen Würfels ist. +It shows you your current horizontal (“hor.”) and vertical (“ver.”) speed in meters per second, where one meter is the side length of a single cube. = Er zeigt Ihnen ihre aktuelle horizontale (»hor.«) und vertikale (»vert.«) Geschwindigkeit in Metern pro Sekunde, wobei hier ein Meter die Kantenlänge eines einzelnen Würfels ist. It shows you the current time. = Es zeigt Ihnen die aktuelle Uhrzeit. This is the ultimate orientieering tool. It shows you your coordinates (X, Y and Z), shows your yaw and pitch (horizontal and vertical viewing angles), the current time, your current speed and it enables you to access the minimap. = Dies ist das ultimative Werkzeug für die Orientierung. Es zeigt Ihnen Ihre aktuellen Koordinaten (X, Y, und Z), zeigt Ihren Gier- und Nickwinkel (horizontaler und vertikaler Blickwinkel), die aktuelle Uhrzeit, Ihre aktuelle Geschwindigkeit und es ermöglicht es Ihnen, auf die Kleinkarte zuzugreifen. The automapper automatically creates a map of the area around you and enables you to view a minimap of your surroundings. It also has a built-in radar. = Der Autokartierer erstellt automatisch eine Karte von Ihrer näheren Umgebung und ermöglicht es Ihnen, eine Kleinkarte davon zu betrachten. Er hat außerdem einen eingebauten Radar. diff --git a/locale/template.txt b/locale/template.txt index 8b80906..283b301 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -36,7 +36,8 @@ m m/s # %.1f will be replaced by number, %s will be replaced by speed unit -Speed: %.1f %s +# "hor." = "horizontal"; "vert." = "vertical" +Speed: hor.: %.1f %s, vert.: %.1f %s # awards Master of Orienteering @@ -48,7 +49,7 @@ It shows you your pitch (vertical viewing angle) in degrees. It shows you your current elevation (Y). It shows you the coordinates of your current position in the horizontal plane (X and Z). The GPS device shows you your coordinates (X, Y and Z), your yaw (horizontal viewing angle) and the time. -It shows you your current speed in meters per second, where one meter is the side length of a single cube. +It shows you your current horizontal (“hor.”) and vertical (“ver.”) speed in meters per second, where one meter is the side length of a single cube. It shows you the current time. This is the ultimate orientieering tool. It shows you your coordinates (X, Y and Z), shows your yaw and pitch (horizontal and vertical viewing angles), the current time, your current speed and it enables you to access the minimap. The automapper automatically creates a map of the area around you and enables you to view a minimap of your surroundings. It also has a built-in radar.