From 02f7ca2894a913529bda86ee8dddc62c2dbc61cc Mon Sep 17 00:00:00 2001 From: varttist Date: Fri, 2 Oct 2026 21:44:59 +0300 Subject: [PATCH] =?UTF-8?q?`MapGenerator`:=20add=20`peat=5Fbog`=20(=D0=91?= =?UTF-8?q?=D0=B0=D0=B3=D0=BD=D0=BE)=20biome.=20Add=20allwhere=20&=20maren?= =?UTF-8?q?tine=20tree-schemes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mods/ENVIRONMENT/mapGenerator/mod.conf | 2 +- .../mapGenerator/schems/allwhere_tree_a.mts | Bin 0 -> 258 bytes .../mapGenerator/schems/marentine_tree_a.mts | Bin 0 -> 256 bytes .../mapGenerator/src/mapGenerator.lua | 211 ++++++++++++++++-- 4 files changed, 197 insertions(+), 16 deletions(-) create mode 100644 mods/ENVIRONMENT/mapGenerator/schems/allwhere_tree_a.mts create mode 100644 mods/ENVIRONMENT/mapGenerator/schems/marentine_tree_a.mts diff --git a/mods/ENVIRONMENT/mapGenerator/mod.conf b/mods/ENVIRONMENT/mapGenerator/mod.conf index b5fa4f1..e310e65 100644 --- a/mods/ENVIRONMENT/mapGenerator/mod.conf +++ b/mods/ENVIRONMENT/mapGenerator/mod.conf @@ -1,2 +1,2 @@ name = smc__core__map_generator -depends = smc__core__map_gen, smc__game__items__rocks, smc__game__items__liquids, smc__game__items__soils, smc__game__items__clays, smc__game__items__sands +depends = smc__core__map_gen, smc__game__items__rocks, smc__game__items__liquids, smc__game__items__soils, smc__game__items__clays, smc__game__items__sands, smc__game__items__plants diff --git a/mods/ENVIRONMENT/mapGenerator/schems/allwhere_tree_a.mts b/mods/ENVIRONMENT/mapGenerator/schems/allwhere_tree_a.mts new file mode 100644 index 0000000000000000000000000000000000000000..a012cf164c0cea820e6295a9a3c1ab1f9fc2cb3a GIT binary patch literal 258 zcmeYb3HD`RVPIw8VPLIC0u0Oy%!!#r48rC4`6*V3IXUGSsYR*rIjM1`RdV;Ob;Q{lzpi!u4iz}@qTt=O_X*#0Z{Mur$bPH)yXOVxyhr}8FZl+o z^vYw{f9vLnjLi!|9Maad?CSQ;d0Y9;I)CSEqg`{)#60>i^);W~!tn_4izTyz6}yvslsfX5 z|JJ1aXJ?sy@#kIfg+&e9XYQCZcj4!UQ-9ah^K;dn-+BLDzU}?LE4Lm(DnJBXV}tgscSd&#iTtuQ?g?cLma?$_* literal 0 HcmV?d00001 diff --git a/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua b/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua index ce9ac19..10dbf35 100644 --- a/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua +++ b/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua @@ -25,6 +25,11 @@ local MapGen = mapGenRequire('MapGen') }, }) +-- --- Layers --- +local LAYERS_NAMES = { + [1] = 'videre' +} + local function calcTemp(layer, value, height) return value end @@ -33,7 +38,7 @@ local function calcHumidity(layer, value, height) return value end -mapGenerator:registerLayer('videre', { +mapGenerator:registerLayer(LAYERS_NAMES[1], { minY = -256, maxY = 256, minTemp = -100, @@ -146,7 +151,7 @@ local coldOcean = { local tropicalSoutheast = { ['landscape'] = { - offset = 20, + offset = 2, scale = 5, spread = {x = 15, y = 15, z = 15}, seed = 11611411111210599971088311111711610410197115116, @@ -357,20 +362,196 @@ local icyNorthernMMountains = { local v = vector.new for _, c in ipairs({'landscape', 'temp', 'humidity'}) do - mapGenerator:registerLayerNoiseColor('videre', c, '#5792ce', warmOcean[c]) - mapGenerator:registerLayerNoiseColor('videre', c, '#4978c6', temperateOcean[c]) - mapGenerator:registerLayerNoiseColor('videre', c, '#4763b1', coldOcean[c]) - mapGenerator:registerLayerNoiseColor('videre', c, '#a0ab72', tropicalSoutheast[c]) - mapGenerator:registerLayerNoiseColor('videre', c, '#dcd492', steppeSouthwest[c]) - mapGenerator:registerLayerNoiseColor('videre', c, '#a3c27c', temperateCentralZone[c]) - mapGenerator:registerLayerNoiseColor('videre', c, '#999d8f', lowMountains[c]) - mapGenerator:registerLayerNoiseColor('videre', c, '#569574', subarcticNorth[c]) - mapGenerator:registerLayerNoiseColor('videre', c, '#76c2b6', arcticNorth[c]) - mapGenerator:registerLayerNoiseColor('videre', c, '#bac0ad', icyNorthernMMountains[c]) + mapGenerator:registerLayerNoiseColor(LAYERS_NAMES[1], c, '#5792ce', warmOcean[c]) + mapGenerator:registerLayerNoiseColor(LAYERS_NAMES[1], c, '#4978c6', temperateOcean[c]) + mapGenerator:registerLayerNoiseColor(LAYERS_NAMES[1], c, '#4763b1', coldOcean[c]) + mapGenerator:registerLayerNoiseColor(LAYERS_NAMES[1], c, '#a0ab72', tropicalSoutheast[c]) + mapGenerator:registerLayerNoiseColor(LAYERS_NAMES[1], c, '#dcd492', steppeSouthwest[c]) + mapGenerator:registerLayerNoiseColor(LAYERS_NAMES[1], c, '#a3c27c', temperateCentralZone[c]) + mapGenerator:registerLayerNoiseColor(LAYERS_NAMES[1], c, '#999d8f', lowMountains[c]) + mapGenerator:registerLayerNoiseColor(LAYERS_NAMES[1], c, '#569574', subarcticNorth[c]) + mapGenerator:registerLayerNoiseColor(LAYERS_NAMES[1], c, '#76c2b6', arcticNorth[c]) + mapGenerator:registerLayerNoiseColor(LAYERS_NAMES[1], c, '#bac0ad', icyNorthernMMountains[c]) end --- --- Biomes --- +-- --- Videre biomes --- +-- Chalybeate bog (Оржавинь) +--[[ +mapGenerator:registerBiome(LAYERS_NAMES[1], 'chalybeate_bog', { + tempPoint = 30, + humidityPoint = 90, + minY = -10, + maxY = 15, + groundNodes = { + soil = 'soils:mud', + turf = 'soils:turf_bog', + rock = 'rocks:basalt', + bottom = 'soils:mud', + }, + soilHeight = 5 +})--]] +---@type NoiseParams +local peatBogTurfNoiseParams = { + offset = 0, + scale = 0.5, + spread = {x = 10, y = 10, z = 10}, + seed = 42, + octaves = 6, + persistence = 0.4, + lacunarity = 2, +} + +---@type ValueNoise? +local peatBogTurfNoise = nil + +local peatBogPlantsNoiseParams = { + offset = 0, + scale = 10, + spread = {x = 10, y = 10, z = 10}, + seed = 24, + octaves = 6, + persistence = 0.4, + lacunarity = 2, +} + +---@type ValueNoise? +local peatBogPlantsNoise = nil + +local placeParam2 = { + 2, + 3, + 4, + 34, + 35, + 36 +} + +local ID_BOG_GRASS_1 = id('plants:bog_grass_1') +local ID_BOG_GRASS_2 = id('plants:bog_grass_2') +local ID_BOG_GRASS_3 = id('plants:bog_grass_3') + +local ID_TURF_BOG = id('soils:turf_bog') +local ID_MUD = id('soils:mud') + +-- Peat bog (Багно) +mapGenerator:registerBiome(LAYERS_NAMES[1], 'peat_bog', { + tempPoint = 25, + humidityPoint = 95, + minY = -10, + maxY = 15, + groundNodes = { + soil = 'soils:mud', + turf = 'soils:mud', + rock = 'rocks:basalt', + bottom = 'soils:mud', + }, + soilHeight = 5, + + generateTurf = function (self, mapGenerator, factors, data, data2, index, x, y, z) + if peatBogTurfNoise == nil then + peatBogTurfNoise = core.get_value_noise(peatBogTurfNoiseParams) + end + + local value = peatBogTurfNoise:get_3d({x=x, y=y, z=z}) + if value >= 0 then + data[index] = ID_TURF_BOG + + local colorIndex = 0 + if value < 0.1 then + colorIndex = 3 + elseif value < 0.25 then + colorIndex = 2 + else + colorIndex = 1 + end + + data2[index] = mapGenerator:random(x, y, z, 0, 3) + (colorIndex << 2) + else + data[index] = ID_MUD + + local colorIndex = 0 + if value > -0.1 then + colorIndex = 3 + elseif value > -0.25 then + colorIndex = 2 + else + colorIndex = 1 + end + + data2[index] = mapGenerator:random(x, y, z, 0, 3) + (colorIndex << 2) + end + end, + + --[[ + generateSoil = function (self, mapGenerator, factors, data, data2, index, x, y, z) + -- TODO + end, + + generateBottom = function (self, mapGenerator, factors, data, data2, index, x, y, z) + -- TODO + end, + --]] + + dataPostProcessing = function (self, mapGenerator, factors, data, data2, index, x, y, z, nodeType, area) + if nodeType ~= 'TURF' then + return + end + + if peatBogPlantsNoise == nil then + peatBogPlantsNoise = core.get_value_noise(peatBogPlantsNoiseParams) + end + + local grassValue = peatBogPlantsNoise:get_3d({x=x, y=0, z=z}) + mapGenerator:random(x, y, z, 0, 2) + + local i = area:index(x,y+1,z) + + if grassValue > 8 then + data[i] = ID_BOG_GRASS_1 + data2[i] = 8 + placeParam2[mapGenerator:random(x, y, z, 1, #placeParam2)] + elseif grassValue > 5 then + data[i] = ID_BOG_GRASS_2 + data2[i] = 8 + placeParam2[mapGenerator:random(x, y, z, 1, #placeParam2)] + elseif grassValue > 3 then + data[i] = ID_BOG_GRASS_3 + data2[i] = 8 + placeParam2[mapGenerator:random(x, y, z, 1, #placeParam2)] + end + end, + + vmPostProcessing = function(self, mapGenerator, factors, voxelManip, x, y, z, nodeType, area) + if nodeType ~= 'TURF' then + return + end + + if peatBogPlantsNoise == nil then + peatBogPlantsNoise = core.get_value_noise(peatBogPlantsNoiseParams) + end + + local grassValue = peatBogPlantsNoise:get_3d({x=x, y=0, z=z}) + mapGenerator:random(x, y, z, 0, 2) + if grassValue <= 3 then + return + end + + local treeValue = mapGenerator:random(x, y, z, 1, 1000) + if treeValue >= 990 then + local pos = v(x, y-mapGenerator:random(x, y-1, z, 0, 1), z) --[[@as MapVector]] + mapGenerator:getTree('allwhere_tree_a'):placeOnVM(voxelManip, pos) + elseif treeValue >= 950 then + local pos = v(x, y-mapGenerator:random(x, y-1, z, 0, 2), z) --[[@as MapVector]] + mapGenerator:getTree('marentine_tree_a'):placeOnVM(voxelManip, pos) + end + end +}) + +mapGenerator:registerTree('allwhere_tree_a', { + path = core.get_modpath(core.get_current_modname())..'/schems/allwhere_tree_a.mts', +}) + +mapGenerator:registerTree('marentine_tree_a', { + path = core.get_modpath(core.get_current_modname())..'/schems/marentine_tree_a.mts', +}) + +-- Debug: ---@type ValueNoise local rocksNoise @@ -435,10 +616,10 @@ mapGenerator:registerBiome('videre', 'green_meadow', { minY = -50, maxY = 100, groundNodes = { - soil = 'soils:humus', + soil = 'soils:chernozem', turf = 'soils:turf_meadow', rock = 'rocks:basalt', - bottom = 'soils:humus', + bottom = 'soils:chernozem', }, soilHeight = 5, dataPostProcessing = meadowPostProcessing,