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.
This commit is contained in:
FossFanatic 2023-04-04 10:59:28 +00:00 committed by Gitea
parent 76bf98b26c
commit d8d83dd21c

@ -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