There is two bugs that prevent any ancient tree variation from spawning at the world generation, in this function:
function Landscaper:_get_tree_size(tree_type, value) local size_determiner = self._tree_size_determiners[tree_type] local quantized = size_determiner.quantizer:quantize_down(value) local size = size_determiner.size_map[quantized] if size == 'large' then local rng = self._rng if rng:get_int(1, 100) <= size_determiner.ancient_percentage then return ancient end end return size end
First bug is that size_determiner.ancient_percentage is always being -1. This will make the rng never enter the if condition.
The reason why it is always -1 is because in the function
Landscaper:_parse_tree_sizes(tree_variants) there is this piece of code in a loop:
if tree_size == 'ancient' then size_determiner.ancient_percentage = threshold.percentage else size_determiner.ancient_percentage = -1 table.insert(thresholds, threshold) size_map[threshold] = tree_size end
Which will always resets the value back to -1, because the ‘ancient’ tree size is not the last call. As soon as another type (small, medium or large) is called, the condition falls into the else statement and the value goes back to -1.
The second bug is that even if we hard code a value there (like 50 to have a 50% chance), when the condition is met an error happens cause it is trying to return the non existent variable ancient, while it should return the string “ancient”