From 48f3f59fc3b03e0114ef8070f59fd58b918cc253 Mon Sep 17 00:00:00 2001 From: Daniel Sosa Date: Mon, 16 Feb 2015 04:15:52 +0000 Subject: [PATCH] Implement some safety mechanisms --- worldedit_commands/cuboid.lua | 2 +- worldedit_commands/cuboidapi.lua | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/worldedit_commands/cuboid.lua b/worldedit_commands/cuboid.lua index 2a5a9fb..003b358 100644 --- a/worldedit_commands/cuboid.lua +++ b/worldedit_commands/cuboid.lua @@ -109,7 +109,7 @@ minetest.register_chatcommand("/shift", { end if axis == nil or dir == nil then - return false, "Invalid" + return false, "Invalid if looking straight up or down" end assert(worldedit.cuboid_shift(name, axis, amount * dir)) diff --git a/worldedit_commands/cuboidapi.lua b/worldedit_commands/cuboidapi.lua index d91b071..ce20761 100644 --- a/worldedit_commands/cuboidapi.lua +++ b/worldedit_commands/cuboidapi.lua @@ -215,13 +215,23 @@ worldedit.translate_direction = function(name, direction) end if direction == "front" then - resaxis = axis - resdir = dir + if axis == "y" then + resaxis = nil + resdir = nil + else + resaxis = axis + resdir = dir + end end if direction == "back" then - resaxis = axis - resdir = -dir + if axis == "y" then + resaxis = nil + resdir = nil + else + resaxis = axis + resdir = -dir + end end if direction == "left" then