From f8442ef9fd82460116a74b46ff1f86cd4bf1d5d3 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 26 May 2024 15:18:13 +0200 Subject: [PATCH] Highlight big numbers in safe region warning --- worldedit_commands/safe.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/worldedit_commands/safe.lua b/worldedit_commands/safe.lua index bba5871..cd8fee1 100644 --- a/worldedit_commands/safe.lua +++ b/worldedit_commands/safe.lua @@ -11,10 +11,20 @@ local function safe_region(name, count, callback) return callback() end - --save callback to call later + -- save callback to call later safe_region_callback[name] = callback - worldedit.player_notify(name, S("WARNING: this operation could affect up to @1 nodes; type @2 to continue or @3 to cancel", - count, minetest.colorize("#00ffff", "//y"), minetest.colorize("#00ffff", "//n")), "info") + + local count_str = tostring(count) + -- highlight millions, 1 mln <=> 100x100x100 cube + if #count_str > 6 then + count_str = minetest.colorize("#f33", count_str:sub(1, -7)) .. count_str:sub(-6, -1) + end + + local yes_cmd = minetest.colorize("#00ffff", "//y") + local no_cmd = minetest.colorize("#00ffff", "//n") + local msg = S("WARNING: this operation could affect up to @1 nodes; type @2 to continue or @3 to cancel", + count_str, yes_cmd, no_cmd) + worldedit.player_notify(name, msg, "info") end local function reset_pending(name)