Skip to content
Snippets Groups Projects
Commit 3b4408aa authored by y.st's avatar y.st Committed by est31
Browse files

Don't crash when saplings try to grow on unknown nodes

parent 38482d26
No related branches found
No related tags found
No related merge requests found
......@@ -1660,7 +1660,12 @@ minetest.register_abm({
interval = 10,
chance = 50,
action = function(pos, node)
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
local node_under = minetest.registered_nodes[
minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}).name]
if not node_under then
return
end
local is_soil = node_under.groups.soil
if is_soil == nil or is_soil == 0 then return end
print("A sapling grows into a tree at "..minetest.pos_to_string(pos))
local vm = minetest.get_voxel_manip()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment