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:
Vanessa Ezekowitz
2017-01-29 03:45:58 -05:00
부모 79e501394a
커밋 175724d53c
3개의 변경된 파일23개의 추가작업 그리고 14개의 파일을 삭제

파일 보기

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

파일 보기

@@ -41,6 +41,7 @@ minetest.register_node("homedecor:glowlight_half", {
groups = { snappy = 3 },
light_source = default.LIGHT_MAX,
sounds = default.node_sound_glass_defaults(),
after_place_node = homedecor.fix_rotation,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
unifieddyes.on_rightclick(pos, node, clicker,
@@ -72,6 +73,7 @@ minetest.register_node("homedecor:glowlight_quarter", {
groups = { snappy = 3 },
light_source = default.LIGHT_MAX-1,
sounds = default.node_sound_glass_defaults(),
after_place_node = homedecor.fix_rotation,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
unifieddyes.on_rightclick(pos, node, clicker,
@@ -103,6 +105,7 @@ minetest.register_node("homedecor:glowlight_small_cube", {
groups = { snappy = 3 },
light_source = default.LIGHT_MAX-1,
sounds = default.node_sound_glass_defaults(),
after_place_node = homedecor.fix_rotation,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
unifieddyes.on_rightclick(pos, node, clicker,

파일 보기

@@ -114,13 +114,7 @@ minetest.register_node("homedecor:curtain_closed", {
palette = "unifieddyes_palette_colorwallmounted.png",
selection_box = { type = "wallmounted" },
after_dig_node = unifieddyes.after_dig_node,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local yaw = placer:get_look_yaw()
local dir = minetest.yaw_to_dir(yaw-1.5)
local fdir = minetest.dir_to_wallmounted(dir)
name = minetest.get_node(pos).name
minetest.swap_node(pos, { name = name, param2 = fdir })
end,
after_place_node = homedecor.fix_rotation,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local itemname = itemstack:get_name()
if string.find(itemname, "dye:") or string.find(itemname, "unifieddyes:") then
@@ -151,13 +145,7 @@ minetest.register_node("homedecor:curtain_open", {
palette = "unifieddyes_palette_colorwallmounted.png",
selection_box = { type = "wallmounted" },
after_dig_node = unifieddyes.after_dig_node,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local yaw = placer:get_look_yaw()
local dir = minetest.yaw_to_dir(yaw-1.5)
local fdir = minetest.dir_to_wallmounted(dir)
name = minetest.get_node(pos).name
minetest.swap_node(pos, { name = name, param2 = fdir })
end,
after_place_node = homedecor.fix_rotation,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local itemname = itemstack:get_name()
if string.find(itemname, "dye:") or string.find(itemname, "unifieddyes:") then