From d8d83dd21cbe3eda2b73f217fe5c73e0d7f1081a Mon Sep 17 00:00:00 2001 From: FossFanatic Date: Tue, 4 Apr 2023 10:59:28 +0000 Subject: [PATCH] Make vines use voxelmanip colouring as well This commit adds some code to the `set_foliage_palette` function which checks for the `param2` of the foliage node in question to see whether or not said `param2` value is `0` upon first being generated. If it isn't, then it's safe to assume that said foliage is a vine, and therefore needs to use the other method of calculating the final `param2` value. --- mods/MAPGEN/mcl_mapgen_core/init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 13aeb1841..401532c07 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -302,9 +302,12 @@ local function set_foliage_palette(minp,maxp,data2,area,biomemap,nodes) local bn = minetest.get_biome_name(biomemap[b_pos]) if bn then local biome = minetest.registered_biomes[bn] - if biome and biome._mcl_biome_type and biome._mcl_foliage_palette_index then + if biome and biome._mcl_biome_type and biome._mcl_foliage_palette_index and data2[p_pos] == 0 then data2[p_pos] = biome._mcl_foliage_palette_index lvm_used = true + elseif biome and biome._mcl_biome_type and biome._mcl_foliage_palette_index and data2[p_pos] ~= 0 then + data2[p_pos] = (biome._mcl_foliage_palette_index * 8) + data2[p_pos] + lvm_used = true end end end @@ -416,7 +419,7 @@ local function block_fixes_foliage(vm, data, data2, emin, emax, area, minp, maxp local pr = PseudoRandom(blockseed) if minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min then -- Set param2 (=color) of nodes which use the foliage colour palette. - lvm_used = set_foliage_palette(minp,maxp,data2,area,biomemap,{"group:foliage_palette"}) + lvm_used = set_foliage_palette(minp,maxp,data2,area,biomemap,{"group:foliage_palette", "group:foliage_palette_wallmounted"}) end return lvm_used end