mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-25 18:20:38 +01:00
Fix region checking (thanks PenguinDad).
This commit is contained in:
parent
b29523db4d
commit
2784a25561
@ -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",
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user