forked from mtcontrib/homedecor_modpack
Merge pull request #6 from kaeza/master
Fixed fences being able to overwrite other nodes
This commit is contained in:
commit
da0fccaeb5
@ -370,14 +370,18 @@ local function copy ( t )
|
|||||||
end
|
end
|
||||||
|
|
||||||
function homedecor_register_fence_with_sign(fencename, fencewithsignname)
|
function homedecor_register_fence_with_sign(fencename, fencewithsignname)
|
||||||
local def = copy(minetest.registered_nodes[fencename])
|
local def = minetest.registered_nodes[fencename]
|
||||||
local def_sign = copy(minetest.registered_nodes[fencewithsignname])
|
local def_sign = minetest.registered_nodes[fencewithsignname]
|
||||||
if not (def and def_sign) then
|
if not (def and def_sign) then
|
||||||
error("Attempt to register unknown node as fence")
|
error("Attempt to register unknown node as fence")
|
||||||
end
|
end
|
||||||
|
def = copy(def)
|
||||||
|
def_sign = copy(def_sign)
|
||||||
fences_with_sign[fencename] = fencewithsignname
|
fences_with_sign[fencename] = fencewithsignname
|
||||||
def.on_place = function(itemstack, placer, pointed_thing, ...)
|
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())
|
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||||
minetest.env:add_node(pointed_thing.above, {name = fencename, param2 = fdir})
|
minetest.env:add_node(pointed_thing.above, {name = fencename, param2 = fdir})
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
|
Loading…
Reference in New Issue
Block a user