2022-09-18 21:46:20 +00:00
|
|
|
local wea_c = worldeditadditions_core
|
|
|
|
local v3 = wea_c.Vector3
|
|
|
|
|
|
|
|
|
2021-07-13 16:09:40 +00:00
|
|
|
-- ███ ███ ████████ ██████ ██ ██████
|
|
|
|
-- ████ ████ ██ ██ ██ ██ ██
|
|
|
|
-- ██ ████ ██ ██ ██████ ██ ██ ███
|
|
|
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
|
|
-- ██ ██ ██ ██ ██ ██ ██████
|
2022-09-18 21:46:20 +00:00
|
|
|
|
2022-05-19 21:10:09 +00:00
|
|
|
worldeditadditions_core.register_command("mtrig", {
|
2021-07-09 03:54:05 +00:00
|
|
|
params = "",
|
2021-07-14 02:43:56 +00:00
|
|
|
description = "Return the length of and angles of an imginary line between pos1 and pos2 in the selection.",
|
2021-07-09 03:54:05 +00:00
|
|
|
privs = { worldedit = true },
|
|
|
|
require_pos = 2,
|
|
|
|
parse = function(params_text)
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
func = function(name, params_text)
|
2021-07-15 20:44:56 +00:00
|
|
|
local str = "The measurements of the line from pos1 to pos2 are Length (D): "
|
2022-09-18 21:46:20 +00:00
|
|
|
|
|
|
|
local pos1 = v3.new(worldedit.pos2[name])
|
|
|
|
local pos2 = v3.new(worldedit.pos1[name])
|
|
|
|
|
|
|
|
local vec = (pos2 - pos1):abs()
|
2021-07-13 16:09:40 +00:00
|
|
|
local len = vec:length()
|
2022-09-18 21:46:20 +00:00
|
|
|
|
|
|
|
str = str..wea_c.round(len, 4)..", ∠XZ: "..
|
|
|
|
wea_c.round(math.deg(math.atan(vec.z/vec.x)), 4).."°, ∠DY: "..
|
|
|
|
wea_c.round(math.deg(math.asin(vec.y/len)), 4).."°"
|
|
|
|
|
2021-07-09 03:54:05 +00:00
|
|
|
return true, str
|
|
|
|
end,
|
|
|
|
})
|