Highlight big numbers in safe region warning

This commit is contained in:
sfan5 2024-05-26 15:18:13 +02:00
parent 86de970552
commit f8442ef9fd

@ -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)