1
0
mirror of https://github.com/Uberi/Minetest-WorldEdit.git synced 2025-07-06 10:00:33 +02:00

Added 6D facedir management and changed rotate and flip behavior concerning orientation

This commit is contained in:
Pierre-Yves Rollo
2015-10-27 09:13:51 +01:00
parent fc037e9c82
commit 6bab328d2b
5 changed files with 154 additions and 74 deletions

View File

@ -806,20 +806,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