aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorThomas Rudin <thomas@rudin.io>2018-12-09 19:50:08 +0100
committerorwell96 <mono96.mml@gmail.com>2018-12-10 17:16:23 +0100
commite37660aa4fcf6ab0d2272a7fcbcf25569e0ff67d (patch)
tree19baf129ecaf2553900c66f2f65bff9a9de99f28 /init.lua
parent8c86e1dfd6486ead06f966d8cbaf26a1deed3aed (diff)
downloadposhud-e37660aa4fcf6ab0d2272a7fcbcf25569e0ff67d.tar.gz
poshud-e37660aa4fcf6ab0d2272a7fcbcf25569e0ff67d.tar.bz2
poshud-e37660aa4fcf6ab0d2272a7fcbcf25569e0ff67d.zip
optional mapblock display
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua21
1 files changed, 16 insertions, 5 deletions
diff --git a/init.lua b/init.lua
index 8ac3108..a0b4aa7 100644
--- a/init.lua
+++ b/init.lua
@@ -12,7 +12,8 @@
poshud = {
-- Position of hud
posx = tonumber(minetest.settings:get("poshud.hud.offsetx") or 0.8),
- posy = tonumber(minetest.settings:get("poshud.hud.offsety") or 0.95)
+ posy = tonumber(minetest.settings:get("poshud.hud.offsety") or 0.95),
+ enable_mapblock = minetest.settings:get_bool("poshud.mapblock.enable")
}
--settings
@@ -175,10 +176,20 @@ minetest.register_globalstep(function (dtime)
local y = math.floor(posi.y+0.5)
local z = math.floor(posi.z+0.5)
local posistr = x.." ".. y .." ".. z
- local mapblockstr = math.floor(x / 16) .. " "
- .. math.floor(y / 16) .. " "
- .. math.floor(z / 16)
- updatehud(player, h_text .. "\nPos: " .. posistr .. "\nMapblock: " .. mapblockstr)
+ -- resulting hud string
+ local hud_display = h_text .. "\nPos: " .. posistr
+
+ if poshud.enable_mapblock then
+ -- append if enabled
+ local mapblockstr = math.floor(x / 16) .. " "
+ .. math.floor(y / 16) .. " "
+ .. math.floor(z / 16)
+
+
+ hud_display = hud_display .. "\nMapblock: " .. mapblockstr
+ end
+
+ updatehud(player, hud_display)
end
end);