File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ if minetest.place_schematic then
11
11
end
12
12
13
13
dofile (minetest .get_modpath (" worldedit_commands" ) .. " /mark.lua" )
14
- dofile (minetest .get_modpath (" worldedit_commands" ) .. " /safe.lua" )
15
- safe_region = rawget (_G , " safe_region" ) or function (callback ) return callback end
14
+ local safe_region , check_region = dofile (minetest .get_modpath (" worldedit_commands" ) .. " /safe.lua" )
16
15
17
16
local function get_position (name ) -- position 1 retrieval function for when not using `safe_region`
18
17
local pos1 = worldedit .pos1 [name ]
Original file line number Diff line number Diff line change 1
1
local safe_region_callback = {}
2
2
local safe_region_param = {}
3
3
4
- check_region = function (name , param )
4
+ local function check_region (name , param )
5
5
local pos1 , pos2 = worldedit .pos1 [name ], worldedit .pos2 [name ] -- obtain positions
6
6
if pos1 == nil or pos2 == nil then
7
7
worldedit .player_notify (name , " no region selected" )
12
12
13
13
-- `callback` is a callback to run when the user confirms
14
14
-- `nodes_needed` is a function accepting `param`, `pos1`, and `pos2` to calculate the number of nodes needed
15
- safe_region = function (callback , nodes_needed )
15
+ local function safe_region (callback , nodes_needed )
16
16
-- default node volume calculation
17
17
nodes_needed = nodes_needed or check_region
18
18
@@ -63,3 +63,6 @@ minetest.register_chatcommand("/n", {
63
63
safe_region_callback [name ], safe_region_param [name ] = nil , nil
64
64
end ,
65
65
})
66
+
67
+ return safe_region , check_region
68
+
You can’t perform that action at this time.
0 commit comments