From 2784a25561be45894d2a138828013c96f387d470 Mon Sep 17 00:00:00 2001 From: Uberi Date: Sat, 15 Mar 2014 14:28:47 -0400 Subject: Fix region checking (thanks PenguinDad). --- worldedit_commands/safe.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'worldedit_commands/safe.lua') diff --git a/worldedit_commands/safe.lua b/worldedit_commands/safe.lua index 6f83078..834462c 100644 --- a/worldedit_commands/safe.lua +++ b/worldedit_commands/safe.lua @@ -2,6 +2,17 @@ local safe_region_callback local safe_region_name 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 --`nodes_needed` is a function accepting `param`, `pos1`, and `pos2` to calculate the number of nodes needed safe_region = function(callback, nodes_needed) -- cgit v1.2.3