Improve some LBM code

This commit is contained in:
FossFanatic 2023-02-12 08:23:19 +00:00
parent d1ceacf7ba
commit 3590ff6dfb

View file

@ -457,16 +457,11 @@ minetest.register_lbm({
nodenames = {"mcl_core:dirt_with_grass", "mcl_flowers:tallgrass", "mcl_flowers:double_grass", "mcl_flowers:double_grass_top", "mcl_flowers:fern", "mcl_flowers:double_fern", "mcl_flowers:double_fern_top", "mcl_core:reeds", "mcl_core:dirt_with_grass_snow"}, nodenames = {"mcl_core:dirt_with_grass", "mcl_flowers:tallgrass", "mcl_flowers:double_grass", "mcl_flowers:double_grass_top", "mcl_flowers:fern", "mcl_flowers:double_fern", "mcl_flowers:double_fern_top", "mcl_core:reeds", "mcl_core:dirt_with_grass_snow"},
run_at_every_load = true, run_at_every_load = true,
action = function(pos, node) action = function(pos, node)
if mg_name ~= "v6" and mg_name ~= "singlenode" then local reg_biome = mcl_util.get_registered_biome_from_pos(pos)
local biome_data = minetest.get_biome_data(pos)
local biome = biome_data.biome
local biome_name = minetest.get_biome_name(biome)
local reg_biome = minetest.registered_biomes[biome_name]
if node.param2 ~= reg_biome._mcl_grass_palette_index then if node.param2 ~= reg_biome._mcl_grass_palette_index then
node.param2 = reg_biome._mcl_grass_palette_index node.param2 = reg_biome._mcl_grass_palette_index
minetest.set_node(pos, node) minetest.set_node(pos, node)
end end
end
end, end,
}) })
@ -476,11 +471,7 @@ minetest.register_lbm({
nodenames = {"group:foliage_palette", "group:foliage_palette_wallmounted"}, nodenames = {"group:foliage_palette", "group:foliage_palette_wallmounted"},
run_at_every_load = true, run_at_every_load = true,
action = function(pos, node) action = function(pos, node)
if mg_name ~= "v6" and mg_name ~= "singlenode" then local reg_biome = mcl_util.get_registered_biome_from_pos(pos)
local biome_data = minetest.get_biome_data(pos)
local biome = biome_data.biome
local biome_name = minetest.get_biome_name(biome)
local reg_biome = minetest.registered_biomes[biome_name]
if node.param2 ~= reg_biome._mcl_foliage_palette_index and node.name ~= "mcl_core:vine" then if node.param2 ~= reg_biome._mcl_foliage_palette_index and node.name ~= "mcl_core:vine" then
node.param2 = reg_biome._mcl_foliage_palette_index node.param2 = reg_biome._mcl_foliage_palette_index
minetest.set_node(pos, node) minetest.set_node(pos, node)
@ -493,6 +484,5 @@ minetest.register_lbm({
minetest.set_node(pos, node) minetest.set_node(pos, node)
end end
end end
end
end, end,
}) })