b451f83174
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using Theriapolis.Core.Data;
|
||
using Theriapolis.Core.Util;
|
||
|
||
namespace Theriapolis.Core.World.Generation;
|
||
|
||
/// <summary>
|
||
/// Accumulating context passed through the world-generation pipeline.
|
||
/// Holds the WorldState under construction, per-subsystem RNG streams, and a logger.
|
||
/// </summary>
|
||
public sealed class WorldGenContext
|
||
{
|
||
public WorldState World { get; }
|
||
|
||
/// <summary>Named RNG sub-streams, keyed by the subsystem constant name.</summary>
|
||
public Dictionary<string, SeededRng> Rngs { get; } = new();
|
||
|
||
/// <summary>Directory that holds macro_template.json, biomes.json, etc.</summary>
|
||
public string DataDirectory { get; init; } = "";
|
||
|
||
/// <summary>Called after each stage completes: (stageName, progressFraction 0–1).</summary>
|
||
public Action<string, float>? ProgressCallback { get; set; }
|
||
|
||
/// <summary>Simple diagnostic log sink.</summary>
|
||
public Action<string>? Log { get; set; }
|
||
|
||
public WorldGenContext(ulong seed, string dataDirectory)
|
||
{
|
||
World = new WorldState { WorldSeed = seed };
|
||
DataDirectory = dataDirectory;
|
||
}
|
||
|
||
public void ReportProgress(string stageName, float fraction)
|
||
=> ProgressCallback?.Invoke(stageName, Math.Clamp(fraction, 0f, 1f));
|
||
|
||
public void LogMessage(string msg)
|
||
=> Log?.Invoke(msg);
|
||
}
|