Fix region checking (thanks PenguinDad).

This commit is contained in:
Uberi 2014-03-15 14:28:47 -04:00
parent b29523db4d
commit 2784a25561
2 changed files with 11 additions and 11 deletions

View File

@ -71,17 +71,6 @@ worldedit.player_axis = function(name)
return "z", dir.z > 0 and 1 or -1 return "z", dir.z > 0 and 1 or -1
end end
local check_region = function(name, param)
--obtain positions
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
worldedit.player_notify(name, "no region selected")
return nil
end
return worldedit.volume(pos1, pos2)
end
minetest.register_chatcommand("/about", { minetest.register_chatcommand("/about", {
params = "", params = "",
description = "Get information about the mod", description = "Get information about the mod",

View File

@ -2,6 +2,17 @@ local safe_region_callback
local safe_region_name local safe_region_name
local safe_region_param local safe_region_param
check_region = function(name, param)
--obtain positions
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
worldedit.player_notify(name, "no region selected")
return nil
end
return worldedit.volume(pos1, pos2)
end
--`callback` is a callback to run when the user confirms --`callback` is a callback to run when the user confirms
--`nodes_needed` is a function accepting `param`, `pos1`, and `pos2` to calculate the number of nodes needed --`nodes_needed` is a function accepting `param`, `pos1`, and `pos2` to calculate the number of nodes needed
safe_region = function(callback, nodes_needed) safe_region = function(callback, nodes_needed)