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
* Compass: Shows yaw (horizontal angle)
* Sextant: Shows pitch (vertical angle)
* Watch: Shows the time (hours and minutes). Leftclick to toggle between 12h
and 24h mode
* Watch: Shows the time (hours and minutes)
* 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)
* GPS device: Shows X, Y, Z coordinates, yaw and time
* Quadcorder: Ultimate tool: Shows X, Y, Z coordinates, pitch, yaw, time, speed
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
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

@ -12,6 +12,17 @@ orienteering.settings = {}
orienteering.settings.speed_unit = S("m/s")
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)
minetest.register_tool("orienteering:altimeter", {
description = S("Altimeter"),
@ -48,6 +59,7 @@ minetest.register_tool("orienteering:quadcorder", {
wield_image = "orienteering_quadcorder.png",
wield_scale = { x=1, y=1, z=3.5 },
inventory_image = "orienteering_quadcorder.png",
on_use = toggle_time_mode,
})
-- Displays game time
@ -55,15 +67,7 @@ minetest.register_tool("orienteering:watch", {
description = S("Watch"),
wield_image = "orienteering_watch.png",
inventory_image = "orienteering_watch.png",
on_use = function(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,
on_use = toggle_time_mode,
})
-- Displays speed
@ -87,6 +91,7 @@ minetest.register_tool("orienteering:gps", {
wield_image = "orienteering_gps_wield.png",
wield_scale = { x=1, y=1, z=2 },
inventory_image = "orienteering_gps_inv.png",
on_use = toggle_time_mode,
})
if minetest.get_modpath("default") ~= nil then