From bcac45a476577341b6385b671edcf639acc63393 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 31 Jan 2017 19:52:54 +0100 Subject: Fix "safe region" functionality errornously rejecting pos1-only commands (e.g. //sphere) --- worldedit_commands/safe.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'worldedit_commands/safe.lua') diff --git a/worldedit_commands/safe.lua b/worldedit_commands/safe.lua index e640853..a93e393 100644 --- a/worldedit_commands/safe.lua +++ b/worldedit_commands/safe.lua @@ -30,6 +30,10 @@ local function safe_region(callback, nodes_needed) end end +local function reset_pending(name) + safe_region_callback[name], safe_region_param[name] = nil, nil +end + minetest.register_chatcommand("/y", { params = "", description = "Confirm a pending operation", @@ -40,15 +44,8 @@ minetest.register_chatcommand("/y", { return end - --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 - end - safe_region_callback[name], safe_region_param[name] = nil, nil --reset pending operation - callback(name, param, pos1, pos2) + callback(name, param) end, }) @@ -64,5 +61,5 @@ minetest.register_chatcommand("/n", { end, }) -return safe_region, check_region +return safe_region, check_region, reset_pending -- cgit v1.2.3