Improve the new code somewhat
parent
7b7e213925
commit
f653f47f26
|
@ -458,11 +458,10 @@ minetest.register_lbm({
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed) -- Set correct palette indexes of foliage in brand new mapblocks.
|
minetest.register_on_generated(function(minp, maxp, blockseed) -- Set correct palette indexes of foliage in brand new mapblocks.
|
||||||
local pos1, pos2 = vector.offset(minp, -16, -16, -16), vector.offset(maxp, 16, 16, 16)
|
local pos1, pos2 = vector.offset(minp, -16, -16, -16), vector.offset(maxp, 16, 16, 16)
|
||||||
local fnode
|
|
||||||
local foliage = minetest.find_nodes_in_area(pos1, pos2, {"group:foliage_palette", "group:foliage_palette_wallmounted"})
|
local foliage = minetest.find_nodes_in_area(pos1, pos2, {"group:foliage_palette", "group:foliage_palette_wallmounted"})
|
||||||
for _, fpos in pairs(foliage) do
|
for _, fpos in pairs(foliage) do
|
||||||
fnode = minetest.get_node(fpos)
|
local fnode = minetest.get_node(fpos)
|
||||||
reg_biome = mcl_util.get_registered_biome_from_pos(fpos)
|
local reg_biome = mcl_util.get_registered_biome_from_pos(fpos)
|
||||||
if reg_biome and reg_biome._mcl_foliage_palette_index and fnode.param2 ~= reg_biome._mcl_foliage_palette_index and fnode.name ~= "mcl_core:vine" then
|
if reg_biome and reg_biome._mcl_foliage_palette_index and fnode.param2 ~= reg_biome._mcl_foliage_palette_index and fnode.name ~= "mcl_core:vine" then
|
||||||
fnode.param2 = reg_biome._mcl_foliage_palette_index
|
fnode.param2 = reg_biome._mcl_foliage_palette_index
|
||||||
minetest.set_node(fpos, fnode)
|
minetest.set_node(fpos, fnode)
|
||||||
|
|
Loading…
Reference in New Issue