From 4659d1a0f1d35a495928b81e65e2a74532a8d10a Mon Sep 17 00:00:00 2001 From: FossFanatic Date: Fri, 24 Feb 2023 12:17:24 +0000 Subject: [PATCH 1/2] Add function for colorwallmounted node rotation This commit adds a new utility function which helps find the rotation of `colorwallmounted` nodes. --- mods/CORE/mcl_util/init.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 0a4aea29a..b6c0956cd 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -1033,3 +1033,13 @@ function mcl_util.get_palette_indexes_from_pos(pos) return palette_indexes 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 From a4578539388903c6808f6cf41201c5a17e0a7d94 Mon Sep 17 00:00:00 2001 From: FossFanatic Date: Fri, 24 Feb 2023 12:22:08 +0000 Subject: [PATCH 2/2] Improve code relating to vines This commit makes the LBM and `register_on_generated` for foliage now use the better calculation for the vines. --- mods/MAPGEN/mcl_mapgen_core/init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 34bec8a52..7885d66c3 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -452,9 +452,9 @@ minetest.register_lbm({ minetest.set_node(pos, node) elseif node.name == "mcl_core:vine" then 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 - if node.param2 ~= final_param2 and rotation_param2 < 6 then + if node.param2 ~= final_param2 then node.param2 = final_param2 minetest.set_node(pos, node) end @@ -473,9 +473,9 @@ minetest.register_on_generated(function(minp, maxp, blockseed) -- Set correct pa minetest.set_node(fpos, fnode) elseif fnode.name == "mcl_core:vine" then 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 - if fnode.param2 ~= final_param2 and rotation_param2 < 6 then + if fnode.param2 ~= final_param2 then fnode.param2 = final_param2 minetest.set_node(fpos, fnode) end