From b2b2b9364d7dac5a96924b753b588f40ee415ff0 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 15 Nov 2018 20:48:20 +0100 Subject: [PATCH] Warn about invalid //stretch usage --- ChatCommands.md | 6 +++--- worldedit_commands/init.lua | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChatCommands.md b/ChatCommands.md index ea1f955..528f2df 100644 --- a/ChatCommands.md +++ b/ChatCommands.md @@ -289,9 +289,9 @@ Stack the current WorldEdit region `` times by offset ``, ``, `` Scale the current WorldEdit positions and region by a factor of ``, ``, `` along the X, Y, and Z axes, repectively, with position 1 as the origin. - //scale 2 2 2 - //scale 1 2 1 - //scale 10 20 1 + //stretch 2 2 2 + //stretch 1 2 1 + //stretch 10 20 1 ### `//transpose x/y/z/? x/y/z/?` diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index 131c49b..763e895 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -905,9 +905,12 @@ minetest.register_chatcommand("/stretch", { stretchx, stretchy, stretchz = tonumber(stretchx), tonumber(stretchy), tonumber(stretchz) if stretchx == 0 or stretchy == 0 or stretchz == 0 then worldedit.player_notify(name, "invalid scaling factors: " .. param) + return nil end local count = check_region(name, param) - if count then return tonumber(stretchx) * tonumber(stretchy) * tonumber(stretchz) * count end + if count then + return stretchx * stretchy * stretchz * count + end return nil end), })