Browse Source

Warn about invalid //stretch usage

tags/supports_mt04
sfan5 1 year ago
parent
commit
b2b2b9364d
2 changed files with 7 additions and 4 deletions
  1. +3
    -3
      ChatCommands.md
  2. +4
    -1
      worldedit_commands/init.lua

+ 3
- 3
ChatCommands.md View File

@@ -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/?`

+ 4
- 1
worldedit_commands/init.lua View File

@@ -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),
})

Loading…
Cancel
Save