Merge pull request #20 from kaeza/master

Various Fixes
This commit is contained in:
VanessaE 2013-05-23 10:58:18 -07:00
commit 2d3ddea87f
2 changed files with 16 additions and 14 deletions

View File

@ -23,16 +23,6 @@ minetest.register_node("homedecor:fence_brass", {
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
walkable = true,
on_place = function(itemstack, placer, pointed_thing)
if not homedecor_node_is_owned(pointed_thing.under, placer) then
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.env:add_node(pointed_thing.above, {name = "homedecor:fence_brass", param2 = fdir})
itemstack:take_item()
placer:set_wielded_item(itemstack)
return itemstack
end
end
})
minetest.register_node("homedecor:fence_wrought_iron", {

View File

@ -417,11 +417,23 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
def = copy(def)
def_sign = copy(def_sign)
fences_with_sign[fencename] = fencewithsignname
def.on_place = function(itemstack, placer, pointed_thing, ...)
local def = minetest.registered_nodes[minetest.env:get_node(pointed_thing.above).name]
if (not homedecor_node_is_owned(pointed_thing.under, placer))
and def.buildable_to then
local node_above = minetest.env:get_node(pointed_thing.above)
local node_under = minetest.env:get_node(pointed_thing.under)
local def_above = minetest.registered_nodes[node_above.name]
local def_under = minetest.registered_nodes[node_under.name]
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
if def_under and def_under.on_rightclick then
return def_under.on_rightclick(pointed_thing.under, node_under, placer, itemstack) or itemstack
elseif (not homedecor_node_is_owned(pointed_thing.under, placer))
and def_under.buildable_to then
minetest.env:add_node(pointed_thing.under, {name = fencename, param2 = fdir})
itemstack:take_item()
placer:set_wielded_item(itemstack)
return itemstack
elseif (not homedecor_node_is_owned(pointed_thing.above, placer))
and def_above.buildable_to then
minetest.env:add_node(pointed_thing.above, {name = fencename, param2 = fdir})
itemstack:take_item()
placer:set_wielded_item(itemstack)