1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-22 07:38:48 -05:00

Fix possible crash with grass ABM.

This commit is contained in:
Novatux 2013-11-02 16:13:07 +01:00 committed by PilzAdam
parent 0d35350b69
commit d11c76b9f2

View File

@ -1618,7 +1618,9 @@ minetest.register_abm({
local above = {x=pos.x, y=pos.y+1, z=pos.z} local above = {x=pos.x, y=pos.y+1, z=pos.z}
local name = minetest.get_node(above).name local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name] local nodedef = minetest.registered_nodes[name]
if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light") and nodedef.liquidtype == "none" and minetest.get_node_light(above) >= 13 then if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light")
and nodedef.liquidtype == "none"
and (minetest.get_node_light(above) or 0) >= 13 then
if name == "default:snow" or name == "default:snowblock" then if name == "default:snow" or name == "default:snowblock" then
minetest.set_node(pos, {name = "default:dirt_with_snow"}) minetest.set_node(pos, {name = "default:dirt_with_snow"})
else else
@ -1636,7 +1638,9 @@ minetest.register_abm({
local above = {x=pos.x, y=pos.y+1, z=pos.z} local above = {x=pos.x, y=pos.y+1, z=pos.z}
local name = minetest.get_node(above).name local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name] local nodedef = minetest.registered_nodes[name]
if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light") and nodedef.liquidtype == "none") then if name ~= "ignore" and nodedef
and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
and nodedef.liquidtype == "none") then
minetest.set_node(pos, {name = "default:dirt"}) minetest.set_node(pos, {name = "default:dirt"})
end end
end end