Allow to toggle time mode with GPS and quadcorder

This commit is contained in:
Wuzzy 2016-07-29 11:50:12 +02:00
parent 1547a32804
commit 0bbf9548f3
2 changed files with 18 additions and 11 deletions

@ -21,14 +21,16 @@ The following tools are available:
* Triangulator: Shows X and Z coordinates * Triangulator: Shows X and Z coordinates
* Compass: Shows yaw (horizontal angle) * Compass: Shows yaw (horizontal angle)
* Sextant: Shows pitch (vertical angle) * Sextant: Shows pitch (vertical angle)
* Watch: Shows the time (hours and minutes). Leftclick to toggle between 12h * Watch: Shows the time (hours and minutes)
and 24h mode
* Speedometer: Shows speed in m/s (1 m = side length of a single cube) * Speedometer: Shows speed in m/s (1 m = side length of a single cube)
* Automapper: Enables the usage of the minimap and radar (F7 key by default) * Automapper: Enables the usage of the minimap and radar (F7 key by default)
* GPS device: Shows X, Y, Z coordinates, yaw and time * GPS device: Shows X, Y, Z coordinates, yaw and time
* Quadcorder: Ultimate tool: Shows X, Y, Z coordinates, pitch, yaw, time, speed * Quadcorder: Ultimate tool: Shows X, Y, Z coordinates, pitch, yaw, time, speed
and enables minimap/radar and enables minimap/radar
To toggle between 12h and 24h mode for the displayed time, wield any device
which is capable of displaying the time and press the left mouse button.
## Configuration recommendations ## Configuration recommendations
Note that in Minetest, it is also possible to access the coordinates, angles, Note that in Minetest, it is also possible to access the coordinates, angles,
etc. through the debug menu, but this would be generally considered cheating as etc. through the debug menu, but this would be generally considered cheating as

@ -12,6 +12,17 @@ orienteering.settings = {}
orienteering.settings.speed_unit = S("m/s") orienteering.settings.speed_unit = S("m/s")
orienteering.settings.length_unit = S("m") orienteering.settings.length_unit = S("m")
-- Helper function to switch between 12h and 24 mode for the time
function toggle_time_mode(itemstack, user, pointed_thing)
local name = user:get_player_name()
if orienteering.playerhuds[name].twelve then
orienteering.playerhuds[name].twelve = false
else
orienteering.playerhuds[name].twelve = true
end
update_hud_displays(user)
end
-- Displays height (Y) -- Displays height (Y)
minetest.register_tool("orienteering:altimeter", { minetest.register_tool("orienteering:altimeter", {
description = S("Altimeter"), description = S("Altimeter"),
@ -48,6 +59,7 @@ minetest.register_tool("orienteering:quadcorder", {
wield_image = "orienteering_quadcorder.png", wield_image = "orienteering_quadcorder.png",
wield_scale = { x=1, y=1, z=3.5 }, wield_scale = { x=1, y=1, z=3.5 },
inventory_image = "orienteering_quadcorder.png", inventory_image = "orienteering_quadcorder.png",
on_use = toggle_time_mode,
}) })
-- Displays game time -- Displays game time
@ -55,15 +67,7 @@ minetest.register_tool("orienteering:watch", {
description = S("Watch"), description = S("Watch"),
wield_image = "orienteering_watch.png", wield_image = "orienteering_watch.png",
inventory_image = "orienteering_watch.png", inventory_image = "orienteering_watch.png",
on_use = function(itemstack, user, pointed_thing) on_use = toggle_time_mode,
local name = user:get_player_name()
if orienteering.playerhuds[name].twelve then
orienteering.playerhuds[name].twelve = false
else
orienteering.playerhuds[name].twelve = true
end
update_hud_displays(user)
end,
}) })
-- Displays speed -- Displays speed
@ -87,6 +91,7 @@ minetest.register_tool("orienteering:gps", {
wield_image = "orienteering_gps_wield.png", wield_image = "orienteering_gps_wield.png",
wield_scale = { x=1, y=1, z=2 }, wield_scale = { x=1, y=1, z=2 },
inventory_image = "orienteering_gps_inv.png", inventory_image = "orienteering_gps_inv.png",
on_use = toggle_time_mode,
}) })
if minetest.get_modpath("default") ~= nil then if minetest.get_modpath("default") ~= nil then