From 86de9705527ff97f1ebf7ec949e3cf8cf1f50268 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 26 May 2024 15:01:12 +0200 Subject: [PATCH] Make safe region limit configurable --- settingtypes.txt | 4 ++++ worldedit_commands/safe.lua | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 settingtypes.txt diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..99ca1bc --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,4 @@ +# For operations that potentially affect more than the specified amount of nodes +# WorldEdit will require additional confirmation via //y before proceeding. +# Set to 0 to disable the confirmation in all cases. +worldedit_safe_region_limit (Limit for safe region warning) int 20000 diff --git a/worldedit_commands/safe.lua b/worldedit_commands/safe.lua index 20ed9cf..bba5871 100644 --- a/worldedit_commands/safe.lua +++ b/worldedit_commands/safe.lua @@ -1,11 +1,13 @@ local S = minetest.get_translator("worldedit_commands") +local safe_region_limit = tonumber(minetest.settings:get("worldedit_safe_region_limit") or "20000") + local safe_region_callback = {} --`count` is the number of nodes that would possibly be modified --`callback` is a callback to run when the user confirms local function safe_region(name, count, callback) - if count < 20000 then + if safe_region_limit <= 0 or count < safe_region_limit then return callback() end