Soil fertility scales calendar-driven plant growth

Bump the engine submodule to f39ee9e (half-texel UV inset that removes the
black tile seams seen while zooming). Add a Fertility multiplier to
TerrainDef (forest soil rich, sand/mountain poor); plants record their
cell's fertility as PlantGrowth.GrowthRate at spawn, and the growth system
multiplies the per-frame calendar day-delta by it — so growth stays tied to
the in-game calendar and runs faster on fertile soil.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Leonid Pershin
2026-06-12 13:45:00 +03:00
co-authored by Claude Opus 4.8
parent 9f67c478a2
commit 147ab203f1
6 changed files with 16 additions and 6 deletions
+4 -4
View File
@@ -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 }
]
}
+1 -1
Submodule engine updated: 4b91b60f38...f39ee9e787
+6
View File
@@ -33,6 +33,12 @@ public sealed class TerrainDef : Def
/// <summary>Растительность, рассыпаемая по клеткам этого террейна.</summary>
public List<ScatterEntry> Scatter { get; init; } = [];
/// <summary>
/// Плодородность почвы — множитель скорости роста растений на этом террейне (1 — норма,
/// больше — быстрее). Богатая лесная почва растит быстрее песка/камня.
/// </summary>
public float Fertility { get; init; } = 1f;
/// <summary>Цвет тонировки из <see cref="Rgb"/>.</summary>
public Color Tint => Rgb is [var r, var g, var b, ..] ? new(r, g, b) : Color.Magenta;
}
+1
View File
@@ -56,6 +56,7 @@ internal static class ScatterSpawner
Species = index,
Stage = stage,
AgeDays = age,
GrowthRate = terrain.Fertility,
}
);
}
+3
View File
@@ -17,4 +17,7 @@ public struct PlantGrowth : IComponent
/// <summary>Накопленный возраст в игровых днях.</summary>
public float AgeDays;
/// <summary>Множитель скорости роста (плодородность клетки): 1 — норма, больше — быстрее.</summary>
public float GrowthRate;
}
+1 -1
View File
@@ -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