aboutsummaryrefslogtreecommitdiff
path: root/hud.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 /hud.lua
parent17915aa4c5d17ccdbc2f1d68e98d66cd0a945092 (diff)
downloadmesecons_debug-6b54a59271a1b8b1cd8e680006d38f3c44cb7396.tar.gz
mesecons_debug-6b54a59271a1b8b1cd8e680006d38f3c44cb7396.zip
working mapblock whitelist
Diffstat (limited to 'hud.lua')
-rw-r--r--hud.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/hud.lua b/hud.lua
index 8aa6561..93e879c 100644
--- a/hud.lua
+++ b/hud.lua
@@ -27,20 +27,22 @@ minetest.register_on_leaveplayer(function(player)
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
local function get_info(player)
local pos = player:get_pos()
- local blockpos = get_blockpos(pos)
+ local blockpos = mesecons_debug.get_blockpos(pos)
local ctx = mesecons_debug.get_context(pos)
local percent = math.floor(ctx.avg_micros / mesecons_debug.max_usage_micros * 100)
- local txt = "Mesecons @ (" .. blockpos.x .. "/" .. blockpos.y .. "/" .. blockpos.z .. ") " ..
+ local txt = "Mesecons @ (" .. blockpos.x .. "/" .. blockpos.y .. "/" .. blockpos.z .. ") "
+
+ if ctx.whitlisted then
+ txt = txt .. "whitelisted, no limits"
+ return txt, 0x00FF00
+ end
+
+ txt = txt ..
" usage: " .. ctx.avg_micros .. " us/s .. (" .. percent .. "%) " ..
"penalty: " .. math.floor(ctx.penalty*10)/10 .. " s"