mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-25 18:20:38 +01:00
Modify outset and inset to accept both hv and vh combinations. Update documentation accordingly.
This commit is contained in:
parent
78890dde07
commit
e18525d8c9
@ -408,14 +408,14 @@ opposite direction over the same axis by `[reverse-amount]`.
|
|||||||
|
|
||||||
//expand right 7 5
|
//expand right 7 5
|
||||||
|
|
||||||
### `//outset [h|v] <amount>`
|
### `//outset [hv] <amount>`
|
||||||
|
|
||||||
Expands the selection in all directions by `<amount>`. If specified, the selection can be expanded horizontally in the x and z axes `[h]`
|
Expands the selection in all directions by `<amount>`. If specified, the selection can be expanded horizontally in the x and z axes `[h]`
|
||||||
or vertically in the y axis `[v]`.
|
or vertically in the y axis `[v]`.
|
||||||
|
|
||||||
//outset v 5
|
//outset v 5
|
||||||
|
|
||||||
### `//inset [h|v] <amount>`
|
### `//inset [hv] <amount>`
|
||||||
|
|
||||||
Contracts the selection in all directions by `<amount>`. If specified, the selection can be contracted horizontally in the x and z axes `[h]`
|
Contracts the selection in all directions by `<amount>`. If specified, the selection can be contracted horizontally in the x and z axes `[h]`
|
||||||
or vertically in the y axis `[v]`.
|
or vertically in the y axis `[v]`.
|
||||||
|
@ -6,7 +6,7 @@ minetest.register_chatcommand("/outset", {
|
|||||||
description = "outset the selection",
|
description = "outset the selection",
|
||||||
privs = {worldedit=true},
|
privs = {worldedit=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local find, _, dir, amount = param:find("([hv]?)%s*([+-]?%d+)")
|
local find, _, dir, amount = param:find("(%a*)%s*([+-]?%d+)")
|
||||||
|
|
||||||
if find == nil then
|
if find == nil then
|
||||||
return false, "invalid usage: " .. param
|
return false, "invalid usage: " .. param
|
||||||
@ -20,7 +20,13 @@ minetest.register_chatcommand("/outset", {
|
|||||||
"Undefined region. Region must be defined beforehand."
|
"Undefined region. Region must be defined beforehand."
|
||||||
end
|
end
|
||||||
|
|
||||||
if dir == "" then
|
local hv_test = dir:find("[^hv]+")
|
||||||
|
|
||||||
|
if hv_test ~= nil then
|
||||||
|
return false, "Invalid direction."
|
||||||
|
end
|
||||||
|
|
||||||
|
if dir == "" or dir == "hv" or dir == "vh" then
|
||||||
assert(worldedit.cuboid_volumetric_expand(name, amount))
|
assert(worldedit.cuboid_volumetric_expand(name, amount))
|
||||||
elseif dir == "h" then
|
elseif dir == "h" then
|
||||||
assert(worldedit.cuboid_linear_expand(name, 'x', 1, amount))
|
assert(worldedit.cuboid_linear_expand(name, 'x', 1, amount))
|
||||||
@ -31,7 +37,7 @@ minetest.register_chatcommand("/outset", {
|
|||||||
assert(worldedit.cuboid_linear_expand(name, 'y', 1, amount))
|
assert(worldedit.cuboid_linear_expand(name, 'y', 1, amount))
|
||||||
assert(worldedit.cuboid_linear_expand(name, 'y', -1, amount))
|
assert(worldedit.cuboid_linear_expand(name, 'y', -1, amount))
|
||||||
else
|
else
|
||||||
return false, "Unknown error"
|
return false, "Invalid number of arguments"
|
||||||
end
|
end
|
||||||
|
|
||||||
worldedit.marker_update(name)
|
worldedit.marker_update(name)
|
||||||
@ -46,7 +52,7 @@ minetest.register_chatcommand("/inset", {
|
|||||||
description = "inset the selection",
|
description = "inset the selection",
|
||||||
privs = {worldedit=true},
|
privs = {worldedit=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local find, _, dir, amount = param:find("([hv]?)%s*([+-]?%d+)")
|
local find, _, dir, amount = param:find("(%a*)%s*([+-]?%d+)")
|
||||||
|
|
||||||
if find == nil then
|
if find == nil then
|
||||||
return false, "invalid usage: " .. param
|
return false, "invalid usage: " .. param
|
||||||
@ -60,7 +66,13 @@ minetest.register_chatcommand("/inset", {
|
|||||||
"Undefined region. Region must be defined beforehand."
|
"Undefined region. Region must be defined beforehand."
|
||||||
end
|
end
|
||||||
|
|
||||||
if dir == "" then
|
local hv_test = dir:find("[^hv]+")
|
||||||
|
|
||||||
|
if hv_test ~= nil then
|
||||||
|
return false, "Invalid direction."
|
||||||
|
end
|
||||||
|
|
||||||
|
if dir == "" or dir == "vh" or dir == "hv" then
|
||||||
assert(worldedit.cuboid_volumetric_expand(name, -amount))
|
assert(worldedit.cuboid_volumetric_expand(name, -amount))
|
||||||
elseif dir == "h" then
|
elseif dir == "h" then
|
||||||
assert(worldedit.cuboid_linear_expand(name, 'x', 1, -amount))
|
assert(worldedit.cuboid_linear_expand(name, 'x', 1, -amount))
|
||||||
@ -71,7 +83,7 @@ minetest.register_chatcommand("/inset", {
|
|||||||
assert(worldedit.cuboid_linear_expand(name, 'y', 1, -amount))
|
assert(worldedit.cuboid_linear_expand(name, 'y', 1, -amount))
|
||||||
assert(worldedit.cuboid_linear_expand(name, 'y', -1, -amount))
|
assert(worldedit.cuboid_linear_expand(name, 'y', -1, -amount))
|
||||||
else
|
else
|
||||||
return false, "Unknown error"
|
return false, "Invalid number of arguments"
|
||||||
end
|
end
|
||||||
|
|
||||||
worldedit.marker_update(name)
|
worldedit.marker_update(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user