summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2018-11-15 20:48:20 +0100
committersfan5 <sfan5@live.de>2018-11-15 20:49:19 +0100
commitb2b2b9364d7dac5a96924b753b588f40ee415ff0 (patch)
treec6743309d86e902bbf04a5ec3f6f81eed7101be7
parentb37605943bd384cc1809df7f00740cbe1e266111 (diff)
Warn about invalid //stretch usageorigin/masterorigin/HEAD
-rw-r--r--ChatCommands.md6
-rw-r--r--worldedit_commands/init.lua5
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 `<count>` times by offset `<x>`, `<y>`, `<z>`
Scale the current WorldEdit positions and region by a factor of `<stretchx>`, `<stretchy>`, `<stretchz>` 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),
})