From 802ddb35e4832b4a9fdf2a87040e19f4603f754c Mon Sep 17 00:00:00 2001 From: philipmi Date: Tue, 4 Jan 2022 11:58:51 +0100 Subject: [PATCH] Fix food_apple group for apple if overwritten by moretrees --- README.md | 2 +- init.lua | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fbbcce9..7ea20bc 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This mod causes fruits on trees from other mods to regrow like apples in the 5.0 Cool_trees modpack, ethereal, farming_plus and moretrees are supported, but maybe there are other mods with this problem that I don't know about. Please tell me in the Minetest Forum topic! -Apples in older versions than Minetest 5.0 will also regrow. +Default apples in older versions than Minetest 5.0 will also regrow. Credits ---- diff --git a/init.lua b/init.lua index 19ae9c1..ee75a89 100644 --- a/init.lua +++ b/init.lua @@ -43,7 +43,11 @@ local add_fruit_regrowable = function(fruit, node, leaves) local groups = node.groups if minetest.get_item_group(node, "attached_node") == 1 then - groups = {fleshy=3, dig_immediate=3, flammable=2, leafdecay = 1, leafdecay_drop = 1} + if node == "default:apple" then + groups = {fleshy = 3, dig_immediate = 3, flammable = 2, leafdecay = 3, leafdecay_drop = 1, food_apple = 1} + else + groups = {fleshy=3, dig_immediate=3, flammable=2, leafdecay = 1, leafdecay_drop = 1} + end end -- override fruit @@ -84,10 +88,8 @@ local add_fruit_regrowable = function(fruit, node, leaves) minetest.remove_node(pos) elseif minetest.get_node_light(pos) < 13 then minetest.get_node_timer(pos):start(200) - elseif node == "cacaotree:pod" or node == "plumtree:plum" then - minetest.set_node(pos, {name = node, param2 = minetest.get_node(pos).param2}) else - minetest.set_node(pos, {name = node}) + minetest.set_node(pos, {name = node, param2 = minetest.get_node(pos).param2}) end end })