1
0
Fork 0

Fix crashes when snow on unknown nodes is flooded

This commit is contained in:
cora 2023-09-03 20:33:53 +02:00 committed by MrRar
parent e9d202ee83
commit a5a952896d
1 changed files with 3 additions and 3 deletions

View File

@ -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