Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid values for near_nodes_count in biome_defs.lua inhibit the existence of certain trees. #48

Open
FaberUnserzeit opened this issue Sep 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@FaberUnserzeit
Copy link

FaberUnserzeit commented Sep 7, 2024

The field near_nodes_count in moretrees._biome in mods/moretrees/biome_defs.lua becomes the value for the field num_spawn_by in the structure deco_def in function translate_biome_defs(def, treename, index) in mods/moretrees/init.lua.
The structure deco_def is passed to minetest.register_decoration(), which is implemented in the C++-method int ModApiMapgen::l_register_decoration(lua_State *L) in src/script/lua_api/l_mapgen.cpp.
There an object of the class Decoration is generated and it's member nspawnby is set to the value of num_spawn_by. This value is later being checked in bool Decoration::canPlaceDecoration(MMVManip *vm, v3s16 p) in src/mapgen/mg_decoration.cpp. There a for-loop traverses through an array of 8 directions consisting of triplets of integer values between -1 and 1. For each of these 8 directions the referred block is checked for containing the required type of block and, if so, a counter is incremented. This counter, that inherently cannot exceed 8, is checked against nspawnby, which has it's value from near_nodes_count. Thus any tree with a near_nodes_count higher than 8 can never grow.

This applies to:
moretrees.palm_biome (near_nodes_count = 10)
moretrees.date_palm_biome (near_nodes_count = 100 - WTH!?)
moretrees.rubber_tree_biome (near_nodes_count = 10)
moretrees.poplar_biome_2 (near_nodes_count = 10)

To reproduce this, create a V7 World with the seed normal5 with moretrees activated and fly to position x=-663 z=237.
Change moretrees.rubber_tree_biome.near_nodes_count to 3 and create an equal world. Fly to position x=-663 z=237 and find a rubber tree (or a sapling, if you are fast enough).

I suggest to use values of 3 or maybe 4. There should be some fun in gamplay apart from running around for hours to look for trees, that are too rare to be found or that don't even exist and one doesn't even know.
Especially rubber trees should become relatively easy to find, as basic crafts in the mod Technic depend on them. Technic has it's own rubber trees, but they only become activated, if moretrees is not activated.
In the open field this issue has been solved in recent years(!) by admins giving rubber tree saplings to players, but that can't be the solution!
This would also fix #33 (rubber trees are too rare).

@wsor4035
Copy link
Contributor

wsor4035 commented Sep 7, 2024

feel free to submit a pr

@BuckarooBanzay BuckarooBanzay added the bug Something isn't working label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants