Skip to content

Commit 170fa8a

Browse files
committed
Add hard max region size
1 parent 7b64f5b commit 170fa8a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

worldedit_commands/cuboid.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ worldedit.register_command("cubeapply", {
236236
return false
237237
end
238238
local cmddef = worldedit.registered_commands[cmd]
239-
if cmddef == nil or cmddef.require_pos ~= 2 then
239+
if cmddef == nil or cmddef.require_pos ~= 2 or cmddef.name == "stretch" then
240240
return false, S("invalid usage: @1 cannot be used with cubeapply",
241241
minetest.colorize("#00ffff", "//"..cmd))
242242
end

worldedit_commands/safe.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ local max_nodes = tonumber(minetest.settings:get("worldedit.max_region_nodes"))
66
max_nodes = math.min(max_nodes, 100000)
77
local max_size = tonumber(minetest.settings:get("worldedit.max_area_size")) or 128
88
max_size = math.min(max_size, 1024)
9+
local hard_max_nodes = tonumber(minetest.settings:get("worldedit.hard_max_region_nodes")) or 1000000
10+
hard_max_nodes = math.min(hard_max_nodes, max_size ^ 3)
911
local abs = math.abs
1012
local safe_region_callback = {}
1113

@@ -25,9 +27,9 @@ local function safe_region(name, count, callback, strict)
2527
end
2628

2729
-- Prevent the operation if strict is set (if the safe_area check wasn't used)
28-
if strict or count > max_size ^ 3 then
30+
if strict or count > hard_max_nodes then
2931
worldedit.player_notify(name, S("This operation would affect up to @1 nodes;"
30-
.. " you can only update @2 nodes at a time", count, max_nodes))
32+
.. " you can only update @2 nodes at a time", count, strict and max_nodes or hard_max_nodes))
3133
return
3234
end
3335

0 commit comments

Comments
 (0)