aboutsummaryrefslogtreecommitdiff
path: root/util.lua
blob: 8639b19db731a8358dc9748de1ec962f00c82a06 (plain) (blame)
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
function mesecons_debug.check_pos(pos)
    return type(pos) == "table" and type(pos.x) == "number" and type(pos.y) == "number" and type(pos.z) == "number"
end

function mesecons_debug.get_blockpos(pos)
    return {
        x = math.floor(pos.x / 16),
        y = math.floor(pos.y / 16),
        z = math.floor(pos.z / 16),
    }
end

function mesecons_debug.hashpos(pos)
    return minetest.hash_node_position({
        x = math.floor(pos.x / 16),
        y = math.floor(pos.y / 16),
        z = math.floor(pos.z / 16),
    })
end

function mesecons_debug.wait(n)
    local wait_until = minetest.get_us_time() + n
    while minetest.get_us_time() < wait_until do
    end
end