mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-01 13:53:03 +00:00
29 lines
1 KiB
Lua
29 lines
1 KiB
Lua
local wea_c = worldeditadditions_core
|
|
local Vector3 = wea_c.Vector3
|
|
|
|
|
|
-- ███ ███ ███████ ██ ███████ ███████
|
|
-- ████ ████ ██ ██ ███ ██
|
|
-- ██ ████ ██ ███████ ██ ███ █████
|
|
-- ██ ██ ██ ██ ██ ███ ██
|
|
-- ██ ██ ███████ ██ ███████ ███████
|
|
|
|
worldeditadditions_core.register_command("msize", {
|
|
params = "",
|
|
description = "Return the length of each axis of current selection.",
|
|
privs = { worldedit = true },
|
|
require_pos = 2,
|
|
parse = function(params_text)
|
|
return true
|
|
end,
|
|
func = function(name, params_text)
|
|
local str = "The dimensions of the current selection are "
|
|
|
|
local pos1 = Vector3.clone(wea_c.pos.get(name, 1))
|
|
local pos2 = Vector3.clone(wea_c.pos.get(name, 2))
|
|
|
|
local vec = (pos2 - pos1):abs()
|
|
|
|
return true, str .. "x: " .. vec.x .. ", y: " .. vec.y .. ", z: " .. vec.z
|
|
end,
|
|
})
|