Stair rotation

Tried to add proper stair rotation while standing on node edge holding shift.
This commit is contained in:
VitaliyShar 2022-08-13 00:20:23 +03:00 committed by GitHub
parent 2bdc7c8c7d
commit a45a063b6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -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)