From 068469b1e933c57862d5937fd1635af009383cfa Mon Sep 17 00:00:00 2001 From: kno10 Date: Sun, 20 Oct 2024 21:42:57 +0200 Subject: [PATCH] height difference for villages --- mods/MAPGEN/mcl_villages/buildings.lua | 5 +++-- mods/MAPGEN/mcl_villages/const.lua | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/mods/MAPGEN/mcl_villages/buildings.lua b/mods/MAPGEN/mcl_villages/buildings.lua index db69a8196..a71a22a8a 100644 --- a/mods/MAPGEN/mcl_villages/buildings.lua +++ b/mods/MAPGEN/mcl_villages/buildings.lua @@ -1,6 +1,7 @@ local min_jobs = tonumber(minetest.settings:get("vl_villages_min_jobs")) or 2 local max_jobs = tonumber(minetest.settings:get("vl_villages_max_jobs")) or 14 local placement_priority = minetest.settings:get("vl_villages_placement_priority") or "houses" -- houses is safer for villagers at night +local max_height_difference = 40 -- at distance 40. In the center, half as much local S = minetest.get_translator(minetest.get_current_modname()) @@ -62,10 +63,10 @@ local function layout_town(vm, minp, maxp, pr, input_settlement) if pos and mcl_villages.surface_mat[surface_material.name] and mcl_villages.check_distance(settlement, cpos, size.x, size.z, mindist) then -- use town bell as new reference point for placement height if #settlement == 0 then - center_surface, y = cpos, math.min(maxp.y, pos.y + mcl_villages.max_height_difference * 0.5 + 1) + center_surface, y = cpos, math.min(maxp.y, pos.y + max_height_difference + 1) end -- limit height differences to town center, but gradually allow more - if math.abs(pos.y - center_surface.y) <= mcl_villages.max_height_difference * (0.25 + math.min(r/40,0.5)) then + if math.abs(pos.y - center_surface.y) <= max_height_difference * (0.5 + r/80) then local minp = vector.offset(pos, -math.floor((size.x-1)/2), building.yadjust, -math.floor((size.z-1)/2)) building.minp = minp building.maxp = vector.offset(minp, size.x, size.y, size.z) diff --git a/mods/MAPGEN/mcl_villages/const.lua b/mods/MAPGEN/mcl_villages/const.lua index 310582392..c0ad35e41 100644 --- a/mods/MAPGEN/mcl_villages/const.lua +++ b/mods/MAPGEN/mcl_villages/const.lua @@ -1,6 +1,3 @@ --- maximum allowed difference in height for building a settlement -mcl_villages.max_height_difference = 56 - -- legacy type in old schematics minetest.register_alias("mcl_villages:stonebrickcarved", "mcl_core:stonebrickcarved")