From 88c845166cc364bdc34341620071db9cecaf7f16 Mon Sep 17 00:00:00 2001 From: cx384 Date: Fri, 6 Dec 2024 18:06:27 +0100 Subject: [PATCH] Fix L-System trees fruit node regression (#15513) --- src/mapgen/treegen.cpp | 3 +-- src/script/common/c_content.cpp | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/mapgen/treegen.cpp b/src/mapgen/treegen.cpp index 483ec4797..e03f41482 100644 --- a/src/mapgen/treegen.cpp +++ b/src/mapgen/treegen.cpp @@ -23,8 +23,7 @@ void TreeDef::resolveNodeNames() getIdFromNrBacklog(&leavesnode.param0, "", CONTENT_IGNORE); if (leaves2_chance) getIdFromNrBacklog(&leaves2node.param0, "", CONTENT_IGNORE); - if (fruit_chance) - getIdFromNrBacklog(&fruitnode.param0, "", CONTENT_IGNORE); + getIdFromNrBacklog(&fruitnode.param0, "", CONTENT_IGNORE); } /* diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 6367e53f3..5f000acd8 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -2032,12 +2032,11 @@ bool read_tree_def(lua_State *L, int idx, const NodeDefManager *ndef, getstringfield(L, idx, "trunk_type", tree_def.trunk_type); getboolfield(L, idx, "thin_branches", tree_def.thin_branches); tree_def.fruit_chance = 0; + fruit = "air"; getstringfield(L, idx, "fruit", fruit); - if (!fruit.empty()) { + if (!fruit.empty()) getintfield(L, idx, "fruit_chance", tree_def.fruit_chance); - if (tree_def.fruit_chance) - tree_def.m_nodenames.push_back(fruit); - } + tree_def.m_nodenames.push_back(fruit); tree_def.explicit_seed = getintfield(L, idx, "seed", tree_def.seed); // Resolves the node IDs for trunk, leaves, leaves2 and fruit at runtime,