blob: 511cf5cded8ee960b9e471adb85fcf70302de876 (
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
|
local storage = mesecons_debug.storage
-- returns the context data for the node-position
mesecons_debug.get_context = function(pos)
local hash = mesecons_debug.hashpos(pos)
local ctx = mesecons_debug.context_store[hash]
if not ctx then
-- create a new context
ctx = {
-- usage in us
micros = 0,
-- "running average" micros per second
avg_micros_per_second = 0,
-- time penalty
penalty = 0,
-- modification time
mtime = minetest.get_us_time(),
-- whitelist status
whitelisted = storage:contains(hash),
}
mesecons_debug.context_store[hash] = ctx
mesecons_debug.context_store_size = mesecons_debug.context_store_size + 1
end
return ctx
end
|