blob: cf9b343f4ba1a27c745f385f6e9902b2664c0d67 (
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
26
27
28
29
30
|
-- returns the context data for the node-position
mesecons_debug.get_context = function(pos)
local blockpos = mesecons_debug.get_blockpos(pos)
local hash = minetest.hash_node_position(blockpos)
local ctx = mesecons_debug.context_store[hash]
if not ctx then
-- create a new context
ctx = {
-- usage in us
micros = 0,
-- average micros per second
avg_micros = 0,
-- time penalty
penalty = 0,
-- mtime
mtime = minetest.get_us_time(),
}
mesecons_debug.context_store[hash] = ctx
end
-- update context
-- whitelist flag
ctx.whitelisted = mesecons_debug.whitelist[hash]
return ctx
end
|