mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-26 00:53:00 +00:00
Upgrade all selection commands
This commit is contained in:
parent
c3e8df3a9e
commit
4a56d45c4b
16 changed files with 149 additions and 96 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
-- ███████ ███████ ██ ███████ ██████ ████████ ██ ██████ ███ ██
|
-- ███████ ███████ ██ ███████ ██████ ████████ ██ ██████ ███ ██
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
|
||||||
-- ███████ █████ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ███████ █████ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
|
@ -15,14 +17,18 @@ function selection.add_point(name, pos)
|
||||||
if pos ~= nil then
|
if pos ~= nil then
|
||||||
local created_new = not worldedit.pos1[name] or not worldedit.pos2[name]
|
local created_new = not worldedit.pos1[name] or not worldedit.pos2[name]
|
||||||
-- print("[set_pos1]", name, "("..pos.x..", "..pos.y..", "..pos.z..")")
|
-- print("[set_pos1]", name, "("..pos.x..", "..pos.y..", "..pos.z..")")
|
||||||
if not worldedit.pos1[name] then worldedit.pos1[name] = vector.new(pos) end
|
if not worldedit.pos1[name] then worldedit.pos1[name] = Vector3.new(pos) end
|
||||||
if not worldedit.pos2[name] then worldedit.pos2[name] = vector.new(pos) end
|
if not worldedit.pos2[name] then worldedit.pos2[name] = Vector3.new(pos) end
|
||||||
|
|
||||||
worldedit.marker_update(name)
|
worldedit.marker_update(name)
|
||||||
|
|
||||||
local volume_before = worldedit.volume(worldedit.pos1[name], worldedit.pos2[name])
|
local volume_before = worldedit.volume(worldedit.pos1[name], worldedit.pos2[name])
|
||||||
|
|
||||||
worldedit.pos1[name], worldedit.pos2[name] = worldeditadditions.vector.expand_region(worldedit.pos1[name], worldedit.pos2[name], pos)
|
worldedit.pos1[name], worldedit.pos2[name] = Vector3.expand_region(
|
||||||
|
Vector3.new(worldedit.pos1[name]),
|
||||||
|
Vector3.new(worldedit.pos2[name]),
|
||||||
|
pos
|
||||||
|
)
|
||||||
|
|
||||||
local volume_after = worldedit.volume(worldedit.pos1[name], worldedit.pos2[name])
|
local volume_after = worldedit.volume(worldedit.pos1[name], worldedit.pos2[name])
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
--- Holds the per-user selection stacks.
|
--- Holds the per-user selection stacks.
|
||||||
worldeditadditions.sstack = {}
|
worldeditadditions.sstack = {}
|
||||||
|
|
||||||
|
@ -17,9 +20,11 @@ end
|
||||||
--- Inserts a selection region onto the stack for the user with the given name.
|
--- Inserts a selection region onto the stack for the user with the given name.
|
||||||
-- Stacks are per-user.
|
-- Stacks are per-user.
|
||||||
-- @param name string The name of the user to insert onto.
|
-- @param name string The name of the user to insert onto.
|
||||||
-- @param pos1 Vector Position 1
|
-- @param pos1 Vector3 Position 1
|
||||||
-- @param pos2 Vector Position 2
|
-- @param pos2 Vector3 Position 2
|
||||||
function worldeditadditions.spush(name, pos1, pos2)
|
function worldeditadditions.spush(name, pos1, pos2)
|
||||||
|
pos1 = Vector3.clon(pos1)
|
||||||
|
pos2 = Vector3.clon(pos2)
|
||||||
if not worldeditadditions.sstack[name] then
|
if not worldeditadditions.sstack[name] then
|
||||||
worldeditadditions.sstack[name] = {}
|
worldeditadditions.sstack[name] = {}
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,20 +6,20 @@
|
||||||
|
|
||||||
-- Chat commands that operate on selections.
|
-- Chat commands that operate on selections.
|
||||||
|
|
||||||
local we_cm = worldeditadditions_commands.modpath .. "/commands/selectors/"
|
local we_cmdpath = worldeditadditions_commands.modpath .. "/commands/selectors/"
|
||||||
|
|
||||||
dofile(we_cm.."srel.lua")
|
dofile(we_cmdpath.."srel.lua")
|
||||||
dofile(we_cm.."scentre.lua")
|
dofile(we_cmdpath.."scentre.lua")
|
||||||
dofile(we_cm.."scloud.lua")
|
dofile(we_cmdpath.."scloud.lua")
|
||||||
dofile(we_cm.."scol.lua")
|
dofile(we_cmdpath.."scol.lua")
|
||||||
dofile(we_cm.."scube.lua")
|
dofile(we_cmdpath.."scube.lua")
|
||||||
dofile(we_cm.."sfactor.lua")
|
dofile(we_cmdpath.."sfactor.lua")
|
||||||
dofile(we_cm.."smake.lua")
|
dofile(we_cmdpath.."smake.lua")
|
||||||
dofile(we_cm.."spop.lua")
|
dofile(we_cmdpath.."spop.lua")
|
||||||
dofile(we_cm.."spush.lua")
|
dofile(we_cmdpath.."spush.lua")
|
||||||
dofile(we_cm.."srect.lua")
|
dofile(we_cmdpath.."srect.lua")
|
||||||
dofile(we_cm.."sshift.lua")
|
dofile(we_cmdpath.."sshift.lua")
|
||||||
dofile(we_cm.."sstack.lua")
|
dofile(we_cmdpath.."sstack.lua")
|
||||||
|
|
||||||
-- Aliases
|
-- Aliases
|
||||||
worldedit.alias_command("sfac", "sfactor")
|
worldedit.alias_command("sfac", "sfactor")
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
-- ███████ ██████ ███████ ███ ██ ████████ ███████ ██████
|
-- ███████ ██████ ███████ ███ ██ ████████ ███████ ██████
|
||||||
-- ██ ██ ██ ████ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ████ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██ █████ ██ ██ ██ ██ █████ ██████
|
-- ███████ ██ █████ ██ ██ ██ ██ █████ ██████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██████ ███████ ██ ████ ██ ███████ ██ ██
|
-- ███████ ██████ ███████ ██ ████ ██ ███████ ██ ██
|
||||||
local wea = worldeditadditions
|
|
||||||
worldeditadditions_core.register_command("scentre", {
|
worldeditadditions_core.register_command("scentre", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "Set WorldEdit region positions 1 and 2 to the centre of the current selection.",
|
description = "Set WorldEdit region positions 1 and 2 to the centre of the current selection.",
|
||||||
|
@ -13,15 +15,17 @@ worldeditadditions_core.register_command("scentre", {
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
func = function(name)
|
func = function(name)
|
||||||
local vecs = {}
|
local mean = wea_c.vector.mean(worldedit.pos1[name],worldedit.pos2[name])
|
||||||
vecs.mean = wea.vector.mean(worldedit.pos1[name],worldedit.pos2[name])
|
local pos1, pos2 = Vector3.new(mean), Vector3.new(mean)
|
||||||
vecs.p1, vecs.p2 = vector.new(vecs.mean), vector.new(vecs.mean)
|
|
||||||
wea.vector.floor(vecs.p1)
|
pos1 = pos1:floor()
|
||||||
wea.vector.ceil(vecs.p2)
|
pos2 = pos2:ceil()
|
||||||
worldedit.pos1[name], worldedit.pos2[name] = vecs.p1, vecs.p2
|
|
||||||
|
worldedit.pos1[name], worldedit.pos2[name] = pos1, pos2
|
||||||
worldedit.mark_pos1(name)
|
worldedit.mark_pos1(name)
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
return true, "position 1 set to " .. minetest.pos_to_string(vecs.p1) .. ", position 2 set to " .. minetest.pos_to_string(vecs.p2)
|
|
||||||
|
return true, "position 1 set to "..pos1..", position 2 set to "..pos2
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
|
local wea = worldeditadditions
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
-- ██████ ██████ ██ ██████ ██ ██ ██████
|
-- ██████ ██████ ██ ██████ ██ ██ ██████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ███████ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ██████ ██████ ███████ ██████ ██████ ██████
|
-- ██████ ██████ ███████ ██████ ██████ ██████
|
||||||
local wea = worldeditadditions
|
|
||||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||||
local name = puncher:get_player_name()
|
local name = puncher:get_player_name()
|
||||||
if name ~= "" and wea.add_pos[name] ~= nil then
|
if name ~= "" and wea.add_pos[name] ~= nil then
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
-- ███████ ██████ ██████ ██
|
-- ███████ ██████ ██████ ██
|
||||||
-- ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██
|
||||||
-- ███████ ██ ██ ██ ██
|
-- ███████ ██ ██ ██ ██
|
||||||
-- ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██
|
||||||
-- ███████ ██████ ██████ ███████
|
-- ███████ ██████ ██████ ███████
|
||||||
local wea = worldeditadditions
|
|
||||||
worldeditadditions_core.register_command("scol", {
|
worldeditadditions_core.register_command("scol", {
|
||||||
params = "[<axis1>] <length>",
|
params = "[<axis1>] <length>",
|
||||||
description = "Set WorldEdit region position 2 at a set distance along 1 axis.",
|
description = "Set WorldEdit region position 2 at a set distance along 1 axis.",
|
||||||
privs = {worldedit=true},
|
privs = {worldedit=true},
|
||||||
require_pos = 1,
|
require_pos = 1,
|
||||||
parse = function(params_text)
|
parse = function(params_text)
|
||||||
local vec, tmp = vector.new(0, 0, 0), {}
|
local vec, tmp = Vector3.new(0, 0, 0), {}
|
||||||
local find = wea.split(params_text, "%s", false)
|
local find = wea_c.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)]
|
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)
|
tmp.len = tonumber(len)
|
||||||
-- If len == nil cancel the operation
|
-- If len == nil cancel the operation
|
||||||
|
@ -28,14 +30,14 @@ worldeditadditions_core.register_command("scol", {
|
||||||
end,
|
end,
|
||||||
func = function(name, vec, tmp)
|
func = function(name, vec, tmp)
|
||||||
if tmp.get then
|
if tmp.get then
|
||||||
local ax, dir = wea.player_axis2d(name)
|
local ax, dir = wea_c.player_axis2d(name)
|
||||||
vec[ax] = tmp.len * dir
|
vec[ax] = tmp.len * dir
|
||||||
end
|
end
|
||||||
|
|
||||||
local p2 = vector.add(vec,worldedit.pos1[name])
|
local pos2 = vec + Vector3.clone(worldedit.pos1[name])
|
||||||
worldedit.pos2[name] = p2
|
worldedit.pos2[name] = pos2
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
return true, "position 2 set to " .. minetest.pos_to_string(p2)
|
return true, "position 2 set to "..pos2
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
-- ███████ ██████ ██ ██ ██████ ███████
|
-- ███████ ██████ ██ ██ ██████ ███████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██ ██ ██ ██████ █████
|
-- ███████ ██ ██ ██ ██████ █████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██████ ██████ ██████ ███████
|
-- ███████ ██████ ██████ ██████ ███████
|
||||||
local wea = worldeditadditions
|
|
||||||
worldeditadditions_core.register_command("scube", {
|
worldeditadditions_core.register_command("scube", {
|
||||||
params = "[<axis1> [<axis2> [<axis3>]]] <length>",
|
params = "[<axis1> [<axis2> [<axis3>]]] <length>",
|
||||||
description = "Set WorldEdit region position 2 at a set distance along 3 axes.",
|
description = "Set WorldEdit region position 2 at a set distance along 3 axes.",
|
||||||
privs = { worldedit = true },
|
privs = { worldedit = true },
|
||||||
require_pos = 1,
|
require_pos = 1,
|
||||||
parse = function(params_text)
|
parse = function(params_text)
|
||||||
local vec, tmp = vector.new(0, 0, 0), {}
|
local vec, tmp = Vector3.new(0, 0, 0), {}
|
||||||
local find = wea.split(params_text, "%s", false)
|
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),
|
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)
|
(tostring(find[3]):match('[xyz]') or "g"):sub(1,1)
|
||||||
local sn1, sn2, sn3, len = wea.getsign(find[1]), wea.getsign(find[2]), wea.getsign(find[3]), find[table.maxn(find)]
|
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)
|
tmp.len = tonumber(len)
|
||||||
-- If len is nill cancel the operation
|
-- If len is nill cancel the operation
|
||||||
|
@ -36,17 +38,17 @@ worldeditadditions_core.register_command("scube", {
|
||||||
end,
|
end,
|
||||||
func = function(name, vec, tmp)
|
func = function(name, vec, tmp)
|
||||||
if tmp.get then
|
if tmp.get then
|
||||||
local ax, dir = wea.player_axis2d(name)
|
local ax, dir = wea_c.player_axis2d(name)
|
||||||
local _, left, sn = wea.axis_left(ax,dir)
|
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("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("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
|
if not tmp.axes:find("y") then vec.y = tmp.len end
|
||||||
end
|
end
|
||||||
|
|
||||||
local p2 = vector.add(vec,worldedit.pos1[name])
|
local pos2 = vec + Vector3.clone(worldedit.pos1[name])
|
||||||
worldedit.pos2[name] = p2
|
worldedit.pos2[name] = pos2
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
return true, "position 2 set to " .. minetest.pos_to_string(p2)
|
return true, "position 2 set to "..pos2
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,26 @@
|
||||||
|
local wea = worldeditadditions
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
|
|
||||||
-- ███████ ███████ █████ ██████ ████████ ██████ ██████
|
-- ███████ ███████ █████ ██████ ████████ ██████ ██████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ █████ ███████ ██ ██ ██ ██ ██████
|
-- ███████ █████ ███████ ██ ██ ██ ██ ██████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██ ██ ██ ██████ ██ ██████ ██ ██
|
-- ███████ ██ ██ ██ ██████ ██ ██████ ██ ██
|
||||||
local wea = worldeditadditions
|
|
||||||
worldeditadditions_core.register_command("sfactor", {
|
worldeditadditions_core.register_command("sfactor", {
|
||||||
params = "<mode> <factor> [<target=xz>]",
|
params = "<mode> <factor> [<target=xz>]",
|
||||||
description = "Make the length of one or more target axes of the current selection to be multiple(s) of <factor>.",
|
description = "Make the length of one or more target axes of the current selection to be multiple(s) of <factor>.",
|
||||||
privs = { worldedit = true },
|
privs = { worldedit = true },
|
||||||
require_pos = 2,
|
require_pos = 2,
|
||||||
parse = function(params_text)
|
parse = function(params_text)
|
||||||
local parts = wea.split(params_text, "%s+", false)
|
local parts = wea_c.split(params_text, "%s+", false)
|
||||||
|
|
||||||
if #parts < 2 then
|
if #parts < 2 then
|
||||||
return false, "Error: Not enough arguments. Expected \"<mode> <factor> [<target>]\"."
|
return false, "Error: Not enough arguments. Expected \"<mode> <factor> [<target>]\"."
|
||||||
end
|
end
|
||||||
local mode, fac, targ = unpack(parts)
|
local mode, fac, targ = wea_c.table.unpack(parts)
|
||||||
local modeSet = wea.table.makeset {"grow", "shrink", "avg"}
|
local modeSet = wea_c.table.makeset {"grow", "shrink", "avg"}
|
||||||
|
|
||||||
-- Mode parsing
|
-- Mode parsing
|
||||||
if mode == "average" then -- If mode is average set to avg
|
if mode == "average" then -- If mode is average set to avg
|
||||||
|
@ -39,7 +43,7 @@ worldeditadditions_core.register_command("sfactor", {
|
||||||
if not targ then -- If no target set to default (xz)
|
if not targ then -- If no target set to default (xz)
|
||||||
targ = "xz"
|
targ = "xz"
|
||||||
elseif targ:match("[xyz]+") then -- ensure correct target syntax
|
elseif targ:match("[xyz]+") then -- ensure correct target syntax
|
||||||
targ = table.concat(wea.tochars(targ:match("[xyz]+"),true,true))
|
targ = table.concat(wea_c.tochars(targ:match("[xyz]+"),true,true))
|
||||||
else
|
else
|
||||||
return false, "Error: Invalid <target> \""..targ.."\". Expected \"x\" and or \"y\" and or \"z\"."
|
return false, "Error: Invalid <target> \""..targ.."\". Expected \"x\" and or \"y\" and or \"z\"."
|
||||||
end
|
end
|
||||||
|
@ -47,10 +51,10 @@ worldeditadditions_core.register_command("sfactor", {
|
||||||
return true, mode, fac, targ
|
return true, mode, fac, targ
|
||||||
end,
|
end,
|
||||||
func = function(name, mode, fac, targ)
|
func = function(name, mode, fac, targ)
|
||||||
local p1, p2 = vector.new(worldedit.pos1[name]), vector.new(worldedit.pos2[name])
|
local pos1, pos2 = Vector3.clone(worldedit.pos1[name]), Vector3.clone(worldedit.pos2[name])
|
||||||
local delta = vector.subtract(p2,p1) -- local delta equation: Vd(a) = V2(a) - V1(a)
|
local delta = pos2 - pos1 -- local delta equation: Vd(a) = V2(a) - V1(a)
|
||||||
local _tl = #targ -- Get targ length as a variable incase mode is "average"/"avg"
|
local _tl = #targ -- Get targ length as a variable incase mode is "average"/"avg"
|
||||||
local targ = wea.tocharset(targ) -- Break up targ string into set table
|
local targ = wea_c.tocharset(targ) -- Break up targ string into set table
|
||||||
local _m = 0 -- _m is the container to hold the average of the axes in targ
|
local _m = 0 -- _m is the container to hold the average of the axes in targ
|
||||||
|
|
||||||
-- set _m to the max, min or mean of the target axes depending on mode (_tl is the length of targ) or base if it exists
|
-- set _m to the max, min or mean of the target axes depending on mode (_tl is the length of targ) or base if it exists
|
||||||
|
@ -59,7 +63,7 @@ worldeditadditions_core.register_command("sfactor", {
|
||||||
_m = _m / _tl
|
_m = _m / _tl
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Equasion: round(delta[<axis>] / factor) * factor
|
-- Equation: round(delta[<axis>] / factor) * factor
|
||||||
local eval = function(int,fac_inner)
|
local eval = function(int,fac_inner)
|
||||||
local tmp, abs, neg = int / fac_inner, math.abs(int), int < 0
|
local tmp, abs, neg = int / fac_inner, math.abs(int), int < 0
|
||||||
|
|
||||||
|
@ -76,8 +80,8 @@ worldeditadditions_core.register_command("sfactor", {
|
||||||
|
|
||||||
for k,v in pairs(targ) do delta[k] = eval(delta[k],fac) end
|
for k,v in pairs(targ) do delta[k] = eval(delta[k],fac) end
|
||||||
|
|
||||||
worldedit.pos2[name] = vector.add(p1,delta)
|
worldedit.pos2[name] = pos1 + delta
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
return true, "position 2 set to " .. minetest.pos_to_string(p2)
|
return true, "position 2 set to "..pos2
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
|
local wea = worldeditadditions
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
|
|
||||||
-- ███████ ███ ███ █████ ██ ██ ███████
|
-- ███████ ███ ███ █████ ██ ██ ███████
|
||||||
-- ██ ████ ████ ██ ██ ██ ██ ██
|
-- ██ ████ ████ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██ ████ ██ ███████ █████ █████
|
-- ███████ ██ ████ ██ ███████ █████ █████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██ ██ ██ ██ ██ ██ ███████
|
-- ███████ ██ ██ ██ ██ ██ ██ ███████
|
||||||
local wea = worldeditadditions
|
|
||||||
worldeditadditions_core.register_command("smake", {
|
worldeditadditions_core.register_command("smake", {
|
||||||
params = "<operation:odd|even|equal> <mode:grow|shrink|average> [<target=xyz> [<base>]]",
|
params = "<operation:odd|even|equal> <mode:grow|shrink|average> [<target=xyz> [<base>]]",
|
||||||
description = "Make one or more axes of the current selection odd, even, or equal to another.",
|
description = "Make one or more axes of the current selection odd, even, or equal to another.",
|
||||||
|
@ -11,7 +15,7 @@ worldeditadditions_core.register_command("smake", {
|
||||||
require_pos = 2,
|
require_pos = 2,
|
||||||
parse = function(params_text)
|
parse = function(params_text)
|
||||||
-- Split params_text, check for missing arguments and fill in empty spots
|
-- Split params_text, check for missing arguments and fill in empty spots
|
||||||
local parts = wea.split(params_text, "%s+", false)
|
local parts = wea_c.split(params_text, "%s+", false)
|
||||||
if #parts < 2 then
|
if #parts < 2 then
|
||||||
return false, "Error: Not enough arguments. Expected \"<operation> <mode> [<target=xyz> [<base>]]\"."
|
return false, "Error: Not enough arguments. Expected \"<operation> <mode> [<target=xyz> [<base>]]\"."
|
||||||
else
|
else
|
||||||
|
@ -19,8 +23,8 @@ worldeditadditions_core.register_command("smake", {
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Initialize local variables and sets
|
-- Initialize local variables and sets
|
||||||
local oper, mode, targ, base = wea.table.unpack(parts)
|
local oper, mode, targ, base = wea_c.table.unpack(parts)
|
||||||
local operSet, modeSet = wea.table.makeset {"equal", "odd", "even"}, wea.table.makeset {"grow", "shrink", "avg"}
|
local operSet, modeSet = wea_c.table.makeset {"equal", "odd", "even"}, wea_c.table.makeset {"grow", "shrink", "avg"}
|
||||||
|
|
||||||
-- Main Logic
|
-- Main Logic
|
||||||
-- Check base if base is present and if so valid.
|
-- Check base if base is present and if so valid.
|
||||||
|
@ -36,7 +40,7 @@ worldeditadditions_core.register_command("smake", {
|
||||||
if not targ then -- If no target set to default (xz)
|
if not targ then -- If no target set to default (xz)
|
||||||
targ = "xz"
|
targ = "xz"
|
||||||
elseif targ:match("[xyz]+") then -- ensure correct target syntax
|
elseif targ:match("[xyz]+") then -- ensure correct target syntax
|
||||||
targ = table.concat(wea.tochars(targ:match("[xyz]+"),true,true))
|
targ = table.concat(wea_c.tochars(targ:match("[xyz]+"),true,true))
|
||||||
else
|
else
|
||||||
return false, "Error: Invalid <target> \""..targ.."\". Expected \"x\" and or \"y\" and or \"z\"."
|
return false, "Error: Invalid <target> \""..targ.."\". Expected \"x\" and or \"y\" and or \"z\"."
|
||||||
end
|
end
|
||||||
|
@ -44,7 +48,7 @@ worldeditadditions_core.register_command("smake", {
|
||||||
if mode == "average" then -- If mode is average set to avg
|
if mode == "average" then -- If mode is average set to avg
|
||||||
mode = "avg"
|
mode = "avg"
|
||||||
elseif mode:match("[xyz]+") then -- If target is actually base set vars to correct values.
|
elseif mode:match("[xyz]+") then -- If target is actually base set vars to correct values.
|
||||||
base, targ, mode = targ:sub(1,1), table.concat(wea.tochars(mode:match("[xyz]+"),true,true)), false
|
base, targ, mode = targ:sub(1,1), table.concat(wea_c.tochars(mode:match("[xyz]+"),true,true)), false
|
||||||
elseif not modeSet[mode] and not base then -- If mode is invalid and base isn't present throw error
|
elseif not modeSet[mode] and not base then -- If mode is invalid and base isn't present throw error
|
||||||
return false, "Error: Invalid <mode> \""..mode.."\". Expected \"grow\", \"shrink\", or \"average\"/\"avg\"."
|
return false, "Error: Invalid <mode> \""..mode.."\". Expected \"grow\", \"shrink\", or \"average\"/\"avg\"."
|
||||||
end
|
end
|
||||||
|
@ -64,12 +68,12 @@ worldeditadditions_core.register_command("smake", {
|
||||||
return true, oper, mode, targ, base
|
return true, oper, mode, targ, base
|
||||||
end,
|
end,
|
||||||
func = function(name, oper, mode, targ, base)
|
func = function(name, oper, mode, targ, base)
|
||||||
local p1, p2 = vector.new(worldedit.pos1[name]), vector.new(worldedit.pos2[name])
|
local pos1, pos2 = Vector3.clone(worldedit.pos1[name]), Vector3.clone(worldedit.pos2[name])
|
||||||
local eval -- Declare eval placeholder function to edit later
|
local eval -- Declare eval placeholder function to edit later
|
||||||
|
|
||||||
local delta = vector.subtract(p2,p1) -- local delta equation: Vd(a) = V2(a) - V1(a)
|
local delta = pos2 - pos1 -- local delta equation: Vd(a) = V2(a) - V1(a)
|
||||||
local _tl = #targ -- Get targ length as a variable incase mode is "average"/"avg"
|
local _tl = #targ -- Get targ length as a variable incase mode is "average"/"avg"
|
||||||
local targ = wea.tocharset(targ) -- Break up targ string into set table
|
local targ = wea_c.tocharset(targ) -- Break up targ string into set table
|
||||||
local _m = 0 -- _m is the container to hold the max, min or average (depending on the mode) of the axes in targ
|
local _m = 0 -- _m is the container to hold the max, min or average (depending on the mode) of the axes in targ
|
||||||
|
|
||||||
-- set _m to the max, min or mean of the target axes depending on mode or base if it exists
|
-- set _m to the max, min or mean of the target axes depending on mode or base if it exists
|
||||||
|
@ -122,8 +126,8 @@ worldeditadditions_core.register_command("smake", {
|
||||||
|
|
||||||
for k,v in pairs(targ) do delta[k] = eval(delta[k]) end
|
for k,v in pairs(targ) do delta[k] = eval(delta[k]) end
|
||||||
|
|
||||||
worldedit.pos2[name] = vector.add(p1,delta)
|
worldedit.pos2[name] = pos1 + delta
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
return true, "position 2 set to " .. minetest.pos_to_string(p2)
|
return true, "position 2 set to "..pos2
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
local wea = worldeditadditions
|
||||||
|
|
||||||
|
|
||||||
-- ███████ ██████ ██████ ██████
|
-- ███████ ██████ ██████ ██████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██████ ██ ██ ██████
|
-- ███████ ██████ ██ ██ ██████
|
||||||
|
@ -14,18 +17,18 @@ worldeditadditions_core.register_command("spop", {
|
||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
func = function(name)
|
func = function(name)
|
||||||
local success, pos1, pos2 = worldeditadditions.spop(name)
|
local success, pos1, pos2 = wea.spop(name)
|
||||||
if not success then return success, pos1 end
|
if not success then return success, pos1 end
|
||||||
|
|
||||||
worldedit.pos1[name] = pos1
|
worldedit.pos1[name] = pos1
|
||||||
worldedit.pos2[name] = pos2
|
worldedit.pos2[name] = pos2
|
||||||
worldedit.marker_update(name)
|
worldedit.marker_update(name)
|
||||||
|
|
||||||
local new_count = worldeditadditions.scount(name)
|
local new_count = wea.scount(name)
|
||||||
local plural = "s are"
|
local plural = "s are"
|
||||||
if new_count == 1 then plural = " is" end
|
if new_count == 1 then plural = " is" end
|
||||||
|
|
||||||
local region_text = worldeditadditions.vector.tostring(worldedit.pos1[name]).." - "..worldeditadditions.vector.tostring(worldedit.pos2[name])
|
local region_text = pos1.." - "..pos2
|
||||||
|
|
||||||
minetest.log("action", name .. " used //spopped at "..region_text..". Stack height is now " .. new_count.." regions")
|
minetest.log("action", name .. " used //spopped at "..region_text..". Stack height is now " .. new_count.." regions")
|
||||||
return true, "Region "..region_text.." popped from selection stack; "..new_count.." region"..plural.." now in the stack"
|
return true, "Region "..region_text.." popped from selection stack; "..new_count.." region"..plural.." now in the stack"
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
local wea = worldeditadditions
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
-- ███████ ██████ ██ ██ ███████ ██ ██
|
-- ███████ ██████ ██ ██ ███████ ██ ██
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██████ ██ ██ ███████ ███████
|
-- ███████ ██████ ██ ██ ███████ ███████
|
||||||
|
@ -15,16 +19,18 @@ worldeditadditions_core.register_command("spush", {
|
||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
func = function(name)
|
func = function(name)
|
||||||
local success, msg = worldeditadditions.spush(name, worldedit.pos1[name], worldedit.pos2[name])
|
local pos1 = Vector3.clone(worldedit.pos1[name])
|
||||||
|
local pos2 = Vector3.clone(worldedit.pos2[name])
|
||||||
|
local success, msg = wea.spush(name, pos1, pos2)
|
||||||
if not success then
|
if not success then
|
||||||
return success, msg
|
return success, msg
|
||||||
end
|
end
|
||||||
|
|
||||||
local new_count = worldeditadditions.scount(name)
|
local new_count = wea.scount(name)
|
||||||
local plural = "s are"
|
local plural = "s are"
|
||||||
if new_count == 1 then plural = " is" end
|
if new_count == 1 then plural = " is" end
|
||||||
|
|
||||||
local region_text = worldeditadditions.vector.tostring(worldedit.pos1[name]).." - "..worldeditadditions.vector.tostring(worldedit.pos2[name])
|
local region_text = pos1.." - "..pos2
|
||||||
|
|
||||||
minetest.log("action", name .. " used //spush at "..region_text..". Stack height is now " .. new_count.." regions")
|
minetest.log("action", name .. " used //spush at "..region_text..". Stack height is now " .. new_count.." regions")
|
||||||
return true, "Region "..region_text.." pushed onto selection stack; "..new_count.." region"..plural.." now in the stack"
|
return true, "Region "..region_text.." pushed onto selection stack; "..new_count.." region"..plural.." now in the stack"
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
|
local wea = worldeditadditions
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
-- ███████ ██████ ███████ ██████ ████████
|
-- ███████ ██████ ███████ ██████ ████████
|
||||||
-- ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██████ █████ ██ ██
|
-- ███████ ██████ █████ ██ ██
|
||||||
-- ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██ ██ ███████ ██████ ██
|
-- ███████ ██ ██ ███████ ██████ ██
|
||||||
local wea = worldeditadditions
|
|
||||||
worldeditadditions_core.register_command("srect", {
|
worldeditadditions_core.register_command("srect", {
|
||||||
params = "[<axis1> [<axis2>]] <length>",
|
params = "[<axis1> [<axis2>]] <length>",
|
||||||
description = "Set WorldEdit region position 2 at a set distance along 2 axes.",
|
description = "Set WorldEdit region position 2 at a set distance along 2 axes.",
|
||||||
privs = { worldedit = true },
|
privs = { worldedit = true },
|
||||||
require_pos = 1,
|
require_pos = 1,
|
||||||
parse = function(params_text)
|
parse = function(params_text)
|
||||||
local vec, tmp = vector.new(0, 0, 0), {}
|
local vec, tmp = Vector3.new(0, 0, 0), {}
|
||||||
local find = wea.split(params_text, "%s", false)
|
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 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)]
|
local sn1, sn2, len = wea_c.getsign(find[1]), wea_c.getsign(find[2]), find[table.maxn(find)]
|
||||||
|
|
||||||
tmp.len = tonumber(len)
|
tmp.len = tonumber(len)
|
||||||
-- If len == nill cancel the operation
|
-- If len == nill cancel the operation
|
||||||
|
@ -33,15 +36,15 @@ worldeditadditions_core.register_command("srect", {
|
||||||
end,
|
end,
|
||||||
func = function(name, vec, tmp)
|
func = function(name, vec, tmp)
|
||||||
if tmp.get then
|
if tmp.get then
|
||||||
local ax, dir = wea.player_axis2d(name)
|
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("[xz]") then vec[ax] = tmp.len * dir end
|
||||||
if not tmp.axes:find("y") then vec.y = tmp.len end
|
if not tmp.axes:find("y") then vec.y = tmp.len end
|
||||||
end
|
end
|
||||||
|
|
||||||
local p2 = vector.add(vec,worldedit.pos1[name])
|
local p2 = vec + Vector3.clone(worldedit.pos1[name])
|
||||||
worldedit.pos2[name] = p2
|
worldedit.pos2[name] = p2
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
return true, "position 2 set to " .. minetest.pos_to_string(p2)
|
return true, "position 2 set to "..p2
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
|
local wea = worldeditadditions
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
|
|
||||||
-- ███████ ██████ ███████ ██
|
-- ███████ ██████ ███████ ██
|
||||||
-- ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██
|
||||||
-- ███████ ██████ █████ ██
|
-- ███████ ██████ █████ ██
|
||||||
-- ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██
|
||||||
-- ███████ ██ ██ ███████ ███████
|
-- ███████ ██ ██ ███████ ███████
|
||||||
local wea = worldeditadditions
|
|
||||||
local function parse_with_name(name,args)
|
local function parse_with_name(name,args)
|
||||||
local vec, tmp = vector.new(0, 0, 0), {}
|
local vec, tmp = Vector3.new(0, 0, 0), {}
|
||||||
local find, _, i = {}, 0, 0
|
local find, _, i = {}, 0, 0
|
||||||
repeat
|
repeat
|
||||||
_, i, tmp.proc = args:find("([%l%s+-]+%d+)%s*", i)
|
_, i, tmp.proc = args:find("([%l%s+-]+%d+)%s*", i)
|
||||||
|
@ -13,7 +17,7 @@ local function parse_with_name(name,args)
|
||||||
tmp.ax = tmp.proc:match("[xyz]")
|
tmp.ax = tmp.proc:match("[xyz]")
|
||||||
tmp.dir = tonumber(tmp.proc:match("[+-]?%d+")) * (tmp.proc:match("-%l+") and -1 or 1)
|
tmp.dir = tonumber(tmp.proc:match("[+-]?%d+")) * (tmp.proc:match("-%l+") and -1 or 1)
|
||||||
else
|
else
|
||||||
tmp.ax, _ = wea.dir_to_xyz(name, tmp.proc:match("%l+"))
|
tmp.ax, _ = wea_c.dir_to_xyz(name, tmp.proc:match("%l+"))
|
||||||
if not tmp.ax then return false, _ end
|
if not tmp.ax then return false, _ end
|
||||||
tmp.dir = tonumber(tmp.proc:match("[+-]?%d+")) * (tmp.proc:match("-%l+") and -1 or 1) * _
|
tmp.dir = tonumber(tmp.proc:match("[+-]?%d+")) * (tmp.proc:match("-%l+") and -1 or 1) * _
|
||||||
end
|
end
|
||||||
|
@ -36,17 +40,17 @@ worldeditadditions_core.register_command("srel", {
|
||||||
if not _ then return false, vec end
|
if not _ then return false, vec end
|
||||||
|
|
||||||
if not worldedit.pos1[name] then
|
if not worldedit.pos1[name] then
|
||||||
local pos = vector.add(wea.player_vector(name), vector.new(0.5,-0.5,0.5))
|
local pos = wea_c.player_vector(name) + Vector3.new(0.5, -0.5, 0.5)
|
||||||
wea.vector.floor(pos)
|
pos = pos:floor()
|
||||||
worldedit.pos1[name] = pos
|
worldedit.pos1[name] = pos
|
||||||
worldedit.mark_pos1(name)
|
worldedit.mark_pos1(name)
|
||||||
ret = "position 1 set to " .. minetest.pos_to_string(pos) .. ", "
|
ret = "position 1 set to "..pos..", "
|
||||||
end
|
end
|
||||||
|
|
||||||
local p2 = vector.add(vec,worldedit.pos1[name])
|
local p2 = vec + Vector3.clone(worldedit.pos1[name])
|
||||||
worldedit.pos2[name] = p2
|
worldedit.pos2[name] = p2
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
return true, ret .. "position 2 set to " .. minetest.pos_to_string(p2)
|
return true, ret.."position 2 set to "..p2
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
|
local wea = worldeditadditions
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = worldeditadditions.Vector3
|
||||||
|
|
||||||
-- ███████ ███████ ██ ██ ██ ███████ ████████
|
-- ███████ ███████ ██ ██ ██ ███████ ████████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ███████ ███████ ██ █████ ██
|
-- ███████ ███████ ███████ ██ █████ ██
|
||||||
-- ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ███████ ██ ██ ██ ██ ██
|
-- ███████ ███████ ██ ██ ██ ██ ██
|
||||||
local wea = worldeditadditions
|
|
||||||
local v3 = worldeditadditions.Vector3
|
|
||||||
local function parse_with_name(name,args)
|
local function parse_with_name(name,args)
|
||||||
local vec, tmp = v3.new(0, 0, 0), {}
|
local vec, tmp = Vector3.new(0, 0, 0), {}
|
||||||
local find, _, i = {}, 0, 0
|
local find, _, i = {}, 0, 0
|
||||||
repeat
|
repeat
|
||||||
_, i, tmp.proc = args:find("([%l%s+-]+%d+)%s*", i)
|
_, i, tmp.proc = args:find("([%l%s+-]+%d+)%s*", i)
|
||||||
|
@ -14,7 +17,7 @@ local function parse_with_name(name,args)
|
||||||
tmp.ax = tmp.proc:match("[xyz]")
|
tmp.ax = tmp.proc:match("[xyz]")
|
||||||
tmp.dir = tonumber(tmp.proc:match("[+-]?%d+")) * (tmp.proc:match("-%l+") and -1 or 1)
|
tmp.dir = tonumber(tmp.proc:match("[+-]?%d+")) * (tmp.proc:match("-%l+") and -1 or 1)
|
||||||
else
|
else
|
||||||
tmp.ax, _ = wea.dir_to_xyz(name, tmp.proc:match("%l+"))
|
tmp.ax, _ = wea_c.dir_to_xyz(name, tmp.proc:match("%l+"))
|
||||||
if not tmp.ax then return false, _ end
|
if not tmp.ax then return false, _ end
|
||||||
tmp.dir = tonumber(tmp.proc:match("[+-]?%d+")) * (tmp.proc:match("-%l+") and -1 or 1) * _
|
tmp.dir = tonumber(tmp.proc:match("[+-]?%d+")) * (tmp.proc:match("-%l+") and -1 or 1) * _
|
||||||
end
|
end
|
||||||
|
@ -22,6 +25,7 @@ local function parse_with_name(name,args)
|
||||||
until not args:find("([%l%s+-]+%d+)%s*", i)
|
until not args:find("([%l%s+-]+%d+)%s*", i)
|
||||||
return true, vec
|
return true, vec
|
||||||
end
|
end
|
||||||
|
|
||||||
worldeditadditions_core.register_command("sshift", {
|
worldeditadditions_core.register_command("sshift", {
|
||||||
params = "<axis1> <distance1> [<axis2> <distance2> [<axis3> <distance3>]]",
|
params = "<axis1> <distance1> [<axis2> <distance2> [<axis3> <distance3>]]",
|
||||||
description = "Shift the WorldEdit region in 3 dimensions.",
|
description = "Shift the WorldEdit region in 3 dimensions.",
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
|
||||||
-- ███████ ███████ ████████ █████ ██████ ██ ██
|
-- ███████ ███████ ████████ █████ ██████ ██ ██
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ███████ ██ ███████ ██ █████
|
-- ███████ ███████ ██ ███████ ██ █████
|
||||||
|
@ -20,8 +22,9 @@ worldeditadditions_core.register_command("sstack", {
|
||||||
table.insert(result, "(empty)")
|
table.insert(result, "(empty)")
|
||||||
else
|
else
|
||||||
for i,item in ipairs(worldeditadditions.sstack[name]) do
|
for i,item in ipairs(worldeditadditions.sstack[name]) do
|
||||||
|
-- TODO: Implement a volume command....
|
||||||
local volume = worldedit.volume(item[1], item[2])
|
local volume = worldedit.volume(item[1], item[2])
|
||||||
local volume_text = worldeditadditions.format.human_size(volume, 2)
|
local volume_text = wea_c.format.human_size(volume, 2)
|
||||||
if volume > 1000 then volume_text = "~"..volume_text end
|
if volume > 1000 then volume_text = "~"..volume_text end
|
||||||
|
|
||||||
table.insert(result, i)
|
table.insert(result, i)
|
||||||
|
@ -29,9 +32,9 @@ worldeditadditions_core.register_command("sstack", {
|
||||||
|
|
||||||
table.insert(result, volume_text)
|
table.insert(result, volume_text)
|
||||||
table.insert(result, " nodes - ")
|
table.insert(result, " nodes - ")
|
||||||
table.insert(result, worldeditadditions.vector.tostring(item[1]))
|
table.insert(result, tostring(item[1])) -- Vector3 instance
|
||||||
table.insert(result, " - ")
|
table.insert(result, " - ")
|
||||||
table.insert(result, worldeditadditions.vector.tostring(item[2]))
|
table.insert(result, tostring(item[2])) -- Vector3 instance
|
||||||
table.insert(result, "\n")
|
table.insert(result, "\n")
|
||||||
end
|
end
|
||||||
table.insert(result, "========================\nTotal ")
|
table.insert(result, "========================\nTotal ")
|
||||||
|
|
|
@ -4,7 +4,7 @@ local v3 = worldeditadditions_core.Vector3
|
||||||
-- @param name string The name of the player to return facing direction of.
|
-- @param name string The name of the player to return facing direction of.
|
||||||
-- @return vector Returns position.
|
-- @return vector Returns position.
|
||||||
function wea_c.player_vector(name)
|
function wea_c.player_vector(name)
|
||||||
return minetest.get_player_by_name(name):get_pos()
|
return v3.clone(minetest.get_player_by_name(name):get_pos())
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the player's facing info including relative DIRs.
|
--- Returns the player's facing info including relative DIRs.
|
||||||
|
|
Loading…
Reference in a new issue