mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 07:23:00 +00:00
//midpos implemented
This commit is contained in:
parent
11bf486bf2
commit
d479e167b9
2 changed files with 22 additions and 0 deletions
|
@ -9,3 +9,4 @@
|
|||
local we_cm = worldeditadditions_commands.modpath .. "/commands/measure/"
|
||||
|
||||
dofile(we_cm.."mface.lua")
|
||||
dofile(we_cm.."midpos.lua")
|
||||
|
|
21
worldeditadditions_commands/commands/measure/midpos.lua
Normal file
21
worldeditadditions_commands/commands/measure/midpos.lua
Normal 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,
|
||||
})
|
Loading…
Reference in a new issue