Merge pull request 'Vine Colouring Improvements' (#3480) from vine_rotation_calculation into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3480
Reviewed-by: PrairieWind <prairiewind@noreply.git.minetest.land>
This commit is contained in:
PrairieWind 2023-02-28 03:10:57 +00:00
commit 51c374b31f
2 changed files with 14 additions and 4 deletions

@ -1033,3 +1033,13 @@ function mcl_util.get_palette_indexes_from_pos(pos)
return palette_indexes return palette_indexes
end end
end end
function mcl_util.get_colorwallmounted_rotation(pos)
local colorwallmounted_node = minetest.get_node(pos)
for i = 0, 32, 1 do
local colorwallmounted_rotation = colorwallmounted_node.param2 - (i * 8)
if colorwallmounted_rotation < 6 then
return colorwallmounted_rotation
end
end
end

@ -452,9 +452,9 @@ minetest.register_lbm({
minetest.set_node(pos, node) minetest.set_node(pos, node)
elseif node.name == "mcl_core:vine" then elseif node.name == "mcl_core:vine" then
local biome_param2 = foliage_palette_index local biome_param2 = foliage_palette_index
local rotation_param2 = node.param2 local rotation_param2 = mcl_util.get_colorwallmounted_rotation(pos)
local final_param2 = (biome_param2 * 8) + rotation_param2 local final_param2 = (biome_param2 * 8) + rotation_param2
if node.param2 ~= final_param2 and rotation_param2 < 6 then if node.param2 ~= final_param2 then
node.param2 = final_param2 node.param2 = final_param2
minetest.set_node(pos, node) minetest.set_node(pos, node)
end end
@ -473,9 +473,9 @@ minetest.register_on_generated(function(minp, maxp, blockseed) -- Set correct pa
minetest.set_node(fpos, fnode) minetest.set_node(fpos, fnode)
elseif fnode.name == "mcl_core:vine" then elseif fnode.name == "mcl_core:vine" then
local biome_param2 = foliage_palette_index local biome_param2 = foliage_palette_index
local rotation_param2 = fnode.param2 local rotation_param2 = mcl_util.get_colorwallmounted_rotation(fpos)
local final_param2 = (biome_param2 * 8) + rotation_param2 local final_param2 = (biome_param2 * 8) + rotation_param2
if fnode.param2 ~= final_param2 and rotation_param2 < 6 then if fnode.param2 ~= final_param2 then
fnode.param2 = final_param2 fnode.param2 = final_param2
minetest.set_node(fpos, fnode) minetest.set_node(fpos, fnode)
end end