diff options
author | Daniel Sosa <sosa.daniel23@gmail.com> | 2015-02-16 02:28:50 +0000 |
---|---|---|
committer | Daniel Sosa <sosa.daniel23@gmail.com> | 2016-07-03 21:44:02 -0500 |
commit | f1fe0c6bba883f1f547fb08b0e944878ce4293bf (patch) | |
tree | 5d2f99e274c0f5996aa9c246cb0f26fc9daadbc5 /worldedit_commands/cuboid.lua | |
parent | 40cee997006a976acdf89dc610d8ac15232c3645 (diff) |
Fix /shift command to conform to worldedit command standard
Diffstat (limited to 'worldedit_commands/cuboid.lua')
-rw-r--r-- | worldedit_commands/cuboid.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/worldedit_commands/cuboid.lua b/worldedit_commands/cuboid.lua index 9bc2822..6ea1ffc 100644 --- a/worldedit_commands/cuboid.lua +++ b/worldedit_commands/cuboid.lua @@ -82,19 +82,23 @@ minetest.register_chatcommand("/inset", { minetest.register_chatcommand("/shift", { - params = "<amount> [up|down|left|right|front|back]", +-- params = "<amount> [up|down|left|right|front|back]", + params = "[x|y|z|?|up|down|left|right|front|back] [+|-]<amount>", description = "Moves the selection region. Does not move contents.", privs = {worldedit=true}, func = function(name, param) local pos1 = worldedit.pos1[name] local pos2 = worldedit.pos2[name] - local find, _, amount, direction = param:find("(%d+)%s*(%l*)") +-- local find, _, amount, direction = param:find("(%d+)%s*(%l*)") + local find, _, direction, amount = param:find("([%?%l]+)%s*([+-]?%d+)") if find == nil then worldedit.player_notify(name, "invalid usage: " .. param) return end + worldedit.player_notify(name, "direction = " .. direction .. " amount = " .. amount) + if pos1 == nil or pos2 == nil then worldedit.player_notify(name, "Undefined region. Region must be defined beforehand.") @@ -102,14 +106,14 @@ minetest.register_chatcommand("/shift", { end local axis, dir - if direction ~= "" then + if direction ~= "?" then axis, dir = worldedit.translate_direction(name, direction) else axis, dir = worldedit.player_axis(name) end if axis == nil or dir == nil then - return false, "Invalid if looking up or down" + return false, "Invalid" end assert(worldedit.cuboid_shift(name, axis, amount * dir)) |