aboutsummaryrefslogtreecommitdiff
path: root/context.lua
diff options
context:
space:
mode:
authorBuckarooBanzay <BuckarooBanzay@users.noreply.github.com>2020-05-04 10:12:41 +0200
committerBuckarooBanzay <BuckarooBanzay@users.noreply.github.com>2020-05-04 10:12:41 +0200
commit6b54a59271a1b8b1cd8e680006d38f3c44cb7396 (patch)
treee4b474e1d6d5aa17d8fe930f883fa8eef20b5ead /context.lua
parent17915aa4c5d17ccdbc2f1d68e98d66cd0a945092 (diff)
downloadmesecons_debug-6b54a59271a1b8b1cd8e680006d38f3c44cb7396.tar.gz
mesecons_debug-6b54a59271a1b8b1cd8e680006d38f3c44cb7396.zip
working mapblock whitelist
Diffstat (limited to 'context.lua')
-rw-r--r--context.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/context.lua b/context.lua
index 1bdb338..8b667ec 100644
--- a/context.lua
+++ b/context.lua
@@ -7,17 +7,12 @@ if has_monitoring then
penalized_mapblock_count = monitoring.gauge("mesecons_debug_penalized_mapblock_count", "count of penalized mapblocks")
end
-local function get_blockpos(pos)
- return {x = math.floor(pos.x / 16),
- y = math.floor(pos.y / 16),
- z = math.floor(pos.z / 16)}
-end
-- blockpos-hash => context
local context_store = {}
mesecons_debug.get_context = function(pos)
- local blockpos = get_blockpos(pos)
+ local blockpos = mesecons_debug.get_blockpos(pos)
local hash = minetest.hash_node_position(blockpos)
local ctx = context_store[hash]
@@ -37,6 +32,11 @@ mesecons_debug.get_context = function(pos)
context_store[hash] = ctx
end
+ -- update context
+
+ -- whitelist flag
+ ctx.whitelisted = mesecons_debug.whitelist[hash]
+
return ctx
end