mirror of
https://repo.or.cz/minetest_orienteering.git
synced 2024-11-05 06:33:44 +01:00
Implement speedometer
This commit is contained in:
parent
8c28944aff
commit
62bca4fdee
8
init.lua
8
init.lua
@ -1,5 +1,8 @@
|
|||||||
local orienteering = {}
|
local orienteering = {}
|
||||||
orienteering.playerhuds = {}
|
orienteering.playerhuds = {}
|
||||||
|
orienteering.settings = {}
|
||||||
|
orienteering.settings.speed_unit = "m/s"
|
||||||
|
orienteering.settings.length_unit = "m"
|
||||||
|
|
||||||
-- Displays height (Y)
|
-- Displays height (Y)
|
||||||
minetest.register_tool("orienteering:altimeter", {
|
minetest.register_tool("orienteering:altimeter", {
|
||||||
@ -172,8 +175,9 @@ function update_hud_displays(player)
|
|||||||
str_time = ""
|
str_time = ""
|
||||||
end
|
end
|
||||||
|
|
||||||
if speedometer or gps then
|
local speed = vector.length(player:get_player_velocity())
|
||||||
str_speed = ""
|
if speedometer then
|
||||||
|
str_speed = string.format("Velocity: %.2f %s", speed, orienteering.settings.speed_unit)
|
||||||
else
|
else
|
||||||
str_speed = ""
|
str_speed = ""
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user