mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 05:43:43 +01:00
Add old method back for foliage
This commit adds back the old `set_node` method for the foliage, since the foliage is much more difficult to work with via the VoxelManip method due to them being part of schematics that could span across mapblocks in some cases. The old method will complement the new one by running after the VoxelManip has done its job, and fixes any foliage that the VoxelManip had missed.
This commit is contained in:
parent
d28dcb1b10
commit
01ac9ad685
@ -577,3 +577,25 @@ minetest.register_lbm({
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed) -- Set correct palette indexes of missed foliage.
|
||||
local pos1, pos2 = vector.offset(minp, -16, -16, -16), vector.offset(maxp, 16, 16, 16)
|
||||
local foliage = minetest.find_nodes_in_area(pos1, pos2, {"group:foliage_palette", "group:foliage_palette_wallmounted"})
|
||||
for _, fpos in pairs(foliage) do
|
||||
local fnode = minetest.get_node(fpos)
|
||||
local foliage_palette_index = mcl_util.get_palette_indexes_from_pos(fpos).foliage_palette_index
|
||||
if fnode.param2 ~= foliage_palette_index and fnode.name ~= "mcl_core:vine" then
|
||||
fnode.param2 = foliage_palette_index
|
||||
minetest.set_node(fpos, fnode)
|
||||
elseif fnode.name == "mcl_core:vine" then
|
||||
local biome_param2 = foliage_palette_index
|
||||
local rotation_param2 = mcl_util.get_colorwallmounted_rotation(fpos)
|
||||
local final_param2 = (biome_param2 * 8) + rotation_param2
|
||||
if fnode.param2 ~= final_param2 then
|
||||
fnode.param2 = final_param2
|
||||
minetest.set_node(fpos, fnode)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user