2021-06-29 04:15:47 +00:00
|
|
|
-- ███ ███ ███████ █████ ██████ ███████
|
|
|
|
-- ████ ████ ██ ██ ██ ██ ██
|
|
|
|
-- ██ ████ ██ █████ ███████ ██ █████
|
|
|
|
-- ██ ██ ██ ██ ██ ██ ██ ██
|
|
|
|
-- ██ ██ ██ ██ ██ ██████ ███████
|
2022-09-18 21:46:20 +00:00
|
|
|
|
2022-05-19 21:10:09 +00:00
|
|
|
worldeditadditions_core.register_command("mface", {
|
2021-06-29 04:15:47 +00:00
|
|
|
params = "",
|
|
|
|
description = "Return player facing axis.",
|
|
|
|
privs = { worldedit = true },
|
|
|
|
require_pos = 0,
|
|
|
|
parse = function(params_text)
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
func = function(name, params_text)
|
|
|
|
local str = "You are facing "
|
|
|
|
local dir = minetest.get_player_by_name(name):get_look_dir()
|
|
|
|
|
|
|
|
if math.abs(dir.z) > math.abs(dir.x) then
|
|
|
|
if dir.z < 0 then str = str.."-Z"
|
|
|
|
else str = str.."Z" end
|
|
|
|
if math.abs(dir.x) >= 0.35 then -- Alternate value: 1/3
|
|
|
|
if dir.x < 0 then str = str.."-X"
|
|
|
|
else str = str.."X" end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if dir.x < 0 then str = str.."-X"
|
|
|
|
else str = str.."X" end
|
|
|
|
if math.abs(dir.z) >= 0.35 then -- Alternate value: 1/3
|
|
|
|
if dir.z < 0 then str = str.."-Z"
|
|
|
|
else str = str.."Z" end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return true, str
|
|
|
|
end,
|
|
|
|
})
|