From 7c68355f23c2700dd4eb467f9b6ad6f04e63b72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= Date: Mon, 2 Jan 2017 22:00:08 -0300 Subject: [PATCH] Prevent two separate instances of stack overflow. The first one happens because `remove_node` is called directly, calling `remove_node` for the vine below, calling `remove_node` for the vine below, calling... The second one happens because `get_item_group` returns 0 for groups not set, and 0 is a truthy value in Lua, so the code always removes the bottom node regardless of its group rating. This interacted funnily with doors wanting to remove their top node, while vines wanted to remove their bottom nodes. --- functions.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions.lua b/functions.lua index e0a67d8..3bd4628 100644 --- a/functions.lua +++ b/functions.lua @@ -61,7 +61,6 @@ vines.register_vine = function( name, defs, biome ) end }) - minetest.register_node( vine_name_middle, { description = "Matured "..defs.description, walkable = false, @@ -83,7 +82,7 @@ vines.register_vine = function( name, defs, biome ) local bottom = {x=pos.x, y=pos.y-1, z=pos.z} local bottom_node = minetest.get_node( bottom ) if minetest.get_item_group( bottom_node.name, "vines") then - minetest.remove_node( bottom ) + minetest.after( 0, minetest.remove_node, bottom ) end end, after_dig_node = function( pos, node, oldmetadata, user )