Skip to content

Commit

Permalink
Improve stair placement rotation for bridging (#2979)
Browse files Browse the repository at this point in the history
Co-authored-by: sfan5 <sfan5@live.de>
  • Loading branch information
VitaliyShar and sfan5 committed Aug 18, 2022
1 parent e903b1f commit aff9c28
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mods/stairs/init.lua
Expand Up @@ -32,7 +32,13 @@ 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 diff = vector.subtract(p1, placer_pos)
param2 = minetest.dir_to_facedir(diff)
-- The player places a node on the side face of the node he is standing on
if p0.y == p1.y and math.abs(diff.x) <= 0.5 and math.abs(diff.z) <= 0.5 and diff.y < 0 then
-- reverse node direction
param2 = (param2 + 2) % 4
end
end

local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
Expand Down

0 comments on commit aff9c28

Please sign in to comment.