diff --git a/Mods/Core/Defs/terrain.json b/Mods/Core/Defs/terrain.json index c3f539d..f2caabf 100644 --- a/Mods/Core/Defs/terrain.json +++ b/Mods/Core/Defs/terrain.json @@ -4,19 +4,19 @@ { "defName": "DeepWater", "label": "terrain.deepwater", "maxHeight": 0.30, "color": [23, 63, 95] }, { "defName": "Water", "label": "terrain.water", "maxHeight": 0.42, "color": [32, 99, 155] }, { "defName": "Sand", "label": "terrain.sand", "maxHeight": 0.48, "color": [237, 201, 120], - "isLand": true, "surface": "terrain/surfaces/sand" }, + "isLand": true, "surface": "terrain/surfaces/sand", "fertility": 0.4 }, { "defName": "Grass", "label": "terrain.grass", "maxHeight": 0.68, "color": [90, 160, 70], - "isLand": true, "surface": "terrain/surfaces/mossy", + "isLand": true, "surface": "terrain/surfaces/mossy", "fertility": 1.0, "scatter": [ { "chance": 0.35, "options": ["GrassA"] }, { "chance": 0.07, "options": ["BushA", "BushB", "BushC"] } ] }, { "defName": "Forest", "label": "terrain.forest", "maxHeight": 0.85, "color": [44, 110, 50], - "isLand": true, "surface": "terrain/surfaces/soil", + "isLand": true, "surface": "terrain/surfaces/soil", "fertility": 1.6, "scatter": [ { "chance": 0.35, "options": ["TreeOakA", "TreeOakB", "TreeBirchA", "TreeGrayPineA"] } ] }, { "defName": "Mountain", "label": "terrain.mountain", "maxHeight": 1.01, "color": [136, 132, 128], - "surface": "terrain/surfaces/roughhewnrock" } + "surface": "terrain/surfaces/roughhewnrock", "fertility": 0.2 } ] } diff --git a/engine b/engine index 4b91b60..f39ee9e 160000 --- a/engine +++ b/engine @@ -1 +1 @@ -Subproject commit 4b91b60f3887c56076122e85afbcbd5646866ccc +Subproject commit f39ee9e787b1e7a731ee3efdbfb812a12781bbd0 diff --git a/src/LittleSim/Content/GameDefs.cs b/src/LittleSim/Content/GameDefs.cs index 1bd2207..4407b37 100644 --- a/src/LittleSim/Content/GameDefs.cs +++ b/src/LittleSim/Content/GameDefs.cs @@ -33,6 +33,12 @@ public sealed class TerrainDef : Def /// Растительность, рассыпаемая по клеткам этого террейна. public List Scatter { get; init; } = []; + /// + /// Плодородность почвы — множитель скорости роста растений на этом террейне (1 — норма, + /// больше — быстрее). Богатая лесная почва растит быстрее песка/камня. + /// + public float Fertility { get; init; } = 1f; + /// Цвет тонировки из . public Color Tint => Rgb is [var r, var g, var b, ..] ? new(r, g, b) : Color.Magenta; } diff --git a/src/LittleSim/Scenes/ContentHelpers.cs b/src/LittleSim/Scenes/ContentHelpers.cs index c737641..77a4025 100644 --- a/src/LittleSim/Scenes/ContentHelpers.cs +++ b/src/LittleSim/Scenes/ContentHelpers.cs @@ -56,6 +56,7 @@ internal static class ScatterSpawner Species = index, Stage = stage, AgeDays = age, + GrowthRate = terrain.Fertility, } ); } diff --git a/src/LittleSim/Sim/PlantGrowth.cs b/src/LittleSim/Sim/PlantGrowth.cs index 2ed7d43..2ac67d9 100644 --- a/src/LittleSim/Sim/PlantGrowth.cs +++ b/src/LittleSim/Sim/PlantGrowth.cs @@ -17,4 +17,7 @@ public struct PlantGrowth : IComponent /// Накопленный возраст в игровых днях. public float AgeDays; + + /// Множитель скорости роста (плодородность клетки): 1 — норма, больше — быстрее. + public float GrowthRate; } diff --git a/src/LittleSim/Sim/PlantGrowthSystem.cs b/src/LittleSim/Sim/PlantGrowthSystem.cs index 7ef16bf..4bac078 100644 --- a/src/LittleSim/Sim/PlantGrowthSystem.cs +++ b/src/LittleSim/Sim/PlantGrowthSystem.cs @@ -37,7 +37,7 @@ public sealed class PlantGrowthSystem(PlantSet plants, Calendar calendar, int ce continue; // уже зрелое — рост окончен } - grow.AgeDays += deltaDays; + grow.AgeDays += deltaDays * grow.GrowthRate; // плодородность ускоряет/замедляет рост var changed = false; while ( grow.Stage < stages.Length - 1