Improve some vines code

This commit is contained in:
FossFanatic 2023-02-12 08:22:07 +00:00
parent a70a6ef13d
commit d1ceacf7ba

View File

@ -158,20 +158,15 @@ minetest.register_node("mcl_core:vine", {
end, end,
on_construct = function(pos) on_construct = function(pos)
if mg_name ~= "v6" and mg_name ~= "singlenode" then local node = minetest.get_node(pos)
local node = minetest.get_node(pos) local reg_biome = mcl_util.get_registered_biome_from_pos(pos)
local biome_data = minetest.get_biome_data(pos) if node.name == "mcl_core:vine" then
local biome = biome_data.biome local biome_param2 = reg_biome._mcl_foliage_palette_index
local biome_name = minetest.get_biome_name(biome) local rotation_param2 = node.param2
local reg_biome = minetest.registered_biomes[biome_name] local final_param2 = (biome_param2 * 8) + rotation_param2
if node.name == "mcl_core:vine" then if node.param2 ~= final_param2 and rotation_param2 < 6 then
local biome_param2 = reg_biome._mcl_foliage_palette_index node.param2 = final_param2
local rotation_param2 = node.param2 minetest.swap_node(pos, node)
local final_param2 = (biome_param2 * 8) + rotation_param2
if node.param2 ~= final_param2 and rotation_param2 < 6 then
node.param2 = final_param2
minetest.swap_node(pos, node)
end
end end
end end
end, end,