mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-12-23 00:20:17 +01:00
Fixed fences being able to overwrite other nodes
This commit is contained in:
parent
07f3e65b4f
commit
670c44c156
@ -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