forked from VoxeLibre/VoxeLibre
Fix crashes when snow on unknown nodes is flooded
This commit is contained in:
parent
e9d202ee83
commit
a5a952896d
|
@ -1581,7 +1581,7 @@ end
|
|||
-- MUST NOT be called if there is a snow cover node above pos.
|
||||
function mcl_core.clear_snow_dirt(pos, node)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if def._mcl_snowless then
|
||||
if def and def._mcl_snowless then
|
||||
minetest.swap_node(pos, {name = def._mcl_snowless, param2=node.param2})
|
||||
end
|
||||
end
|
||||
|
@ -1602,7 +1602,7 @@ function mcl_core.on_snowable_construct(pos)
|
|||
-- Make snowed if needed
|
||||
if minetest.get_item_group(anode.name, "snow_cover") == 1 then
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if def._mcl_snowed then
|
||||
if def and def._mcl_snowed then
|
||||
minetest.swap_node(pos, {name = def._mcl_snowed, param2=node.param2})
|
||||
end
|
||||
end
|
||||
|
@ -1623,7 +1623,7 @@ function mcl_core.on_snow_construct(pos)
|
|||
local npos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local node = minetest.get_node(npos)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if def._mcl_snowed then
|
||||
if def and def._mcl_snowed then
|
||||
minetest.swap_node(npos, {name = def._mcl_snowed, param2=node.param2})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue