forked from VoxeLibre/VoxeLibre
finetuning
This commit is contained in:
parent
ba3d7f1af7
commit
8df579bc6c
|
@ -370,12 +370,13 @@ local function world_structure(vm, data, data2, emin, emax, area, minp, maxp, bl
|
|||
return lvm_used, lvm_used, deco, ores
|
||||
end
|
||||
|
||||
--[[ replaced with decoration hack to replace grass nodes
|
||||
-- largely replaced with decoration hack to replace grass nodes
|
||||
-- except for cavegen, which still only produces param2=0
|
||||
local function block_fixes_grass(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
|
||||
-- Set param2 (=color) of nodes which use the grass colour palette.
|
||||
return minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min and
|
||||
set_grass_palette(minp,maxp,data2,area,{"group:grass_palette"})
|
||||
end]]
|
||||
end
|
||||
|
||||
--[[ replaced with schematic specialization per biome
|
||||
local function block_fixes_foliage(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
|
||||
|
@ -419,7 +420,8 @@ mcl_mapgen_core.register_generator("world_structure", world_structure, nil, 1, t
|
|||
mcl_mapgen_core.register_generator("end_fixes", end_basic, nil, 9999, true)
|
||||
|
||||
if mg_name ~= "v6" and mg_name ~= "singlenode" then
|
||||
-- replaced with decoration hack: mcl_mapgen_core.register_generator("block_fixes_grass", block_fixes_grass, nil, 9999, true)
|
||||
-- cavegen will still produce param2=0 only
|
||||
mcl_mapgen_core.register_generator("block_fixes_grass", block_fixes_grass, nil, 9999, true)
|
||||
-- replaced with schema specialization: mcl_mapgen_core.register_generator("block_fixes_foliage", block_fixes_foliage, nil, 9999, true)
|
||||
mcl_mapgen_core.register_generator("block_fixes_water", block_fixes_water, nil, 9999, true)
|
||||
-- replaced with using param2=3 during generation mcl_mapgen_core.register_generator("block_fixes_seagrass", block_fixes_seagrass, nil, 9999, true)
|
||||
|
|
|
@ -80,7 +80,7 @@ local cold = {
|
|||
y_max = water_level - 6,
|
||||
y_offset = -1,
|
||||
flags = "place_center_x, place_center_z, force_placement",
|
||||
prepare = { foundation = -2, clear = false, surface = "water" },
|
||||
prepare = { foundation = -3, clear = false, surface = "water", mode = "min" },
|
||||
filenames = {
|
||||
modpath.."/schematics/mcl_structures_ocean_ruins_cold_1.mts",
|
||||
modpath.."/schematics/mcl_structures_ocean_ruins_cold_2.mts",
|
||||
|
|
|
@ -5,7 +5,7 @@ local modpath = minetest.get_modpath(modname)
|
|||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
|
||||
local function spawn_witch(p1,p2)
|
||||
local c = minetest.find_node_near(p1,15,{"mcl_cauldrons:cauldron"})
|
||||
local c = minetest.find_node_near(p1,15,{"group:cauldron"})
|
||||
if not c then return end
|
||||
local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x,c.y-1,p1.z),vector.new(p2.x,c.y-1,p2.z),{"mcl_core:sprucewood"})
|
||||
local witchobj = not peaceful and minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch")
|
||||
|
@ -48,10 +48,10 @@ vl_structures.register_structure("witch_hut",{
|
|||
num_spawn_by = 3,
|
||||
flags = "place_center_x, place_center_z, all_surfaces",
|
||||
chunk_probability = 8,
|
||||
prepare = { surface = "under_air", tolerance = 4, clear_bottom = 3, padding = 0, corners = 1, foundation = false },
|
||||
prepare = { surface = "under_air", tolerance = 3, clear_bottom = 3, padding = 0, corners = 1, foundation = false, mode = "max" },
|
||||
y_max = mcl_vars.mg_overworld_max,
|
||||
y_min = -5,
|
||||
y_offset = 0,
|
||||
y_offset = -1,
|
||||
biomes = { "Swampland", "Swampland_ocean", "Swampland_shore" },
|
||||
filenames = { modpath.."/schematics/mcl_structures_witch_hut.mts" },
|
||||
after_place = hut_placement_callback,
|
||||
|
|
|
@ -3,6 +3,9 @@ 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 prepare = { tolerance = 4, surface = "solid", mode = "median", depth = -5, corners = 2, padding = 2 }
|
||||
local buildsep = 2 -- minimum building separation
|
||||
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local function add_building(settlement, building, count_buildings)
|
||||
|
@ -23,13 +26,12 @@ local function layout_town(minp, maxp, pr, input_settlement)
|
|||
local center = vector.new(pr:next(minp.x + 24, maxp.x - 24), maxp.y, pr:next(minp.z + 24, maxp.z - 24))
|
||||
minetest.log("action", "[mcl_villages] sudo make me a village at: " .. minetest.pos_to_string(minp).." - "..minetest.pos_to_string(maxp))
|
||||
local possible_rotations = {"0", "90", "180", "270"}
|
||||
local center_surface
|
||||
local center_surface = center
|
||||
|
||||
local settlement = {}
|
||||
-- now some buildings around in a circle, radius = size of town center
|
||||
local x, y, z, r, lastr = center.x, center.y, center.z, 0, 99
|
||||
local mindist = 3
|
||||
if #input_settlement >= 12 then mindist = 2 end
|
||||
local mindist = #input_settlement >= 12 and buildsep or (buildsep + 1)
|
||||
-- draw j circles around center and increase radius by math.random(2,4)
|
||||
for j = 1,20 do
|
||||
local steps = math.min(math.floor(math.pi * 2 * r / 2), 30) -- try up to 30 angles
|
||||
|
@ -44,7 +46,7 @@ local function layout_town(minp, maxp, pr, input_settlement)
|
|||
-- more defensive and hence safer for the poor villagers, even though less random
|
||||
-- case distinction is simpler and faster than trigonometry here:
|
||||
local rotation = building.rotation_offset or 0
|
||||
if math.abs(cpos.z-center.z) > math.abs(cpos.x-center.x) then
|
||||
if math.abs(cpos.z-center_surface.z) > math.abs(cpos.x-center_surface.x) then
|
||||
rotation = rotation + (cpos.z <= center.z and 0 or 2) -- zero indexed for modulo below
|
||||
else
|
||||
rotation = rotation + (cpos.x <= center.x and 1 or 3) -- zero indexed for modulo below
|
||||
|
@ -57,10 +59,10 @@ local function layout_town(minp, maxp, pr, input_settlement)
|
|||
-- ensure we have 3 space for terraforming, and avoid problems with VoxelManip
|
||||
if tlpos.x - 3 >= minp.x and tlpos.x + size.x + 3 <= maxp.x
|
||||
and tlpos.z + 3 >= minp.z and tlpos.z + size.y + 3 <= maxp.z then
|
||||
local pos, surface_material = vl_terraforming.find_level(cpos, size, 6)
|
||||
local pos, surface_material = vl_terraforming.find_level(cpos, size, prepare.tolerance, prepare.surface, prepare.mode)
|
||||
if pos and pos.y + size.y > maxp.y then pos = nil end
|
||||
-- check distance to other buildings. Note that we still want to add baseplates etc.
|
||||
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, pos, 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 + max_height_difference + 1)
|
||||
|
@ -75,7 +77,7 @@ local function layout_town(minp, maxp, pr, input_settlement)
|
|||
building.rotation = rotation
|
||||
building.surface_mat = surface_material
|
||||
table.insert(settlement, building)
|
||||
-- minetest.log("verbose", "[mcl_villages] Planning "..schema["name"].." at "..minetest.pos_to_string(pos))
|
||||
-- minetest.log("verbose", "[mcl_villages] Planning "..building.name.." at "..minetest.pos_to_string(pos))
|
||||
lastr = r
|
||||
else
|
||||
minetest.log("verbose", "Too large height difference "..math.abs(pos.y - center_surface.y).." at distance "..r)
|
||||
|
@ -353,7 +355,9 @@ function mcl_villages.terraform(settlement, pr)
|
|||
building.platform_mat = platform_mat -- remember for use in schematic placement
|
||||
building.stone_mat = stone_mat
|
||||
pos = vector.offset(pos, -math.floor((size.x-1)/2), 0, -math.floor((size.z-1)/2))
|
||||
vl_terraforming.foundation(pos.x-2, pos.y, pos.z-2, size.x+4, -5, size.z+4, 2, surface_mat, platform_mat, stone_mat, dust_mat, pr)
|
||||
vl_terraforming.foundation(pos.x - prepare.padding, pos.y, pos.z - prepare.padding,
|
||||
size.x + prepare.padding * 2, prepare.depth, size.z + prepare.padding * 2,
|
||||
prepare.corners, surface_mat, platform_mat, stone_mat, dust_mat, pr)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
-- Sugar canes
|
||||
for _, biome in ipairs(vl_biomes.overworld_biomes) do
|
||||
local biomes = vl_biomes.overworld_biomes
|
||||
local bmap = {}
|
||||
for b = 1, #biomes do
|
||||
if minetest.registered_biomes[biomes[b]] then -- ignore missing biomes
|
||||
local param2 = minetest.registered_biomes[biomes[b]]._mcl_grass_palette_index or 0
|
||||
if not bmap[param2] then bmap[param2] = {} end
|
||||
table.insert(bmap[param2], biomes[b])
|
||||
else
|
||||
minetest.log("warning", "Biome not found: "..biomes[b])
|
||||
end
|
||||
end
|
||||
for param2, bs in pairs(bmap) do
|
||||
mcl_mapgen_core.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = {"mcl_core:dirt", "mcl_core:coarse_dirt", "group:grass_block_no_snow", "group:sand", "mcl_core:podzol", "mcl_core:reeds"},
|
||||
|
@ -19,8 +30,8 @@ for _, biome in ipairs(vl_biomes.overworld_biomes) do
|
|||
height_max = 3,
|
||||
spawn_by = {"mcl_core:water_source", "mclx_core:river_water_source", "group:frosted_ice"},
|
||||
num_spawn_by = 1,
|
||||
biomes = {biome},
|
||||
param2 = biome._mcl_foliage_palette_index
|
||||
biomes = bs,
|
||||
param2 = param2
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -30,10 +41,10 @@ mcl_mapgen_core.register_decoration({
|
|||
place_on = {"mcl_core:dirt", "mcl_core:coarse_dirt", "group:grass_block_no_snow", "group:sand", "mcl_core:podzol", "mcl_core:reeds"},
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = 0.0,
|
||||
offset = 0.1,
|
||||
scale = 0.5,
|
||||
spread = vector.new(200, 200, 200),
|
||||
seed = 2,
|
||||
spread = vector.new(100, 100, 100),
|
||||
seed = 3,
|
||||
octaves = 3,
|
||||
persist = 0.7,
|
||||
},
|
||||
|
@ -45,6 +56,6 @@ mcl_mapgen_core.register_decoration({
|
|||
height_max = 3,
|
||||
spawn_by = {"mcl_core:water_source", "group:frosted_ice"},
|
||||
num_spawn_by = 1,
|
||||
param2 = 5 -- Swampland foliage palette index
|
||||
param2 = 28 -- Swampland grass palette index
|
||||
})
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ register_grass_decoration(0.18, -0.03, grass_savanna)
|
|||
register_grass_decoration(0.05, -0.03, grass_sparse)
|
||||
register_grass_decoration(0.05, 0.05, grass_mpfm)
|
||||
register_grass_decoration(-0.03, 1, {"BambooJungle", "BambooJungleM", "BambooJungleEdge"})
|
||||
register_grass_decoration(0.18, 0.03, {"Swampland"})
|
||||
|
||||
-- Doubletall grass registration helper
|
||||
local function register_doubletall_grass(offset, scale, biomes)
|
||||
|
|
|
@ -65,14 +65,15 @@ local lily_schem = {
|
|||
|
||||
-- Spawn them in shallow water at ocean level in Swampland.
|
||||
-- Tweak lilydepth to change the maximum water depth
|
||||
local lilydepth = 2
|
||||
local lilydepth = 3
|
||||
|
||||
for d = 1, lilydepth do
|
||||
local height = d + 2
|
||||
local y = 1 - d
|
||||
table.insert(lily_schem, 1, {name = "air", prob = 0})
|
||||
table.insert(lily_schem, 1, {name = "ignore", prob = 0})
|
||||
|
||||
mcl_mapgen_core.register_decoration({
|
||||
name = "lily:"..tostring(d),
|
||||
deco_type = "schematic",
|
||||
schematic = {
|
||||
size = vector.new(1, height, 1),
|
||||
|
@ -81,7 +82,7 @@ for d = 1, lilydepth do
|
|||
place_on = "mcl_core:dirt",
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = 0,
|
||||
offset = 0.3 - 0.2 * d, -- more when shallow
|
||||
scale = 0.3,
|
||||
spread = vector.new(100, 100, 100),
|
||||
seed = 503,
|
||||
|
|
|
@ -5,7 +5,7 @@ local modpath = minetest.get_modpath(modname)
|
|||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
|
||||
local function spawn_witch(pos,def,pr,p1,p2)
|
||||
local c = minetest.find_node_near(p1,15,{"mcl_cauldrons:cauldron"})
|
||||
local c = minetest.find_node_near(p1,15,{"group:cauldron"})
|
||||
if not c then return end
|
||||
local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x,c.y-1,p1.z),vector.new(p2.x,c.y-1,p2.z),{"group:stone"})
|
||||
if #nn == 0 then return end
|
||||
|
|
|
@ -238,21 +238,23 @@ function vl_terraforming.find_level(cpos, size, tolerance, surface, mode)
|
|||
local pos_c = _find_ground(pos)
|
||||
if pos_c then table.insert(ys, pos_c.y) end
|
||||
table.sort(ys)
|
||||
if #ys < 5 then return nil, nil end -- not fully supported
|
||||
|
||||
tolerance = tolerance or 8
|
||||
-- well supported base, not too uneven?
|
||||
if #ys < 5 or min(ys[#ys-1]-ys[1], ys[#ys]-ys[2]) > tolerance then
|
||||
-- minetest.log("action", "[vl_terraforming] ground too uneven: "..#ys.." positions: "..({dump(ys):gsub("[\n\t ]+", " ")})[1]
|
||||
-- .." tolerance "..tostring(#ys > 2 and min(ys[#ys-1]-ys[1], ys[#ys]-ys[2])).." > "..tolerance)
|
||||
return nil, nil
|
||||
tolerance = tolerance or 6 -- default value
|
||||
if mode == "min" then -- ignore the largest when using min
|
||||
if ys[#ys-1]-ys[1] > tolerance then return nil, nil end
|
||||
cpos.y = ys[1]
|
||||
elseif mode == "max" then -- ignore the smallest when using max
|
||||
if ys[#ys]-ys[2] > tolerance then return nil, nil end
|
||||
cpos.y = ys[#ys]
|
||||
else -- median
|
||||
if min(ys[#ys-1]-ys[1], ys[#ys]-ys[2]) > tolerance then
|
||||
-- minetest.log("action", "[vl_terraforming] ground too uneven: "..#ys.." positions: "..({dump(ys):gsub("[\n\t ]+", " ")})[1]
|
||||
-- .." tolerance "..tostring(#ys > 2 and min(ys[#ys-1]-ys[1], ys[#ys]-ys[2])).." > "..tolerance)
|
||||
return nil, nil
|
||||
end
|
||||
cpos.y = floor(0.5 * (ys[floor(1 + (#ys - 1) * 0.5)] + ys[ceil(1 + (#ys - 1) * 0.5)])) -- rounded
|
||||
end
|
||||
if mode == "min" then
|
||||
pos.y = ys[1]
|
||||
elseif mode == "max" then
|
||||
pos.y = ys[#ys]
|
||||
else -- median except for largest
|
||||
pos.y = floor(0.5 * (ys[floor(1 + (#ys - 1) * 0.5)] + ys[ceil(1 + (#ys - 1) * 0.5)])) -- rounded
|
||||
end
|
||||
return pos, surface_material
|
||||
return cpos, surface_material
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue