2022-09-18 21:46:20 +00:00
|
|
|
local wea_c = worldeditadditions_core
|
|
|
|
local Vector3 = wea_c.Vector3
|
|
|
|
|
|
|
|
|
2021-06-30 18:14:45 +00:00
|
|
|
-- ███ ███ ██ ██████ ██████ ██████ ███████
|
|
|
|
-- ████ ████ ██ ██ ██ ██ ██ ██ ██ ██
|
|
|
|
-- ██ ████ ██ ██ ██ ██ ██████ ██ ██ ███████
|
|
|
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
|
|
-- ██ ██ ██ ██████ ██ ██████ ███████
|
2022-05-19 21:10:09 +00:00
|
|
|
worldeditadditions_core.register_command("midpos", {
|
2021-06-30 18:14:45 +00:00
|
|
|
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 "
|
|
|
|
|
2022-09-19 17:54:53 +00:00
|
|
|
local pos1 = Vector3.clone(worldedit.pos1[name])
|
|
|
|
local pos2 = Vector3.clone(worldedit.pos2[name])
|
2022-09-18 21:46:20 +00:00
|
|
|
|
|
|
|
|
2022-09-19 17:54:53 +00:00
|
|
|
local vec = Vector3.mean(pos1, pos2)
|
2022-09-18 21:46:20 +00:00
|
|
|
|
|
|
|
return true, str .. wea_c.table.tostring(vec)
|
2021-06-30 18:14:45 +00:00
|
|
|
end,
|
|
|
|
})
|