fixed hacky on_rightclick/on_place code for doors. They work better now.

This commit is contained in:
Vanessa Ezekowitz 2013-02-08 14:31:35 -05:00
parent a7ab6fac34
commit c62a4a549a

View File

@ -158,11 +158,13 @@ for i in ipairs(sides) do
end end
end, end,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
--[[
-- for some obscure reason, this callback is used if the target node -- for some obscure reason, this callback is used if the target node
-- is a homedecor door, probably because they have an on_rightclick -- is a homedecor door, probably because they have an on_rightclick
-- setting -- but only if you're weilding a door! -- setting -- but only if you're weilding a door!
local node=minetest.env:get_node(pointed_thing.under)
if string.find(node.name, "homedecor:door_") then if string.find(node.name, "homedecor:door_") then
local lr = nil local lr = nil
@ -184,11 +186,13 @@ for i in ipairs(sides) do
print(node.name) print(node.name)
print(dname) print(dname)
print(lr) print(lr)
]]--
homedecor_flip_door(pointed_thing.under, node, placer, dname, lr) local node=minetest.env:get_node(pointed_thing.under)
return if not minetest.registered_nodes[node.name].on_rightclick then
else
return homedecor_place_door(itemstack, placer, pointed_thing, doorname, side) return homedecor_place_door(itemstack, placer, pointed_thing, doorname, side)
else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
end, end,
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)