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

Simpler patch for saplings trying to grow on unknown nodes

This commit is contained in:
ShadowNinja 2015-06-16 21:00:19 +02:00 committed by est31
parent 7a90b31b30
commit a1a2ac7954

View File

@ -1670,13 +1670,10 @@ minetest.register_abm({
interval = 10, interval = 10,
chance = 50, chance = 50,
action = function(pos, node) action = function(pos, node)
local node_under = minetest.registered_nodes[ if minetest.get_item_group(minetest.get_node(
minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}).name] {x = pos.x, y = pos.y - 1, z = pos.z}).name, "soil") == 0 then
if not node_under then
return return
end 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)) print("A sapling grows into a tree at "..minetest.pos_to_string(pos))
local vm = minetest.get_voxel_manip() local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16}) local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})