From 3ca6d4de3b75ce8fc5482e708866cc31736c0067 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 21:10:52 +0200 Subject: [PATCH] fix chunk probability and distributions --- mods/MAPGEN/mcl_geodes/init.lua | 1 + mods/MAPGEN/mcl_mapgen_core/init.lua | 4 +-- mods/MAPGEN/mcl_structures/api.lua | 9 ++++-- mods/MAPGEN/mcl_structures/desert_temple.lua | 12 ++------ mods/MAPGEN/mcl_structures/init.lua | 31 ++++---------------- mods/MAPGEN/mcl_structures/jungle_temple.lua | 14 ++------- mods/MAPGEN/mcl_structures/ocean_ruins.lua | 14 ++------- 7 files changed, 24 insertions(+), 61 deletions(-) diff --git a/mods/MAPGEN/mcl_geodes/init.lua b/mods/MAPGEN/mcl_geodes/init.lua index d0f0e0cabb..a1ea0b6316 100644 --- a/mods/MAPGEN/mcl_geodes/init.lua +++ b/mods/MAPGEN/mcl_geodes/init.lua @@ -76,6 +76,7 @@ mcl_structures.register_structure("geode",{ flags = "absvalue", }, flags = "place_center_x, place_center_z, force_placement", + terrain_feature = true, y_max = -24, y_min = mcl_vars.mg_overworld_min, y_offset = function(pr) return pr:next(-4,-2) end, diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index b064c6d736..25065be2a4 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1334,7 +1334,7 @@ local function generate_structures(minp, maxp, blockseed, biomemap) -- Witch hut (v6) if ground_y <= 0 and nn == "mcl_core:dirt" then local prob = minecraft_chunk_probability(48, minp, maxp) - if pr:next(1, prob) == 1 then + if mg_name == "v6" and pr:next(1, prob) == 1 then local swampland = minetest.get_biome_id("Swampland") local swampland_shore = minetest.get_biome_id("Swampland_shore") @@ -1345,7 +1345,7 @@ local function generate_structures(minp, maxp, blockseed, biomemap) here_be_witches = true end local here_be_witches = false - if mg_name == "v6" and here_be_witches then + if here_be_witches then local r = tostring(pr:next(0, 3) * 90) -- "0", "90", "180" or 270" local p1 = {x=p.x-1, y=WITCH_HUT_HEIGHT+2, z=p.z-1} diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 5c27fbb8e1..d9ab217020 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -46,13 +46,18 @@ function mcl_structures.place_structure(pos, def, pr) local bn = minetest.get_biome_name(minetest.get_biome_data(pos).biome) local node_top = minetest.registered_biomes[bn].node_top local node_fill = minetest.registered_biomes[bn].node_filler + local node_stone = minetest.registered_biomes[bn].node_stone local ground_p1 = vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2) local ground_p2 = vector.offset(pos,def.sidelen/2,-1,def.sidelen/2) + if not node_stone then node_stone = "mcl_core:stone" end + if not node_fill then node_fill = "mcl_core:dirt" end + if not node_top then node_top = "mcl_core:dirt_with_grass" end local solid = minetest.find_nodes_in_area(ground_p1,ground_p2,{"group:solid"}) if #solid < ( def.sidelen * def.sidelen ) then if def.make_foundation then minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,ground_p2,{"air","group:liquid"}),{name=node_top}) - minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-30,0),{"air","group:liquid"}),{name=node_fill}) + minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-4,0),{"air","group:liquid"}),{name=node_fill}) + minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-5,0),vector.offset(ground_p2,0,-30,0),{"air","group:liquid"}),{name=node_stone}) else if logging then minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. No solid ground.") @@ -124,7 +129,7 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it y_max = def.y_max, y_min = def.y_min }) - minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups}) + minetest.register_node(":"..structblock, {drawtype="normal", walkable = false, pointable = false,groups = sbgroups}) def.structblock = structblock def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) minetest.set_gen_notify({decoration=true}, { def.deco_id }) diff --git a/mods/MAPGEN/mcl_structures/desert_temple.lua b/mods/MAPGEN/mcl_structures/desert_temple.lua index 27e5ddfb98..ddacd83d2b 100644 --- a/mods/MAPGEN/mcl_structures/desert_temple.lua +++ b/mods/MAPGEN/mcl_structures/desert_temple.lua @@ -34,21 +34,13 @@ end mcl_structures.register_structure("desert_temple",{ place_on = {"group:sand"}, - noise_params = { - offset = 0, - scale = 0.0000822, - spread = {x = 250, y = 250, z = 250}, - seed = 34115, - octaves = 3, - persist = -0.4, - flags = "absvalue", - }, + fill_ratio = 0.01, flags = "place_center_x, place_center_z", solid_ground = true, make_foundation = true, sidelen = 18, y_offset = -12, - chunk_probability = 256, + chunk_probability = 500, y_max = mcl_vars.mg_overworld_max, y_min = 1, biomes = { "Desert" }, diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 12b9fc2486..a8a2d9b1b7 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -449,21 +449,12 @@ end mcl_structures.register_structure("witch_hut",{ place_on = {"group:sand","group:grass_block","mcl_core:water_source","group:dirt"}, - noise_params = { - offset = 0, - scale = 0.0012, - spread = {x = 250, y = 250, z = 250}, - seed = 233, - octaves = 3, - persist = 0.001, - flags = "absvalue", - }, + fill_ratio = 0.01, flags = "place_center_x, place_center_z, liquid_surface, force_placement", sidelen = 5, - chunk_probability = 64, + chunk_probability = 128, y_max = mcl_vars.mg_overworld_max, - y_min = 1, - --y_offset = function(pr) return pr:next(-4,1) end, + y_min = -4, y_offset = 0, biomes = { "Swampland", "Swampland_ocean", "Swampland_shore" }, filenames = { modpath.."/schematics/mcl_structures_witch_hut.mts" }, @@ -471,20 +462,12 @@ mcl_structures.register_structure("witch_hut",{ }) mcl_structures.register_structure("desert_well",{ place_on = {"group:sand"}, - noise_params = { - offset = 0, - scale = 0.00012, - spread = {x = 250, y = 250, z = 250}, - seed = 233, - octaves = 3, - persist = 0.001, - flags = "absvalue", - }, + fill_ratio = 0.01, flags = "place_center_x, place_center_z", not_near = { "desert_temple_new" }, solid_ground = true, sidelen = 4, - chunk_probability = 64, + chunk_probability = 256, y_max = mcl_vars.mg_overworld_max, y_min = 1, y_offset = -2, @@ -493,17 +476,15 @@ mcl_structures.register_structure("desert_well",{ }) mcl_structures.register_structure("boulder",{ - flags = "place_center_x, place_center_z", - sidelen = 4, filenames = { modpath.."/schematics/mcl_structures_boulder_small.mts", modpath.."/schematics/mcl_structures_boulder_small.mts", modpath.."/schematics/mcl_structures_boulder_small.mts", modpath.."/schematics/mcl_structures_boulder.mts", + -- small boulder 3x as likely }, },true) --is spawned as a normal decoration. this is just for /spawnstruct mcl_structures.register_structure("ice_spike_small",{ - sidelen = 3, filenames = { modpath.."/schematics/mcl_structures_ice_spike_small.mts" }, diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua index 1a7a620fef..aa5bf94127 100644 --- a/mods/MAPGEN/mcl_structures/jungle_temple.lua +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -4,20 +4,12 @@ local modpath = minetest.get_modpath(modname) mcl_structures.register_structure("jungle_temple",{ place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"}, - noise_params = { - offset = 0, - scale = 0.0000812, - spread = {x = 250, y = 250, z = 250}, - seed = 31585, - octaves = 3, - persist = -0.2, - flags = "absvalue", - }, + fill_ratio = 0.1, flags = "place_center_x, place_center_z", solid_ground = true, make_foundation = true, - y_offset = -5, - chunk_probability = 256, + y_offset = function(pr) return pr:next(-3,0) -5 end, + chunk_probability = 1500, y_max = mcl_vars.mg_overworld_max, y_min = 1, biomes = { "Jungle" }, diff --git a/mods/MAPGEN/mcl_structures/ocean_ruins.lua b/mods/MAPGEN/mcl_structures/ocean_ruins.lua index 256d4bb8db..dafc2dfff0 100644 --- a/mods/MAPGEN/mcl_structures/ocean_ruins.lua +++ b/mods/MAPGEN/mcl_structures/ocean_ruins.lua @@ -74,15 +74,7 @@ local cold = { place_on = {"group:sand","mcl_core:gravel","mcl_core:dirt","mcl_core:clay","group:material_stone"}, spawn_by = {"mcl_core:water_source"}, num_spawn_by = 2, - noise_params = { - offset = 0, - scale = 0.0000812, - spread = {x = 250, y = 250, z = 250}, - seed = 146315, - octaves = 3, - persist = -0.2, - flags = "absvalue", - }, + fill_ratio = 0.001, flags = "place_center_x, place_center_z, force_placement", solid_ground = true, make_foundation = true, @@ -90,8 +82,8 @@ local cold = { y_min = mcl_vars.mg_overworld_min, y_max = -2, biomes = cold_oceans, - chunk_probability = 64, - sidelen = 8, + chunk_probability = 128, + sidelen = 20, filenames = { modpath.."/schematics/mcl_structures_ocean_ruins_cold_1.mts", modpath.."/schematics/mcl_structures_ocean_ruins_cold_2.mts",