aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Rudin <thomas@rudin.io>2018-12-08 13:14:29 +0100
committerorwell96 <mono96.mml@gmail.com>2018-12-10 17:16:23 +0100
commit8c86e1dfd6486ead06f966d8cbaf26a1deed3aed (patch)
tree4028449e4ed7176c66455d49a7102a3908ef4616
parent8024f43e35ea169f1439decadd2c16bc51386a34 (diff)
downloadposhud-8c86e1dfd6486ead06f966d8cbaf26a1deed3aed.zip
poshud-8c86e1dfd6486ead06f966d8cbaf26a1deed3aed.tar.gz
poshud-8c86e1dfd6486ead06f966d8cbaf26a1deed3aed.tar.bz2
proper mapblock calc
-rw-r--r--init.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index 87f056b..8ac3108 100644
--- a/init.lua
+++ b/init.lua
@@ -171,10 +171,13 @@ minetest.register_globalstep(function (dtime)
for _,player in ipairs(minetest.get_connected_players()) do
local posi = player:get_pos()
- local posistr = math.floor(posi.x+0.5).." "..math.floor(posi.y+0.5).." "..math.floor(posi.z+0.5)
- local mapblockstr = math.floor(posi.x / 16) .. " "
- .. math.floor(posi.y / 16) .. " "
- .. math.floor(posi.z / 16)
+ local x = math.floor(posi.x+0.5)
+ 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)
end