1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-22 16:10:18 +01:00

Fixed fences being able to overwrite other nodes

This commit is contained in:
Diego Martínez 2013-03-16 19:00:41 -03:00
parent 07f3e65b4f
commit 670c44c156

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()