Added //msize

This commit is contained in:
VorTechnix 2021-07-02 20:10:03 -07:00
parent f709d12b75
commit e047372c22
2 changed files with 23 additions and 0 deletions

View file

@ -10,3 +10,4 @@ local we_cm = worldeditadditions_commands.modpath .. "/commands/measure/"
dofile(we_cm.."mface.lua") dofile(we_cm.."mface.lua")
dofile(we_cm.."midpos.lua") dofile(we_cm.."midpos.lua")
dofile(we_cm.."msize.lua")

View file

@ -0,0 +1,22 @@
-- ███ ███ ███████ ██ ███████ ███████
-- ████ ████ ██ ██ ███ ██
-- ██ ████ ██ ███████ ██ ███ █████
-- ██ ██ ██ ██ ██ ███ ██
-- ██ ██ ███████ ██ ███████ ███████
local wea = worldeditadditions
worldedit.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 vec = vector.subtract(worldedit.pos2[name],worldedit.pos1[name])
wea.vector.abs(vec)
return true, str .. wea.table.tostring(vec)
end,
})