mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2025-01-21 08:11:26 +01:00
height difference for villages
This commit is contained in:
parent
f925f987ff
commit
a8f0b32031
@ -1,6 +1,7 @@
|
|||||||
local min_jobs = tonumber(minetest.settings:get("vl_villages_min_jobs")) or 2
|
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 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 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())
|
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
|
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
|
-- use town bell as new reference point for placement height
|
||||||
if #settlement == 0 then
|
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
|
end
|
||||||
-- limit height differences to town center, but gradually allow more
|
-- 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))
|
local minp = vector.offset(pos, -math.floor((size.x-1)/2), building.yadjust, -math.floor((size.z-1)/2))
|
||||||
building.minp = minp
|
building.minp = minp
|
||||||
building.maxp = vector.offset(minp, size.x, size.y, size.z)
|
building.maxp = vector.offset(minp, size.x, size.y, size.z)
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
-- maximum allowed difference in height for building a settlement
|
|
||||||
mcl_villages.max_height_difference = 56
|
|
||||||
|
|
||||||
-- legacy type in old schematics
|
-- legacy type in old schematics
|
||||||
minetest.register_alias("mcl_villages:stonebrickcarved", "mcl_core:stonebrickcarved")
|
minetest.register_alias("mcl_villages:stonebrickcarved", "mcl_core:stonebrickcarved")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user