-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module_pos.lua
47 lines (35 loc) · 1000 Bytes
/
module_pos.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
-- module pos --
-- by SwissalpS --
-- displays player position in nodes and block coordinates
-- taken from [PosTool]
local getPositionTablesForPos = function(tPos)
local x = math.floor(tPos.x + 0.5)
local y = math.floor(tPos.y + 0.5)
local z = math.floor(tPos.z + 0.5)
return { x = x, y = y, z = z },
{
x = math.floor(x / 16),
y = math.floor(y / 16),
z = math.floor(z / 16)
}
end -- getPositionTablesForPos
local function update(index)
local hudPosSeparator = ' | '
local tNode, tBlock = getPositionTablesForPos(tmi.player:get_pos())
local sNode = 'Node: '
.. tostring(tNode.x) .. hudPosSeparator
.. tostring(tNode.y) .. hudPosSeparator
.. tostring(tNode.z)
local sBlock = 'Block: '
.. tostring(tBlock.x) .. hudPosSeparator
.. tostring(tBlock.y) .. hudPosSeparator
.. tostring(tBlock.z)
return sNode .. '\n' .. sBlock
end -- update
tmi.addModule({
id = 'pos',
title = 'pos',
value = 'pos module',
onUpdate = update,
})
--print('module pos loaded')