1
0
mirror of https://github.com/Uberi/Minetest-WorldEdit.git synced 2025-07-06 10:00:33 +02:00
This commit is contained in:
pyrollo
2017-02-14 22:05:38 +00:00
committed by GitHub
6 changed files with 248 additions and 75 deletions

View File

@ -890,20 +890,26 @@ minetest.register_chatcommand("/rotate", {
})
minetest.register_chatcommand("/orient", {
params = "<angle>",
description = "Rotate oriented nodes in the current WorldEdit region around the Y axis by angle <angle> (90 degree increment)",
params = "<operation> <axis> <angle>",
description = "Change orientation of all oriented nodes in the current WorldEdit region performing <operation> (rotate or flip) around the <axis> axis by angle <angle> (90 degree increment, unused for flip operation)",
privs = {worldedit=true},
func = safe_region(function(name, param)
local found, _, angle = param:find("^([+-]?%d+)$")
local count = worldedit.orient(worldedit.pos1[name], worldedit.pos2[name], angle)
local found, _, operation, axis, angle = param:find("^(.+)%s+([xyz%?])%s+([+-]?%d+)$")
if axis == "?" then axis = worldedit.player_axis(name) end
local count = worldedit.orient(worldedit.pos1[name], worldedit.pos2[name], operation, axis, angle)
worldedit.player_notify(name, count .. " nodes oriented")
end,
function(name, param)
local found, _, angle = param:find("^([+-]?%d+)$")
local found, _, operation, axis, angle = param:find("^(.+)%s+([xyz%?])%s+([+-]?%d+)$")
if found == nil then
worldedit.player_notify(name, "invalid usage: " .. param)
return nil
end
if operation ~= 'flip' and operation ~= 'rotate' then
worldedit.player_notify(name, "invalid usage: operation must be flip or rotate")
return nil
end
if angle % 90 ~= 0 then
worldedit.player_notify(name, "invalid usage: angle must be multiple of 90")
return nil