feat: config-gated flat-scalar sea level (D-033, terrain-water task 04)
SeaLevelModel: "flat" (one scalar, SeaLevelValue) or "field" (the legacy latitude Lerp 0.26..0.15). Only GetSeaLevel's body changes — all nine call sites (crater carve target, both flood fills, biome split, beach band, Capitol window, town filters, A* zero-point) inherit the model automatically; no consumer re-tuning. Default: flat 0.15, pinned in ServerConfig.json. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
1f957b3430
commit
200adcaf5a
3 changed files with 31 additions and 2 deletions
|
|
@ -19,6 +19,13 @@ namespace IslaApocalypse.Core // Change this if your namespace is different
|
|||
// not a shippable world. Default false.
|
||||
public static bool SkipRoads = false;
|
||||
|
||||
// Sea-level model (D-033, terrain-water task 04): "flat" = one scalar sea
|
||||
// level everywhere (SeaLevelValue); "field" = the legacy latitude Lerp
|
||||
// (0.26 north .. 0.15 south). Generator-only — the runtime never computes
|
||||
// sea level. Default: flat 0.15.
|
||||
public static string SeaLevelModel = "flat";
|
||||
public static float SeaLevelValue = 0.15f;
|
||||
|
||||
public static void LoadConfig()
|
||||
{
|
||||
string path = "res://ServerConfig.json";
|
||||
|
|
@ -74,6 +81,20 @@ namespace IslaApocalypse.Core // Change this if your namespace is different
|
|||
SkipRoads = (bool)data["SkipRoads"];
|
||||
}
|
||||
|
||||
// Extract the sea-level model
|
||||
if (data.ContainsKey("SeaLevelModel"))
|
||||
{
|
||||
string model = (string)data["SeaLevelModel"];
|
||||
if (model == "flat" || model == "field")
|
||||
SeaLevelModel = model;
|
||||
else
|
||||
GD.PrintErr($"[ConfigManager] Unknown SeaLevelModel '{model}'. Keeping '{SeaLevelModel}'.");
|
||||
}
|
||||
if (data.ContainsKey("SeaLevelValue"))
|
||||
{
|
||||
SeaLevelValue = (float)data["SeaLevelValue"];
|
||||
}
|
||||
|
||||
switch (profile)
|
||||
{
|
||||
case "4K":
|
||||
|
|
|
|||
|
|
@ -2,5 +2,7 @@
|
|||
"WorldSeed": 1409879727,
|
||||
"MapProfile": "8K",
|
||||
"TownDensity": "Normal",
|
||||
"ChunkRadius": 32
|
||||
"ChunkRadius": 32,
|
||||
"SeaLevelModel": "flat",
|
||||
"SeaLevelValue": 0.15
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1212,7 +1212,13 @@ public partial class MapGenerator : TextureRect
|
|||
return astar.GetPointPath(from, to);
|
||||
}
|
||||
|
||||
private float GetSeaLevel(float t) => Mathf.Lerp(0.26f, 0.15f, Mathf.Clamp(t, 0f, 1f));
|
||||
// Sea-level model gate (D-033, task 04): "flat" returns the configured scalar;
|
||||
// "field" is the legacy latitude Lerp. Pure numeric mapping either way (D-035);
|
||||
// all nine call sites inherit whichever model config selects.
|
||||
private float GetSeaLevel(float t) =>
|
||||
ConfigManager.SeaLevelModel == "flat"
|
||||
? ConfigManager.SeaLevelValue
|
||||
: Mathf.Lerp(0.26f, 0.15f, Mathf.Clamp(t, 0f, 1f));
|
||||
|
||||
private Vector2I FindClosestPixel(Vector2 pos, HashSet<Vector2I> set) {
|
||||
Vector2I closest = new Vector2I(0,0); float min = float.MaxValue;
|
||||
|
|
|
|||
Loading…
Reference in a new issue