Improve some vines code
parent
a70a6ef13d
commit
d1ceacf7ba
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue