mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2025-07-16 04:30:23 +02:00
use unified dyes' rotation correction functions
This commit is contained in:
@ -61,35 +61,6 @@ 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
|
||||
|
||||
-- use this when you have a "wallmounted" node that should never be oriented
|
||||
-- to floor or ceiling (e.g. a desk lamp)
|
||||
|
||||
function homedecor.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||
local node = minetest.get_node(pos)
|
||||
local yaw = placer:get_look_yaw()
|
||||
local dir = minetest.yaw_to_dir(yaw)
|
||||
local fdir = minetest.dir_to_wallmounted(dir)
|
||||
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