diff --git a/worldeditadditions_commands/commands/measure/init.lua b/worldeditadditions_commands/commands/measure/init.lua index e8ce9c9..dd44bef 100644 --- a/worldeditadditions_commands/commands/measure/init.lua +++ b/worldeditadditions_commands/commands/measure/init.lua @@ -9,3 +9,4 @@ local we_cm = worldeditadditions_commands.modpath .. "/commands/measure/" dofile(we_cm.."mface.lua") +dofile(we_cm.."midpos.lua") diff --git a/worldeditadditions_commands/commands/measure/midpos.lua b/worldeditadditions_commands/commands/measure/midpos.lua new file mode 100644 index 0000000..a2fee5f --- /dev/null +++ b/worldeditadditions_commands/commands/measure/midpos.lua @@ -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, +})