From 2fe5ac8569db2c6aef7c08571d85622a13c0dcbf Mon Sep 17 00:00:00 2001 From: MysticTempest Date: Thu, 28 Jan 2021 23:59:01 -0600 Subject: [PATCH] Add experimental, pseudobiome-based village variation. --- mods/MAPGEN/mcl_villages/buildings.lua | 48 +++++++++++++++++++++++--- mods/MAPGEN/mcl_villages/const.lua | 48 ++++++++++++++++++-------- mods/MAPGEN/mcl_villages/paths.lua | 6 +++- mods/MAPGEN/mcl_villages/utils.lua | 5 +-- settingtypes.txt | 2 ++ 5 files changed, 88 insertions(+), 21 deletions(-) diff --git a/mods/MAPGEN/mcl_villages/buildings.lua b/mods/MAPGEN/mcl_villages/buildings.lua index 1dc9d0c25b..db52bf2cce 100644 --- a/mods/MAPGEN/mcl_villages/buildings.lua +++ b/mods/MAPGEN/mcl_villages/buildings.lua @@ -270,7 +270,7 @@ function settlements.place_schematics_lvm(settlement_info, pr) local platform_material = settlement_info[i]["surface_mat"] platform_material_name = minetest.get_name_from_content_id(platform_material) -- pick random material - local material = wallmaterial[pr:next(1,#wallmaterial)] + --local material = wallmaterial[pr:next(1,#wallmaterial)] -- local building = building_all_info["mts"] local replace_wall = building_all_info["rplc"] @@ -280,7 +280,27 @@ function settlements.place_schematics_lvm(settlement_info, pr) {lua_use_comments = false, lua_num_indent_spaces = 0}).." return(schematic)" -- replace material if replace_wall == "y" then - schem_lua = schem_lua:gsub("mcl_core:cobble", material) + --Note, block substitution isn't matching node names exactly; so nodes that are to be substituted that have the same prefixes cause bugs. + -- Example: Attempting to swap out 'mcl_core:stonebrick'; which has multiple, additional sub-variants: (carved, cracked, mossy). Will currently cause issues, so leaving disabled. + if platform_material == "mcl_core:snow" or platform_material == "mcl_core:dirt_with_grass_snow" or platform_material == "mcl_core:podzol" then + schem_lua = schem_lua:gsub("mcl_core:tree", "mcl_core:sprucetree") + schem_lua = schem_lua:gsub("mcl_core:wood", "mcl_core:sprucewood") + --schem_lua = schem_lua:gsub("mcl_fences:fence", "mcl_fences:spruce_fence") + --schem_lua = schem_lua:gsub("mcl_stairs:slab_wood_top", "mcl_stairs:slab_sprucewood_top") + --schem_lua = schem_lua:gsub("mcl_stairs:stair_wood", "mcl_stairs:stair_sprucewood") + --schem_lua = schem_lua:gsub("mesecons_pressureplates:pressure_plate_wood_off", "mesecons_pressureplates:pressure_plate_sprucewood_off") + elseif platform_material == "mcl_core:sand" or platform_material == "mcl_core:redsand" then + schem_lua = schem_lua:gsub("mcl_core:tree", "mcl_core:sandstonecarved") + schem_lua = schem_lua:gsub("mcl_core:cobble", "mcl_core:sandstone") + schem_lua = schem_lua:gsub("mcl_core:wood", "mcl_core:sandstonesmooth") + --schem_lua = schem_lua:gsub("mcl_fences:fence", "mcl_fences:birch_fence") + --schem_lua = schem_lua:gsub("mcl_stairs:slab_wood_top", "mcl_stairs:slab_birchwood_top") + --schem_lua = schem_lua:gsub("mcl_stairs:stair_wood", "mcl_stairs:stair_birchwood") + --schem_lua = schem_lua:gsub("mesecons_pressureplates:pressure_plate_wood_off", "mesecons_pressureplates:pressure_plate_birchwood_off") + --schem_lua = schem_lua:gsub("mcl_stairs:stair_stonebrick", "mcl_stairs:stair_redsandstone") + --schem_lua = schem_lua:gsub("mcl_core:stonebrick", "mcl_core:redsandstonesmooth") + schem_lua = schem_lua:gsub("mcl_core:brick_block", "mcl_core:redsandstone") + end end schem_lua = schem_lua:gsub("mcl_core:dirt_with_grass", platform_material_name) @@ -321,7 +341,7 @@ function settlements.place_schematics(settlement_info, pr) local platform_material = settlement_info[i]["surface_mat"] --platform_material_name = minetest.get_name_from_content_id(platform_material) -- pick random material - local material = wallmaterial[pr:next(1,#wallmaterial)] + --local material = wallmaterial[pr:next(1,#wallmaterial)] -- local building = building_all_info["mts"] local replace_wall = building_all_info["rplc"] @@ -331,7 +351,27 @@ function settlements.place_schematics(settlement_info, pr) {lua_use_comments = false, lua_num_indent_spaces = 0}).." return(schematic)" -- replace material if replace_wall == "y" then - schem_lua = schem_lua:gsub("mcl_core:cobble", material) + --Note, block substitution isn't matching node names exactly; so nodes that are to be substituted that have the same prefixes cause bugs. + -- Example: Attempting to swap out 'mcl_core:stonebrick'; which has multiple, additional sub-variants: (carved, cracked, mossy). Will currently cause issues, so leaving disabled. + if platform_material == "mcl_core:snow" or platform_material == "mcl_core:dirt_with_grass_snow" or platform_material == "mcl_core:podzol" then + schem_lua = schem_lua:gsub("mcl_core:tree", "mcl_core:sprucetree") + schem_lua = schem_lua:gsub("mcl_core:wood", "mcl_core:sprucewood") + --schem_lua = schem_lua:gsub("mcl_fences:fence", "mcl_fences:spruce_fence") + --schem_lua = schem_lua:gsub("mcl_stairs:slab_wood_top", "mcl_stairs:slab_sprucewood_top") + --schem_lua = schem_lua:gsub("mcl_stairs:stair_wood", "mcl_stairs:stair_sprucewood") + --schem_lua = schem_lua:gsub("mesecons_pressureplates:pressure_plate_wood_off", "mesecons_pressureplates:pressure_plate_sprucewood_off") + elseif platform_material == "mcl_core:sand" or platform_material == "mcl_core:redsand" then + schem_lua = schem_lua:gsub("mcl_core:tree", "mcl_core:sandstonecarved") + schem_lua = schem_lua:gsub("mcl_core:cobble", "mcl_core:sandstone") + schem_lua = schem_lua:gsub("mcl_core:wood", "mcl_core:sandstonesmooth") + --schem_lua = schem_lua:gsub("mcl_fences:fence", "mcl_fences:birch_fence") + --schem_lua = schem_lua:gsub("mcl_stairs:slab_wood_top", "mcl_stairs:slab_birchwood_top") + --schem_lua = schem_lua:gsub("mcl_stairs:stair_wood", "mcl_stairs:stair_birchwood") + --schem_lua = schem_lua:gsub("mesecons_pressureplates:pressure_plate_wood_off", "mesecons_pressureplates:pressure_plate_birchwood_off") + --schem_lua = schem_lua:gsub("mcl_stairs:stair_stonebrick", "mcl_stairs:stair_redsandstone") + --schem_lua = schem_lua:gsub("mcl_core:stonebrick", "mcl_core:redsandstonesmooth") + schem_lua = schem_lua:gsub("mcl_core:brick_block", "mcl_core:redsandstone") + end end schem_lua = schem_lua:gsub("mcl_core:dirt_with_grass", platform_material) diff --git a/mods/MAPGEN/mcl_villages/const.lua b/mods/MAPGEN/mcl_villages/const.lua index 285152f54f..20eeecd389 100644 --- a/mods/MAPGEN/mcl_villages/const.lua +++ b/mods/MAPGEN/mcl_villages/const.lua @@ -10,6 +10,7 @@ settlements.lvm = false settlements.last_settlement = os.time() +--[[ Manually set in 'buildings.lua' -- material to replace cobblestone with wallmaterial = { "mcl_core:junglewood", @@ -23,6 +24,7 @@ wallmaterial = { "mcl_core:sandstone", "mcl_core:sandstonesmooth2" } +--]] settlements.surface_mat = {} ------------------------------------------------------------------------------- -- Set array to list @@ -38,7 +40,7 @@ function settlements.grundstellungen() "mcl_core:sand", "mcl_core:redsand", --"mcl_core:silver_sand", - "mcl_core:snowblock" + "mcl_core:snow" } end -- @@ -52,19 +54,37 @@ schem_path = settlements.modpath.."/schematics/" -- -- list of schematics -- -schematic_table = { - {name = "large_house", mts = schem_path.."large_house.mts", hwidth = 11, hdepth = 12, hheight = 9, hsize = 14, max_num = 0.08, rplc = "n"}, - {name = "blacksmith", mts = schem_path.."blacksmith.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.055, rplc = "n"}, - {name = "butcher", mts = schem_path.."butcher.mts", hwidth = 11, hdepth = 8, hheight = 10, hsize = 14, max_num = 0.03, rplc = "n"}, - {name = "church", mts = schem_path.."church.mts", hwidth = 13, hdepth = 13, hheight = 14, hsize = 15, max_num = 0.04, rplc = "n"}, - {name = "farm", mts = schem_path.."farm.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.1, rplc = "n"}, - {name = "lamp", mts = schem_path.."lamp.mts", hwidth = 3, hdepth = 3, hheight = 13, hsize = 10, max_num = 0.1, rplc = "n"}, - {name = "library", mts = schem_path.."library.mts", hwidth = 12, hdepth = 12, hheight = 8, hsize = 13, max_num = 0.04, rplc = "n"}, - {name = "medium_house", mts = schem_path.."medium_house.mts", hwidth = 8, hdepth = 12, hheight = 8, hsize = 14, max_num = 0.08, rplc = "n"}, - {name = "small_house", mts = schem_path.."small_house.mts", hwidth = 9, hdepth = 7, hheight = 8, hsize = 13, max_num = 0.7, rplc = "n"}, - {name = "tavern", mts = schem_path.."tavern.mts", hwidth = 11, hdepth = 10, hheight = 10, hsize = 13, max_num = 0.050, rplc = "n"}, - {name = "well", mts = schem_path.."well.mts", hwidth = 6, hdepth = 8, hheight = 6, hsize = 10, max_num = 0.045, rplc = "n"}, -} +local basic_pseudobiome_villages = minetest.settings:get_bool("basic_pseudobiome_villages", false) + +if basic_pseudobiome_villages == true then + schematic_table = { + {name = "large_house", mts = schem_path.."large_house.mts", hwidth = 11, hdepth = 12, hheight = 9, hsize = 14, max_num = 0.08, rplc = "y"}, + {name = "blacksmith", mts = schem_path.."blacksmith.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.055, rplc = "y"}, + {name = "butcher", mts = schem_path.."butcher.mts", hwidth = 11, hdepth = 8, hheight = 10, hsize = 14, max_num = 0.03, rplc = "y"}, + {name = "church", mts = schem_path.."church.mts", hwidth = 13, hdepth = 13, hheight = 14, hsize = 15, max_num = 0.04, rplc = "y"}, + {name = "farm", mts = schem_path.."farm.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.1, rplc = "y"}, + {name = "lamp", mts = schem_path.."lamp.mts", hwidth = 3, hdepth = 3, hheight = 13, hsize = 10, max_num = 0.1, rplc = "n"}, + {name = "library", mts = schem_path.."library.mts", hwidth = 12, hdepth = 12, hheight = 8, hsize = 13, max_num = 0.04, rplc = "y"}, + {name = "medium_house", mts = schem_path.."medium_house.mts", hwidth = 8, hdepth = 12, hheight = 8, hsize = 14, max_num = 0.08, rplc = "y"}, + {name = "small_house", mts = schem_path.."small_house.mts", hwidth = 9, hdepth = 7, hheight = 8, hsize = 13, max_num = 0.7, rplc = "y"}, + {name = "tavern", mts = schem_path.."tavern.mts", hwidth = 11, hdepth = 10, hheight = 10, hsize = 13, max_num = 0.050, rplc = "y"}, + {name = "well", mts = schem_path.."well.mts", hwidth = 6, hdepth = 8, hheight = 6, hsize = 10, max_num = 0.045, rplc = "y"}, + } +else + schematic_table = { + {name = "large_house", mts = schem_path.."large_house.mts", hwidth = 11, hdepth = 12, hheight = 9, hsize = 14, max_num = 0.08, rplc = "n"}, + {name = "blacksmith", mts = schem_path.."blacksmith.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.055, rplc = "n"}, + {name = "butcher", mts = schem_path.."butcher.mts", hwidth = 11, hdepth = 8, hheight = 10, hsize = 14, max_num = 0.03, rplc = "n"}, + {name = "church", mts = schem_path.."church.mts", hwidth = 13, hdepth = 13, hheight = 14, hsize = 15, max_num = 0.04, rplc = "n"}, + {name = "farm", mts = schem_path.."farm.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 13, max_num = 0.1, rplc = "n"}, + {name = "lamp", mts = schem_path.."lamp.mts", hwidth = 3, hdepth = 3, hheight = 13, hsize = 10, max_num = 0.1, rplc = "n"}, + {name = "library", mts = schem_path.."library.mts", hwidth = 12, hdepth = 12, hheight = 8, hsize = 13, max_num = 0.04, rplc = "n"}, + {name = "medium_house", mts = schem_path.."medium_house.mts", hwidth = 8, hdepth = 12, hheight = 8, hsize = 14, max_num = 0.08, rplc = "n"}, + {name = "small_house", mts = schem_path.."small_house.mts", hwidth = 9, hdepth = 7, hheight = 8, hsize = 13, max_num = 0.7, rplc = "n"}, + {name = "tavern", mts = schem_path.."tavern.mts", hwidth = 11, hdepth = 10, hheight = 10, hsize = 13, max_num = 0.050, rplc = "n"}, + {name = "well", mts = schem_path.."well.mts", hwidth = 6, hdepth = 8, hheight = 6, hsize = 10, max_num = 0.045, rplc = "n"}, + } +end -- -- list of settlements, load on server start up -- diff --git a/mods/MAPGEN/mcl_villages/paths.lua b/mods/MAPGEN/mcl_villages/paths.lua index 6601fc7621..71347502dd 100644 --- a/mods/MAPGEN/mcl_villages/paths.lua +++ b/mods/MAPGEN/mcl_villages/paths.lua @@ -164,7 +164,11 @@ function settlements.paths(settlement_info) -- replace surface node with mcl_core:grass_path if surface_point then - minetest.swap_node(surface_point,{name="mcl_core:grass_path"}) + if surface_mat == "mcl_core:sand" or surface_mat == "mcl_core:redsand" then + minetest.swap_node(surface_point,{name="mcl_core:sandstonesmooth2"}) + else + minetest.swap_node(surface_point,{name="mcl_core:grass_path"}) + end -- don't set y coordinate, surface might be too low or high starting_point.x = surface_point.x starting_point.z = surface_point.z diff --git a/mods/MAPGEN/mcl_villages/utils.lua b/mods/MAPGEN/mcl_villages/utils.lua index 0e892bfecb..c55a55adb1 100644 --- a/mods/MAPGEN/mcl_villages/utils.lua +++ b/mods/MAPGEN/mcl_villages/utils.lua @@ -9,7 +9,7 @@ local c_desert_sand = minetest.get_content_id("mcl_core:redsand" --local c_silver_sand = minetest.get_content_id("mcl_core:silver_sand") -- local c_air = minetest.get_content_id("air") -local c_snow = minetest.get_content_id("mcl_core:snowblock") +local c_snow = minetest.get_content_id("mcl_core:snow") local c_fern_1 = minetest.get_content_id("mcl_flowers:fern") local c_fern_2 = minetest.get_content_id("mcl_flowers:fern") local c_fern_3 = minetest.get_content_id("mcl_flowers:fern") @@ -55,7 +55,8 @@ function settlements.find_surface_lvm(pos, minp) --c_dirt_with_dry_grass, c_podzol, c_sand, - c_desert_sand + c_desert_sand, + c_snow } local cnt = 0 local itter -- count up or down diff --git a/settingtypes.txt b/settingtypes.txt index 5c9fc17784..d41ff369ce 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -130,6 +130,8 @@ mcl_superflat_classic (Classic superflat map generation) bool false # game by a lot. mcl_node_particles (Block particles detail level) enum none high,medium,low,none +# If enabled, this will substitute a few blocks in village schematics so they blend into normal, snowy, and sandy areas. Defaults to false. +basic_pseudobiome_villages (Enables very basic, and experimental "pseudobiome-based" villages) bool false # If enabled, will run an LBM to fix the top 1/2 of double plants in mcimported worlds; defaults to true. fix_doubleplants (Mcimport double plant fixes) bool true