Update init.lua
This commit is contained in:
parent
79f4a32559
commit
9c99be0d08
|
@ -25,16 +25,18 @@ minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood")
|
||||||
local replace = minetest.settings:get_bool("enable_stairs_replace_abm")
|
local replace = minetest.settings:get_bool("enable_stairs_replace_abm")
|
||||||
|
|
||||||
local function rotate_and_place(itemstack, placer, pointed_thing)
|
local function rotate_and_place(itemstack, placer, pointed_thing)
|
||||||
local p0 = pointed_thing.under
|
local pUnder = pointed_thing.under
|
||||||
local p1 = pointed_thing.above
|
local pAbove = pointed_thing.above
|
||||||
local param2 = 0
|
local param2 = 0
|
||||||
|
|
||||||
if placer then
|
if placer then
|
||||||
local placer_pos = placer:get_pos()
|
local placer_pos = placer:get_pos()
|
||||||
if placer_pos then
|
if placer_pos then
|
||||||
local vec = vector.subtract(p1, placer_pos)
|
local vecdiff = vector.subtract(pAbove, placer_pos)
|
||||||
param2 = minetest.dir_to_facedir(vec)
|
param2 = minetest.dir_to_facedir(vecdiff)
|
||||||
if math.abs(vec.z) <= 0.5 and math.abs(vec.x) <= 0.5 and vec.y < 0 and p0.y == p1.y then
|
-- The player places a node on the side face of the node he is standing on
|
||||||
|
if math.abs(vecdiff.z) <= 0.5 and math.abs(vecdiff.x) <= 0.5 and vecdiff.y < 0 and pUnder.y == pAbove.y then
|
||||||
|
-- reverse node direction
|
||||||
param2 = (param2 + 2) % 4
|
param2 = (param2 + 2) % 4
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -42,7 +44,7 @@ local function rotate_and_place(itemstack, placer, pointed_thing)
|
||||||
local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
|
local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
|
||||||
local fpos = finepos.y % 1
|
local fpos = finepos.y % 1
|
||||||
|
|
||||||
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
|
if pUnder.y - 1 == pAbove.y or (fpos > 0 and fpos < 0.5)
|
||||||
or (fpos < -0.5 and fpos > -0.999999999) then
|
or (fpos < -0.5 and fpos > -0.999999999) then
|
||||||
param2 = param2 + 20
|
param2 = param2 + 20
|
||||||
if param2 == 21 then
|
if param2 == 21 then
|
||||||
|
|
Loading…
Reference in New Issue