mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-06-28 06:12:00 +02:00
Add configurable brush item
texture was supposed to be a brush, i suck at this :(
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
local safe_region_callback = {}
|
||||
local safe_region_param = {}
|
||||
|
||||
worldedit._override_safe_regions = false -- internal use ONLY!
|
||||
|
||||
local function check_region(name, param)
|
||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] --obtain positions
|
||||
if pos1 == nil or pos2 == nil then
|
||||
@ -20,7 +22,7 @@ local function safe_region(callback, nodes_needed)
|
||||
--check if the operation applies to a safe number of nodes
|
||||
local count = nodes_needed(name, param)
|
||||
if count == nil then return end --invalid command
|
||||
if count < 10000 then
|
||||
if worldedit._override_safe_regions or count < 10000 then
|
||||
return callback(name, param)
|
||||
end
|
||||
|
||||
@ -44,20 +46,21 @@ minetest.register_chatcommand("/y", {
|
||||
return
|
||||
end
|
||||
|
||||
safe_region_callback[name], safe_region_param[name] = nil, nil --reset pending operation
|
||||
reset_pending(name)
|
||||
callback(name, param)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("/n", {
|
||||
params = "",
|
||||
description = "Confirm a pending operation",
|
||||
description = "Abort a pending operation",
|
||||
func = function(name)
|
||||
if not safe_region_callback[name] then
|
||||
worldedit.player_notify(name, "no operation pending")
|
||||
return
|
||||
end
|
||||
safe_region_callback[name], safe_region_param[name] = nil, nil
|
||||
|
||||
reset_pending(name)
|
||||
end,
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user