//midpos implemented

This commit is contained in:
VorTechnix 2021-06-30 11:14:45 -07:00
parent 11bf486bf2
commit d479e167b9
2 changed files with 22 additions and 0 deletions

View file

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

View file

@ -0,0 +1,21 @@
-- ███ ███ ██ ██████ ██████ ██████ ███████
-- ████ ████ ██ ██ ██ ██ ██ ██ ██ ██
-- ██ ████ ██ ██ ██ ██ ██████ ██ ██ ███████
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██ ██ ██ ██████ ██ ██████ ███████
local wea = worldeditadditions
worldedit.register_command("midpos", {
params = "",
description = "Return the mid point of current selection.",
privs = { worldedit = true },
require_pos = 2,
parse = function(params_text)
return true
end,
func = function(name, params_text)
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)
end,
})