From 466c48d5f39e267414b01103a41ef527e430711a Mon Sep 17 00:00:00 2001 From: proller Date: Mon, 22 Jan 2024 01:47:24 +0100 Subject: [PATCH] Rare tree grow without light --- games/default | 2 +- src/content_abm_grow_tree.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/games/default b/games/default index 731069426..8fe067539 160000 --- a/games/default +++ b/games/default @@ -1 +1 @@ -Subproject commit 7310694262b399d3a9c39d5aeec46b7b3e69fced +Subproject commit 8fe067539d975c37bb16a68cfb0b78d23397397a diff --git a/src/content_abm_grow_tree.cpp b/src/content_abm_grow_tree.cpp index c48cfe2fd..1c4d26b92 100644 --- a/src/content_abm_grow_tree.cpp +++ b/src/content_abm_grow_tree.cpp @@ -21,6 +21,7 @@ along with Freeminer. If not, see . #include #include +#include "light.h" #include "mapnode.h" #include "nodedef.h" #include "server.h" @@ -397,7 +398,8 @@ class GrowTree : public ActiveBlockModifier for (int i = D_SELF + 1; i <= D_BOTTOM; ++i) { auto &nb = nbh[i]; const bool allow_grow_by_light = - !nb.top || nb.light <= params.tree_grow_light_max; + (!nb.top || (nb.light <= params.tree_grow_light_max && + !myrand_range(0, LIGHT_MAX - nb.light))); bool up_all_leaves = true; //DUMP("gr", i, nb.top, nb.bottom, allow_grow_by_light, nb.water_level, nb.is_leaves, nb.is_tree, nb.is_liquid, nb.is_soil);