Schematics - Importing at angles doesn't also rotate 'facedir'
This report is for hmmm. He recently added support for importing schematics at various angles and I updated my Structures mod to use it. When importing at 90* / 180* / 270*, the nodes are positioned properly, but the facedir of nodes (such as doors and torches) isn't reversed accordingly.
This is an issue I ran into as well when I added angles to structures, and I have the facedir flipping formula. It should be possible to adapt it to C++ and use it for minetest.place_schematic. Here is the fragment of my Lua script that handles rotations:
Screenshots of the bug below. See the doors, torches and stairs. First image is at 90*, second at 180*:


This is an issue I ran into as well when I added angles to structures, and I have the facedir flipping formula. It should be possible to adapt it to C++ and use it for minetest.place_schematic. Here is the fragment of my Lua script that handles rotations:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
if (angle == 90) or (angle == -270) then
-- if param2 is facedir, rotate it accordingly
-- 0 = y+ ; 1 = z+ ; 2 = z- ; 3 = x+ ; 4 = x- ; 5 = y-
if (node_paramtype2 == "facedir") then
if (node_param2 == "0") then node_param2 = "3"
elseif (node_param2 == "1") then node_param2 = "0"
elseif (node_param2 == "2") then node_param2 = "1"
elseif (node_param2 == "3") then node_param2 = "2" end
end
-- if param2 is wallmounted, rotate it accordingly
if (node_paramtype2 == "wallmounted") then
if (node_param2 == "2") then node_param2 = "4"
elseif (node_param2 == "3") then node_param2 = "5"
elseif (node_param2 == "4") then node_param2 = "3"
elseif (node_param2 == "5") then node_param2 = "2" end
end
elseif (angle == 180) then
-- if param2 is facedir, rotate it accordingly
-- 0 = y+ ; 1 = z+ ; 2 = z- ; 3 = x+ ; 4 = x- ; 5 = y-
if (node_paramtype2 == "facedir") then
if (node_param2 == "0") then node_param2 = "2"
elseif (node_param2 == "1") then node_param2 = "3"
elseif (node_param2 == "2") then node_param2 = "0"
elseif (node_param2 == "3") then node_param2 = "1" end
end
-- if param2 is wallmounted, rotate it accordingly
if (node_paramtype2 == "wallmounted") then
if (node_param2 == "2") then node_param2 = "3"
elseif (node_param2 == "3") then node_param2 = "2"
elseif (node_param2 == "4") then node_param2 = "5"
elseif (node_param2 == "5") then node_param2 = "4" end
end
elseif (angle == 270) or (angle == -90) then
-- if param2 is facedir, rotate it accordingly
-- 0 = y+ ; 1 = z+ ; 2 = z- ; 3 = x+ ; 4 = x- ; 5 = y-
if (node_paramtype2 == "facedir") then
if (node_param2 == "0") then node_param2 = "1"
elseif (node_param2 == "1") then node_param2 = "2"
elseif (node_param2 == "2") then node_param2 = "3"
elseif (node_param2 == "3") then node_param2 = "0" end
end
-- if param2 is wallmounted, rotate it accordingly
if (node_paramtype2 == "wallmounted") then
if (node_param2 == "2") then node_param2 = "5"
elseif (node_param2 == "3") then node_param2 = "4"
elseif (node_param2 == "4") then node_param2 = "2"
elseif (node_param2 == "5") then node_param2 = "3" end
end
else -- 0 degrees
end
Screenshots of the bug below. See the doors, torches and stairs. First image is at 90*, second at 180*:

