mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2025-07-19 06:00:19 +02:00
add a function to correct for broken placement rotation
for wallmounted nodes (engine or _game bug), and put it to use.
This commit is contained in:
@ -65,6 +65,24 @@ function homedecor.find_ceiling(itemstack, placer, pointed_thing)
|
||||
return isceiling, pos
|
||||
end
|
||||
|
||||
-- call this function to reset the rotation of a "wallmounted" object on place
|
||||
|
||||
function homedecor.fix_rotation(pos, placer, itemstack, pointed_thing)
|
||||
local node = minetest.get_node(pos)
|
||||
local yaw = placer:get_look_yaw()
|
||||
local dir = minetest.yaw_to_dir(yaw-1.5)
|
||||
local pitch = placer:get_look_vertical()
|
||||
|
||||
local fdir = minetest.dir_to_wallmounted(dir)
|
||||
|
||||
if pitch < -(math.pi/4) then
|
||||
fdir = 0
|
||||
elseif pitch > math.pi/4 then
|
||||
fdir = 1
|
||||
end
|
||||
minetest.swap_node(pos, { name = node.name, param2 = fdir })
|
||||
end
|
||||
|
||||
screwdriver = screwdriver or {}
|
||||
|
||||
homedecor.plain_wood = { name = "homedecor_generic_wood_plain.png", color = 0xffa76820 }
|
||||
|
Reference in New Issue
Block a user