mt-mods / moretrees

Other
8 stars 11 forks source link

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

Open FaberUnserzeit opened 2 months ago

FaberUnserzeit commented 2 months ago

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 commented 1 month ago

feel free to submit a pr