Change the grass LBM & generator

This commit makes the grass LBM & generator look for nodes in the `grass_palette` group, instead of looking at a local list.
This commit is contained in:
FossFanatic 2023-02-24 13:57:35 +00:00 committed by Gitea
parent 260a76e5ee
commit b80dd0294c

View file

@ -345,15 +345,13 @@ local function world_structure(vm, data, data2, emin, emax, area, minp, maxp, bl
return lvm_used, lvm_used, deco, ores return lvm_used, lvm_used, deco, ores
end end
local affected_grass_blocks = {"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"}
local function block_fixes_grass(vm, data, data2, emin, emax, area, minp, maxp, blockseed) local function block_fixes_grass(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
local biomemap = minetest.get_mapgen_object("biomemap") local biomemap = minetest.get_mapgen_object("biomemap")
local lvm_used = false local lvm_used = false
local pr = PseudoRandom(blockseed) local pr = PseudoRandom(blockseed)
if minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min then if minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min then
-- Set param2 (=color) of nodes which use the grass colour palette. -- Set param2 (=color) of nodes which use the grass colour palette.
lvm_used = set_grass_palette(minp,maxp,data2,area,biomemap,affected_grass_blocks) lvm_used = set_grass_palette(minp,maxp,data2,area,biomemap,{"group:grass_palette"})
end end
return lvm_used return lvm_used
end end
@ -424,7 +422,7 @@ end, 100, true)
minetest.register_lbm({ minetest.register_lbm({
label = "Fix grass palette indexes", -- This LBM fixes any incorrect grass palette indexes. label = "Fix grass palette indexes", -- This LBM fixes any incorrect grass palette indexes.
name = "mcl_mapgen_core:fix_grass_palette_indexes", name = "mcl_mapgen_core:fix_grass_palette_indexes",
nodenames = affected_grass_blocks, nodenames = {"group:grass_palette"},
run_at_every_load = false, run_at_every_load = false,
action = function(pos, node) action = function(pos, node)
local grass_palette_index = mcl_util.get_palette_indexes_from_pos(pos).grass_palette_index local grass_palette_index = mcl_util.get_palette_indexes_from_pos(pos).grass_palette_index