mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-12-23 03:55:01 +00:00
Deprecate scol, scube & srect
This commit is contained in:
parent
a772f7ed55
commit
4ab8e7ca2c
4 changed files with 15 additions and 113 deletions
|
@ -1201,33 +1201,18 @@ This also synchronises with WorldEdit, as all other WorldEditAdditions commands
|
||||||
|
|
||||||
|
|
||||||
### `//scol [<axis1> ] <length>`
|
### `//scol [<axis1> ] <length>`
|
||||||
Short for _select column_. Sets the pos2 at a set distance along 1 axis from pos1. If the axis isn't specified, defaults the direction you are facing. Implementation thanks to @VorTechnix.
|
#### === DEPRECATED ===
|
||||||
|
Please use `//srel` instead.
|
||||||
```weacmd
|
|
||||||
//scol 10
|
|
||||||
//scol x 3
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### `//srect [<axis1> [<axis2>]] <length>`
|
### `//srect [<axis1> [<axis2>]] <length>`
|
||||||
Short for _select rectangle_. Sets the pos2 at a set distance along 2 axes from pos1. If the axes aren't specified, defaults to positive y and the direction you are facing. Implementation thanks to @VorTechnix.
|
#### === DEPRECATED ===
|
||||||
|
Please use `//srel` instead.
|
||||||
```weacmd
|
|
||||||
//srect x z 10
|
|
||||||
//srect 3
|
|
||||||
//srect -z y 25
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### `//scube [<axis1> [<axis2> [<axis3>]]] <length>`
|
### `//scube [<axis1> [<axis2> [<axis3>]]] <length>`
|
||||||
Short for _select cube_. Sets the pos2 at a set distance along 3 axes from pos1. If the axes aren't specified, defaults to positive y, the direction you are facing and the axis to the left of facing. Implementation thanks to @VorTechnix.
|
#### === DEPRECATED ===
|
||||||
|
Please use `//srel` instead.
|
||||||
```weacmd
|
|
||||||
//scube 5
|
|
||||||
//scube z a y 12
|
|
||||||
//scube x z 3
|
|
||||||
//scube -z 12
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### `//scloud <0-6|stop|reset>`
|
### `//scloud <0-6|stop|reset>`
|
||||||
|
|
|
@ -12,32 +12,10 @@ worldeditadditions_core.register_command("scol", {
|
||||||
privs = {worldedit=true},
|
privs = {worldedit=true},
|
||||||
require_pos = 1,
|
require_pos = 1,
|
||||||
parse = function(params_text)
|
parse = function(params_text)
|
||||||
local vec, tmp = Vector3.new(0, 0, 0), {}
|
-------------------------
|
||||||
local find = wea_c.split(params_text, "%s", false)
|
|
||||||
local ax1, sn1, len = (tostring(find[1]):match('[xyz]') or "g"):sub(1,1), wea_c.getsign(find[1]), find[table.maxn(find)]
|
|
||||||
|
|
||||||
tmp.len = tonumber(len)
|
|
||||||
-- If len == nil cancel the operation
|
|
||||||
if not tmp.len then return false, "No length specified." end
|
|
||||||
-- If ax1 is bad send "get" order
|
|
||||||
if ax1 == "g" then tmp.get = true
|
|
||||||
else vec[ax1] = sn1 * tmp.len end
|
|
||||||
|
|
||||||
return true, vec, tmp
|
|
||||||
-- tmp carries:
|
|
||||||
-- The length (len) arguement to the main function for use if "get" is invoked there
|
|
||||||
-- The bool value "get" to tell the main function if it needs to populate missing information in vec
|
|
||||||
end,
|
end,
|
||||||
func = function(name, vec, tmp)
|
func = function(name)
|
||||||
if tmp.get then
|
return true, "DEPRECATED: please use //srel instead..."
|
||||||
local ax, dir = wea_c.player_axis2d(name)
|
|
||||||
vec[ax] = tmp.len * dir
|
|
||||||
end
|
|
||||||
|
|
||||||
local pos2 = vec + Vector3.clone(worldedit.pos1[name])
|
|
||||||
worldedit.pos2[name] = pos2
|
|
||||||
worldedit.mark_pos2(name)
|
|
||||||
return true, "position 2 set to "..pos2
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -12,43 +12,10 @@ worldeditadditions_core.register_command("scube", {
|
||||||
privs = { worldedit = true },
|
privs = { worldedit = true },
|
||||||
require_pos = 1,
|
require_pos = 1,
|
||||||
parse = function(params_text)
|
parse = function(params_text)
|
||||||
local vec, tmp = Vector3.new(0, 0, 0), {}
|
-------------------------
|
||||||
local find = wea_c.split(params_text, "%s", false)
|
|
||||||
local ax1, ax2, ax3 = (tostring(find[1]):match('[xyz]') or "g"):sub(1,1), (tostring(find[2]):match('[xyz]') or "g"):sub(1,1),
|
|
||||||
(tostring(find[3]):match('[xyz]') or "g"):sub(1,1)
|
|
||||||
local sn1, sn2, sn3, len = wea_c.getsign(find[1]), wea_c.getsign(find[2]), wea_c.getsign(find[3]), find[table.maxn(find)]
|
|
||||||
|
|
||||||
tmp.len = tonumber(len)
|
|
||||||
-- If len is nill cancel the operation
|
|
||||||
if not tmp.len then return false, "No length specified." end
|
|
||||||
-- If axis is bad send "get" order
|
|
||||||
if ax1 == "g" then tmp.get = true
|
|
||||||
else vec[ax1] = sn1 * tmp.len end
|
|
||||||
if ax2 == "g" then tmp.get = true
|
|
||||||
else vec[ax2] = sn2 * tmp.len end
|
|
||||||
if ax3 == "g" then tmp.get = true
|
|
||||||
else vec[ax3] = sn3 * tmp.len end
|
|
||||||
|
|
||||||
tmp.axes = ax1..","..ax2..","..ax3
|
|
||||||
return true, vec, tmp
|
|
||||||
-- tmp carries:
|
|
||||||
-- The length (len) arguement to the main function for use if "get" is invoked there
|
|
||||||
-- The bool value "get" to tell the main function if it needs to populate missing information in vec
|
|
||||||
-- The string "axes" to tell the main function what axes are and/or need to be populated if "get" is invoked
|
|
||||||
end,
|
end,
|
||||||
func = function(name, vec, tmp)
|
func = function(name)
|
||||||
if tmp.get then
|
return true, "DEPRECATED: please use //srel instead..."
|
||||||
local ax, dir = wea_c.player_axis2d(name)
|
|
||||||
local _, left, sn = wea_c.axis_left(ax,dir)
|
|
||||||
if not tmp.axes:find("x") then vec.x = tmp.len * (ax == "x" and dir or sn) end
|
|
||||||
if not tmp.axes:find("z") then vec.z = tmp.len * (ax == "z" and dir or sn) end
|
|
||||||
if not tmp.axes:find("y") then vec.y = tmp.len end
|
|
||||||
end
|
|
||||||
|
|
||||||
local pos2 = vec + Vector3.clone(worldedit.pos1[name])
|
|
||||||
worldedit.pos2[name] = pos2
|
|
||||||
worldedit.mark_pos2(name)
|
|
||||||
return true, "position 2 set to "..pos2
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -13,38 +13,10 @@ worldeditadditions_core.register_command("srect", {
|
||||||
privs = { worldedit = true },
|
privs = { worldedit = true },
|
||||||
require_pos = 1,
|
require_pos = 1,
|
||||||
parse = function(params_text)
|
parse = function(params_text)
|
||||||
local vec, tmp = Vector3.new(0, 0, 0), {}
|
-------------------------
|
||||||
local find = wea_c.split(params_text, "%s", false)
|
|
||||||
local ax1, ax2 = (tostring(find[1]):match('[xyz]') or "g"):sub(1,1), (tostring(find[2]):match('[xyz]') or "g"):sub(1,1)
|
|
||||||
local sn1, sn2, len = wea_c.getsign(find[1]), wea_c.getsign(find[2]), find[table.maxn(find)]
|
|
||||||
|
|
||||||
tmp.len = tonumber(len)
|
|
||||||
-- If len == nill cancel the operation
|
|
||||||
if not tmp.len then return false, "No length specified." end
|
|
||||||
-- If axis is bad send "get" order
|
|
||||||
if ax1 == "g" then tmp.get = true
|
|
||||||
else vec[ax1] = sn1 * tmp.len end
|
|
||||||
if ax2 == "g" then tmp.get = true
|
|
||||||
else vec[ax2] = sn2 * tmp.len end
|
|
||||||
|
|
||||||
tmp.axes = ax1..","..ax2
|
|
||||||
return true, vec, tmp
|
|
||||||
-- tmp carries:
|
|
||||||
-- The length (len) arguement to the main function for use if "get" is invoked there
|
|
||||||
-- The bool value "get" to tell the main function if it needs to populate missing information in vec
|
|
||||||
-- The string "axes" to tell the main function what axes are and/or need to be populated if "get" is invoked
|
|
||||||
end,
|
end,
|
||||||
func = function(name, vec, tmp)
|
func = function(name)
|
||||||
if tmp.get then
|
return true, "DEPRECATED: please use //srel instead..."
|
||||||
local ax, dir = wea_c.player_axis2d(name)
|
|
||||||
if not tmp.axes:find("[xz]") then vec[ax] = tmp.len * dir end
|
|
||||||
if not tmp.axes:find("y") then vec.y = tmp.len end
|
|
||||||
end
|
|
||||||
|
|
||||||
local p2 = vec + Vector3.clone(worldedit.pos1[name])
|
|
||||||
worldedit.pos2[name] = p2
|
|
||||||
worldedit.mark_pos2(name)
|
|
||||||
return true, "position 2 set to "..p2
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue