forked from LizzyFleckenstein03/Memeclone
Fix crash when opening a chest with an unknown node on top
This commit is contained in:
parent
bd14918543
commit
30528b0a2c
|
@ -608,10 +608,12 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
|
|||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
||||
if minetest.registered_nodes[minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name].groups.opaque == 1
|
||||
or minetest.registered_nodes[minetest.get_node({x = pos_other.x, y = pos_other.y + 1, z = pos_other.z}).name].groups.opaque == 1 then
|
||||
-- won't open if there is no space from the top
|
||||
return false
|
||||
local above_def = minetest.registered_nodes[minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name]
|
||||
local above_def_other = minetest.registered_nodes[minetest.get_node({x = pos_other.x, y = pos_other.y + 1, z = pos_other.z}).name]
|
||||
|
||||
if not above_def or above_def.groups.opaque == 1 or not above_def_other or above_def_other.groups.opaque == 1 then
|
||||
-- won't open if there is no space from the top
|
||||
return false
|
||||
end
|
||||
|
||||
local name = minetest.get_meta(pos):get_string("name")
|
||||
|
|
Loading…
Reference in New Issue