refactor(backend): modularize scenario loader

This commit is contained in:
2026-03-19 17:42:53 -04:00
parent 8d2a810f6b
commit a281d37fb4
8 changed files with 915 additions and 810 deletions

View File

@@ -0,0 +1,27 @@
using SpaceGame.Api.Simulation.Model;
namespace SpaceGame.Api.Simulation;
public sealed class ScenarioLoader
{
private readonly WorldBuilder _worldBuilder;
public ScenarioLoader(string contentRootPath, WorldGenerationOptions? worldGeneration = null)
{
var generationOptions = worldGeneration ?? new WorldGenerationOptions();
var dataRoot = Path.GetFullPath(Path.Combine(contentRootPath, "..", "..", "shared", "data"));
var dataLoader = new DataCatalogLoader(dataRoot);
var generationService = new SystemGenerationService();
var spatialBuilder = new SpatialBuilder();
var seedingService = new WorldSeedingService();
_worldBuilder = new WorldBuilder(
generationOptions,
dataLoader,
generationService,
spatialBuilder,
seedingService);
}
public SimulationWorld Load() => _worldBuilder.Build();
}