Warn about invalid //stretch usage

This commit is contained in:
sfan5 2018-11-15 20:48:20 +01:00
父節點 b37605943b
當前提交 b2b2b9364d
共有 2 個文件被更改,包括 7 次插入4 次删除

查看文件

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

查看文件

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