forked from VoxeLibre/VoxeLibre
Merge pull request 'fix crash when opening a chest that has an unknow node on it' (#3964) from pepebotella/MineClone2:chest-under-unknow into master
Reviewed-on: MineClone2/MineClone2#3964 Reviewed-by: chmodsayshello <chmodsayshello@hotmail.com>
This commit is contained in:
commit
f99ae93bf6
|
@ -532,10 +532,13 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
|
||||||
_mcl_hardness = 2.5,
|
_mcl_hardness = 2.5,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
if minetest.registered_nodes[minetest.get_node({ x = pos.x, y = pos.y + 1, z = pos.z }).name].groups.opaque == 1 then
|
local topnode = minetest.get_node({ x = pos.x, y = pos.y + 1, z = pos.z })
|
||||||
|
if topnode and topnode.name and minetest.registered_nodes[topnode.name] then
|
||||||
|
if minetest.registered_nodes[topnode.name].groups.opaque == 1 then
|
||||||
-- won't open if there is no space from the top
|
-- won't open if there is no space from the top
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
end
|
||||||
local name = minetest.get_meta(pos):get_string("name")
|
local name = minetest.get_meta(pos):get_string("name")
|
||||||
if name == "" then
|
if name == "" then
|
||||||
name = S("Chest")
|
name = S("Chest")
|
||||||
|
|
Loading…
Reference in New Issue