mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-26 09:03:01 +00:00
added mface
This commit is contained in:
parent
71fb8da089
commit
d65fe98de6
3 changed files with 56 additions and 2 deletions
11
worldeditadditions_commands/commands/measure/init.lua
Normal file
11
worldeditadditions_commands/commands/measure/init.lua
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
-- ███ ███ ███████ █████ ███████ ██ ██ ██████ ███████
|
||||||
|
-- ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
|
-- ██ ████ ██ █████ ███████ ███████ ██ ██ ██████ █████
|
||||||
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
|
-- ██ ██ ███████ ██ ██ ███████ ██████ ██ ██ ███████
|
||||||
|
|
||||||
|
-- Chat commands that measure things.
|
||||||
|
|
||||||
|
local we_cm = worldeditadditions_commands.modpath .. "/commands/measure/"
|
||||||
|
|
||||||
|
dofile(we_cm.."mface.lua")
|
37
worldeditadditions_commands/commands/measure/mface.lua
Normal file
37
worldeditadditions_commands/commands/measure/mface.lua
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
-- ███ ███ ███████ █████ ██████ ███████
|
||||||
|
-- ████ ████ ██ ██ ██ ██ ██
|
||||||
|
-- ██ ████ ██ █████ ███████ ██ █████
|
||||||
|
-- ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
|
-- ██ ██ ██ ██ ██ ██████ ███████
|
||||||
|
local wea = worldeditadditions
|
||||||
|
worldedit.register_command("mface", {
|
||||||
|
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,
|
||||||
|
})
|
|
@ -44,6 +44,9 @@ dofile(we_c.modpath.."/commands/meta/ellipsoidapply.lua")
|
||||||
-- Selection Tools
|
-- Selection Tools
|
||||||
dofile(we_c.modpath.."/commands/selectors/init.lua")
|
dofile(we_c.modpath.."/commands/selectors/init.lua")
|
||||||
|
|
||||||
|
-- Measure Tools
|
||||||
|
dofile(we_c.modpath.."/commands/measure/init.lua")
|
||||||
|
|
||||||
dofile(we_c.modpath.."/commands/extra/saplingaliases.lua")
|
dofile(we_c.modpath.."/commands/extra/saplingaliases.lua")
|
||||||
dofile(we_c.modpath.."/commands/extra/basename.lua")
|
dofile(we_c.modpath.."/commands/extra/basename.lua")
|
||||||
|
|
||||||
|
@ -76,6 +79,9 @@ worldedit.alias_command("naturalize", "layers")
|
||||||
|
|
||||||
worldedit.alias_command("flora", "bonemeal")
|
worldedit.alias_command("flora", "bonemeal")
|
||||||
|
|
||||||
worldedit.alias_command("mcount", "count")
|
-- Selection Tools
|
||||||
|
|
||||||
worldedit.alias_command("sfac", "sfactor")
|
worldedit.alias_command("sfac", "sfactor")
|
||||||
|
|
||||||
|
-- Measure Tools
|
||||||
|
worldedit.alias_command("mcount", "count")
|
||||||
|
worldedit.alias_command("mfacing", "mface")
|
||||||
|
|
Loading…
Reference in a new issue