mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 07:23:00 +00:00
Upgrade the last of the commands o/
This commit is contained in:
parent
6102a1adf5
commit
21c5b9d483
7 changed files with 50 additions and 23 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
|
||||||
-- ███████ █████ ██████ ██ ██ ███ ██ ██████ █████ ██ ██ █████ ███████ ███████ ███████
|
-- ███████ █████ ██████ ██ ██ ███ ██ ██████ █████ ██ ██ █████ ███████ ███████ ███████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ███████ ██████ ██ ██ ██ ██ ██ ██ ███ ███████ ██ ██ ███████ ███████ █████ ███████
|
-- ███████ ███████ ██████ ██ ██ ██ ██ ██ ██ ███ ███████ ██ ██ ███████ ███████ █████ ███████
|
||||||
|
@ -17,15 +19,15 @@ minetest.register_chatcommand("/saplingaliases", {
|
||||||
|
|
||||||
if params_text == "aliases" then
|
if params_text == "aliases" then
|
||||||
table.insert(msg, "Currently registered aliases:\n")
|
table.insert(msg, "Currently registered aliases:\n")
|
||||||
local aliases = worldeditadditions.get_all_sapling_aliases()
|
local aliases = wea_c.get_all_sapling_aliases()
|
||||||
local display = {}
|
local display = {}
|
||||||
for node_name, alias in pairs(aliases) do
|
for node_name, alias in pairs(aliases) do
|
||||||
table.insert(display, { node_name, alias })
|
table.insert(display, { node_name, alias })
|
||||||
end
|
end
|
||||||
table.sort(display, function(a, b) return a[2] < b[2] end)
|
table.sort(display, function(a, b) return a[2] < b[2] end)
|
||||||
table.insert(msg, worldeditadditions.format.make_ascii_table(display))
|
table.insert(msg, wea_c.format.make_ascii_table(display))
|
||||||
elseif params_text == "all_saplings" then
|
elseif params_text == "all_saplings" then
|
||||||
local results = worldeditadditions.registered_nodes_by_group("sapling")
|
local results = wea_c.registered_nodes_by_group("sapling")
|
||||||
table.insert(msg, "Sapling-like nodes:\n")
|
table.insert(msg, "Sapling-like nodes:\n")
|
||||||
local str = table.concat(results, "\n")
|
local str = table.concat(results, "\n")
|
||||||
table.insert(msg, str)
|
table.insert(msg, str)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
local wea = worldeditadditions
|
local wea = worldeditadditions
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
|
||||||
-- ███████ ██████ ██ ██ ██ ██████ ████████ ██ ██ ███████ ████████
|
-- ███████ ██████ ██ ██ ██ ██████ ████████ ██ ██ ███████ ████████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
|
@ -12,7 +13,7 @@ minetest.register_chatcommand("/sculptlist", {
|
||||||
func = function(name, params_text)
|
func = function(name, params_text)
|
||||||
if name == nil then return end
|
if name == nil then return end
|
||||||
if not params_text then params_text = "" end
|
if not params_text then params_text = "" end
|
||||||
params_text = wea.trim(params_text)
|
params_text = wea_c.trim(params_text)
|
||||||
|
|
||||||
local msg = {}
|
local msg = {}
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ minetest.register_chatcommand("/sculptlist", {
|
||||||
-- Sort by brush name
|
-- Sort by brush name
|
||||||
table.sort(display, function(a, b) return a[1] < b[1] end)
|
table.sort(display, function(a, b) return a[1] < b[1] end)
|
||||||
|
|
||||||
table.insert(msg, worldeditadditions.format.make_ascii_table(display))
|
table.insert(msg, wea_c.format.make_ascii_table(display))
|
||||||
end
|
end
|
||||||
|
|
||||||
worldedit.player_notify(name, table.concat(msg))
|
worldedit.player_notify(name, table.concat(msg))
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
-- Chat commands that measure things.
|
-- Chat commands that measure things.
|
||||||
|
|
||||||
local we_cm = worldeditadditions_commands.modpath .. "/commands/measure/"
|
local subpath = worldeditadditions_commands.modpath .. "/commands/measure/"
|
||||||
|
|
||||||
dofile(we_cm.."mface.lua")
|
dofile(subpath.."mface.lua")
|
||||||
dofile(we_cm.."midpos.lua")
|
dofile(subpath.."midpos.lua")
|
||||||
dofile(we_cm.."msize.lua")
|
dofile(subpath.."msize.lua")
|
||||||
dofile(we_cm.."mtrig.lua")
|
dofile(subpath.."mtrig.lua")
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
-- ██ ████ ██ █████ ███████ ██ █████
|
-- ██ ████ ██ █████ ███████ ██ █████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ██ ██ ██ ██ ██ ██████ ███████
|
-- ██ ██ ██ ██ ██ ██████ ███████
|
||||||
local wea = worldeditadditions
|
|
||||||
worldeditadditions_core.register_command("mface", {
|
worldeditadditions_core.register_command("mface", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "Return player facing axis.",
|
description = "Return player facing axis.",
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
|
|
||||||
-- ███ ███ ██ ██████ ██████ ██████ ███████
|
-- ███ ███ ██ ██████ ██████ ██████ ███████
|
||||||
-- ████ ████ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ████ ████ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ██ ████ ██ ██ ██ ██ ██████ ██ ██ ███████
|
-- ██ ████ ██ ██ ██ ██ ██████ ██ ██ ███████
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ██ ██ ██ ██████ ██ ██████ ███████
|
-- ██ ██ ██ ██████ ██ ██████ ███████
|
||||||
local wea = worldeditadditions
|
|
||||||
worldeditadditions_core.register_command("midpos", {
|
worldeditadditions_core.register_command("midpos", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "Return the mid point of current selection.",
|
description = "Return the mid point of current selection.",
|
||||||
|
@ -14,8 +17,13 @@ worldeditadditions_core.register_command("midpos", {
|
||||||
end,
|
end,
|
||||||
func = function(name, params_text)
|
func = function(name, params_text)
|
||||||
local str = "The centre of the current selection is at "
|
local str = "The centre of the current selection is at "
|
||||||
local vec = wea.vector.mean(worldedit.pos1[name],worldedit.pos2[name])
|
|
||||||
|
|
||||||
return true, str .. wea.table.tostring(vec)
|
local pos1 = Vector3.new(worldedit.pos1[name])
|
||||||
|
local pos2 = Vector3.new(worldedit.pos2[name])
|
||||||
|
|
||||||
|
|
||||||
|
local vec = wea_c.vector.mean(pos1, pos2)
|
||||||
|
|
||||||
|
return true, str .. wea_c.table.tostring(vec)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local Vector3 = wea_c.Vector3
|
||||||
|
|
||||||
|
|
||||||
-- ███ ███ ███████ ██ ███████ ███████
|
-- ███ ███ ███████ ██ ███████ ███████
|
||||||
-- ████ ████ ██ ██ ███ ██
|
-- ████ ████ ██ ██ ███ ██
|
||||||
-- ██ ████ ██ ███████ ██ ███ █████
|
-- ██ ████ ██ ███████ ██ ███ █████
|
||||||
-- ██ ██ ██ ██ ██ ███ ██
|
-- ██ ██ ██ ██ ██ ███ ██
|
||||||
-- ██ ██ ███████ ██ ███████ ███████
|
-- ██ ██ ███████ ██ ███████ ███████
|
||||||
local wea = worldeditadditions
|
|
||||||
worldeditadditions_core.register_command("msize", {
|
worldeditadditions_core.register_command("msize", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "Return the length of each axis of current selection.",
|
description = "Return the length of each axis of current selection.",
|
||||||
|
@ -14,8 +18,11 @@ worldeditadditions_core.register_command("msize", {
|
||||||
end,
|
end,
|
||||||
func = function(name, params_text)
|
func = function(name, params_text)
|
||||||
local str = "The dimensions of the current selection are "
|
local str = "The dimensions of the current selection are "
|
||||||
local vec = vector.subtract(worldedit.pos2[name],worldedit.pos1[name])
|
|
||||||
wea.vector.abs(vec)
|
local pos1 = Vector3.new(worldedit.pos1[name])
|
||||||
|
local pos2 = Vector3.new(worldedit.pos2[name])
|
||||||
|
|
||||||
|
local vec = (pos2 - pos1):abs()
|
||||||
|
|
||||||
return true, str .. "x: " .. vec.x .. ", y: " .. vec.y .. ", z: " .. vec.z
|
return true, str .. "x: " .. vec.x .. ", y: " .. vec.y .. ", z: " .. vec.z
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
local v3 = wea_c.Vector3
|
||||||
|
|
||||||
|
|
||||||
-- ███ ███ ████████ ██████ ██ ██████
|
-- ███ ███ ████████ ██████ ██ ██████
|
||||||
-- ████ ████ ██ ██ ██ ██ ██
|
-- ████ ████ ██ ██ ██ ██ ██
|
||||||
-- ██ ████ ██ ██ ██████ ██ ██ ███
|
-- ██ ████ ██ ██ ██████ ██ ██ ███
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ██ ██ ██ ██ ██ ██ ██████
|
-- ██ ██ ██ ██ ██ ██ ██████
|
||||||
local wea = worldeditadditions
|
|
||||||
local v3 = worldeditadditions.Vector3
|
|
||||||
worldeditadditions_core.register_command("mtrig", {
|
worldeditadditions_core.register_command("mtrig", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "Return the length of and angles of an imginary line between pos1 and pos2 in the selection.",
|
description = "Return the length of and angles of an imginary line between pos1 and pos2 in the selection.",
|
||||||
|
@ -15,11 +18,17 @@ worldeditadditions_core.register_command("mtrig", {
|
||||||
end,
|
end,
|
||||||
func = function(name, params_text)
|
func = function(name, params_text)
|
||||||
local str = "The measurements of the line from pos1 to pos2 are Length (D): "
|
local str = "The measurements of the line from pos1 to pos2 are Length (D): "
|
||||||
local vec = v3.subtract(worldedit.pos2[name],worldedit.pos1[name]):abs()
|
|
||||||
|
local pos1 = v3.new(worldedit.pos2[name])
|
||||||
|
local pos2 = v3.new(worldedit.pos1[name])
|
||||||
|
|
||||||
|
local vec = (pos2 - pos1):abs()
|
||||||
local len = vec:length()
|
local len = vec:length()
|
||||||
str = str..wea.round(len, 4)..", ∠XZ: "..
|
|
||||||
wea.round(math.deg(math.atan(vec.z/vec.x)), 4).."°, ∠DY: "..
|
str = str..wea_c.round(len, 4)..", ∠XZ: "..
|
||||||
wea.round(math.deg(math.asin(vec.y/len)), 4).."°"
|
wea_c.round(math.deg(math.atan(vec.z/vec.x)), 4).."°, ∠DY: "..
|
||||||
|
wea_c.round(math.deg(math.asin(vec.y/len)), 4).."°"
|
||||||
|
|
||||||
return true, str
|
return true, str
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue