From 942d70ee623a9c5c66b451e8779d294dfdf90cd7 Mon Sep 17 00:00:00 2001 From: kay27 Date: Mon, 26 Apr 2021 04:09:14 +0400 Subject: [PATCH] [mapgen] temporarily delay chorus nodes grow --- mods/MAPGEN/mcl_biomes/init.lua | 11 ++++++----- mods/MAPGEN/mcl_dungeons/init.lua | 2 +- mods/MAPGEN/mcl_mapgen_core/init.lua | 12 ++++++++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index f583d87b6..9facd83b3 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -3971,13 +3971,14 @@ if mg_name ~= "singlenode" then -- Overworld decorations for v6 are handled in mcl_mapgen_core if deco_id_chorus_plant then - mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed) - local gennotify = minetest.get_mapgen_object("gennotify") - --local poslist = {} - for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do + mcl_mapgen.register_chunk_generator_lvm(function(c) + c.gennotify = c.gennotify or minetest.get_mapgen_object("gennotify") + local gennotify = c.gennotify + for _, pos in pairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do local realpos = { x = pos.x, y = pos.y + 1, z = pos.z } - mcl_end.grow_chorus_plant(realpos) + minetest.after(1, mcl_end.grow_chorus_plant, realpos) end + return c end) end diff --git a/mods/MAPGEN/mcl_dungeons/init.lua b/mods/MAPGEN/mcl_dungeons/init.lua index 58e23b12e..63433d08d 100644 --- a/mods/MAPGEN/mcl_dungeons/init.lua +++ b/mods/MAPGEN/mcl_dungeons/init.lua @@ -416,4 +416,4 @@ function mcl_dungeons.spawn_dungeon(p1, _, pr) emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr, dontcheck=true}) end -mcl_mapgen_core.register_generator("dungeons", nil, dungeons_nodes, 999999) +mcl_mapgen.register_chunk_generator(dungeons_nodes, 999999) diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index f46d303fd..031a568f7 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1890,8 +1890,11 @@ local function set_layers(data, area, content_id, check, min, max, minp, maxp, l end -- Below the bedrock, generate air/void -local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed) - local biomemap --ymin, ymax +local function basic(c) + local vm, data, emin, emax, area, minp, maxp, blockseed = c.vm, c.data, c.emin, c.emax, c.area, c.minp, c.maxp, c.blockseed + c.data2 = c.data2 or vm:get_data_param2(lvm_buffer_param2) + local data2 = c.data2 + local lvm_used = false local pr = PseudoRandom(blockseed) @@ -1935,7 +1938,8 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed) -- Clay, vines, cocoas lvm_used = generate_clay(minp, maxp, blockseed, data, area, lvm_used) - biomemap = minetest.get_mapgen_object("biomemap") + c.biomemap = c.biomemap or minetest.get_mapgen_object("biomemap") + lvm_used = generate_tree_decorations(minp, maxp, blockseed, data, data2, area, biomemap, lvm_used, pr) ----- Interactive block fixing section ----- @@ -2098,5 +2102,5 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed) return lvm_used, shadow end -mcl_mapgen_core.register_generator("main", basic, nil, 1, true) +mcl_mapgen.register_chunk_generator_lvm(basic, 1)