From a45a063b6a3f662c3c92fb7157a4300279d05bb8 Mon Sep 17 00:00:00 2001 From: VitaliyShar <111154840+VitaliyShar@users.noreply.github.com> Date: Sat, 13 Aug 2022 00:20:23 +0300 Subject: [PATCH] Stair rotation Tried to add proper stair rotation while standing on node edge holding shift. --- mods/stairs/init.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua index 4ba854fa..e9237494 100644 --- a/mods/stairs/init.lua +++ b/mods/stairs/init.lua @@ -32,7 +32,15 @@ local function rotate_and_place(itemstack, placer, pointed_thing) if placer then local placer_pos = placer:get_pos() if placer_pos then - param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos)) + local vec = vector.subtract(p1, placer_pos) + param2 = minetest.dir_to_facedir(vec) + if math.abs(vec.z) <= 0.5 and math.abs(vec.x) <= 0.5 and vec.y < 0 and p0.y == p1.y then + if param2 == 0 then param2 = 2 + elseif param2 == 2 then param2 = 0 + elseif param2 == 1 then param2 = 3 + elseif param2 == 3 then param2 = 1 + end + end end local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)