mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 15:33:00 +00:00
added axis and dir checks
This commit is contained in:
parent
74ba9cc36f
commit
77ffda46f7
1 changed files with 23 additions and 4 deletions
|
@ -46,4 +46,23 @@ function selection.clear_points(name)
|
|||
worldedit.player_notify(name, "Region cleared")
|
||||
end
|
||||
|
||||
--- Checks if a string is a valid axis.
|
||||
-- @param str string String to check (be sure to remove any + or -).
|
||||
-- @param hv bool Include "h" (general horizontal) and "v" (general vertical).
|
||||
-- @return bool If string is a valid axis then true.
|
||||
function selection.check_axis(str,hv)
|
||||
if hv then
|
||||
return (str == "x" or str == "y" or str == "z" or str == "h" or str == "v")
|
||||
else
|
||||
return (str == "x" or str == "y" or str == "z")
|
||||
end
|
||||
end
|
||||
|
||||
--- Checks if a string is a valid dir.
|
||||
-- @param str string String to check (be sure to remove any + or -).
|
||||
-- @return bool If string is a valid dir then true.
|
||||
function selection.check_dir(str)
|
||||
return (str == "front" or str == "back" or str == "left" or str == "right" or str == "up" or str == "down")
|
||||
end
|
||||
|
||||
return selection
|
||||
|
|
Loading…
Reference in a new issue