mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-12-22 19:45:02 +00:00
localize wea
This commit is contained in:
parent
bdb51ff944
commit
ff9abded2e
3 changed files with 10 additions and 7 deletions
|
@ -3,13 +3,14 @@
|
|||
-- ███████ ██ ██ ██ ██
|
||||
-- ██ ██ ██ ██ ██
|
||||
-- ███████ ██████ ██████ ███████
|
||||
local wea = worldeditadditions
|
||||
worldedit.register_command("scol", {
|
||||
params = "[<axis1>] <length>",
|
||||
description = "Set WorldEdit region position 2 at a set distance along 1 axis.",
|
||||
privs = {worldedit=true},
|
||||
require_pos = 1,
|
||||
parse = function(params_text)
|
||||
local wea, vec, tmp = worldeditadditions, vector.new(0, 0, 0), {}
|
||||
local vec, tmp = vector.new(0, 0, 0), {}
|
||||
local find = wea.split(params_text, "%s", false)
|
||||
local ax1, sn1, len = (tostring(find[1]):match('[xyz]') or "g"):sub(1,1), wea.getsign(find[1]), find[table.maxn(find)]
|
||||
|
||||
|
@ -24,7 +25,7 @@ worldedit.register_command("scol", {
|
|||
end,
|
||||
func = function(name, vec, tmp)
|
||||
if tmp.get then
|
||||
local ax, dir = worldeditadditions.player_axis2d(name)
|
||||
local ax, dir = wea.player_axis2d(name)
|
||||
vec[ax] = tmp.len * dir
|
||||
end
|
||||
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
-- ███████ ██ ██ ██ ██████ █████
|
||||
-- ██ ██ ██ ██ ██ ██ ██
|
||||
-- ███████ ██████ ██████ ██████ ███████
|
||||
local wea = worldeditadditions
|
||||
worldedit.register_command("scube", {
|
||||
params = "[<axis1> [<axis2> [<axis3>]]] <length>",
|
||||
description = "Set WorldEdit region position 2 at a set distance along 3 axes.",
|
||||
privs = { worldedit = true },
|
||||
require_pos = 1,
|
||||
parse = function(params_text)
|
||||
local wea, vec, tmp = worldeditadditions, vector.new(0, 0, 0), {}
|
||||
local vec, tmp = vector.new(0, 0, 0), {}
|
||||
local find = wea.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)
|
||||
|
@ -31,8 +32,8 @@ worldedit.register_command("scube", {
|
|||
end,
|
||||
func = function(name, vec, tmp)
|
||||
if tmp.get then
|
||||
local ax, dir = worldeditadditions.player_axis2d(name)
|
||||
local _, left, sn = worldeditadditions.axis_left(ax,dir)
|
||||
local ax, dir = wea.player_axis2d(name)
|
||||
local _, left, sn = wea.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
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
-- ███████ ██████ █████ ██ ██
|
||||
-- ██ ██ ██ ██ ██ ██
|
||||
-- ███████ ██ ██ ███████ ██████ ██
|
||||
local wea = worldeditadditions
|
||||
worldedit.register_command("srect", {
|
||||
params = "[<axis1> [<axis2>]] <length>",
|
||||
description = "Set WorldEdit region position 2 at a set distance along 2 axes.",
|
||||
privs = { worldedit = true },
|
||||
require_pos = 1,
|
||||
parse = function(params_text)
|
||||
local wea, vec, tmp = worldeditadditions, vector.new(0, 0, 0), {}
|
||||
local vec, tmp = vector.new(0, 0, 0), {}
|
||||
local find = wea.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.getsign(find[1]), wea.getsign(find[2]), find[table.maxn(find)]
|
||||
|
@ -28,7 +29,7 @@ worldedit.register_command("srect", {
|
|||
end,
|
||||
func = function(name, vec, tmp)
|
||||
if tmp.get then
|
||||
local ax, dir = worldeditadditions.player_axis2d(name)
|
||||
local ax, dir = wea.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
|
||||
|
|
Loading…
Reference in a new issue