using Theriapolis.Core.Data;
using Theriapolis.Core.Util;
namespace Theriapolis.Core.World.Generation;
///
/// Accumulating context passed through the world-generation pipeline.
/// Holds the WorldState under construction, per-subsystem RNG streams, and a logger.
///
public sealed class WorldGenContext
{
public WorldState World { get; }
/// Named RNG sub-streams, keyed by the subsystem constant name.
public Dictionary Rngs { get; } = new();
/// Directory that holds macro_template.json, biomes.json, etc.
public string DataDirectory { get; init; } = "";
/// Called after each stage completes: (stageName, progressFraction 0–1).
public Action? ProgressCallback { get; set; }
/// Simple diagnostic log sink.
public Action? 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);
}