Merge pull request #6 from kaeza/master

Fixed fences being able to overwrite other nodes
This commit is contained in:
VanessaE 2013-03-16 16:02:39 -07:00
commit da0fccaeb5

View File

@ -370,14 +370,18 @@ local function copy ( t )
end
function homedecor_register_fence_with_sign(fencename, fencewithsignname)
local def = copy(minetest.registered_nodes[fencename])
local def_sign = copy(minetest.registered_nodes[fencewithsignname])
local def = minetest.registered_nodes[fencename]
local def_sign = minetest.registered_nodes[fencewithsignname]
if not (def and def_sign) then
error("Attempt to register unknown node as fence")
end
def = copy(def)
def_sign = copy(def_sign)
fences_with_sign[fencename] = fencewithsignname
def.on_place = function(itemstack, placer, pointed_thing, ...)
if not homedecor_node_is_owned(pointed_thing.under, placer) then
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 fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.env:add_node(pointed_thing.above, {name = fencename, param2 = fdir})
itemstack:take_item()