Editor/Services/ArchBuildContext.cs
using System;
using Sandbox;

namespace Sunless.Architecture;

public sealed class ArchBuildContext {
	public ArchPlan Plan { get; }
	public ArchKit Kit { get; }
	public ArchStyle Style { get; }
	public ArchConnections Connections { get; }
	public ArchGround Ground { get; }

	public ArchBuildContext( ArchPlan plan, ArchKit kit, Scene scene ) {
		Plan = plan ?? throw new ArgumentNullException( nameof( plan ) );
		Kit = kit ?? throw new ArgumentNullException( nameof( kit ) );
		Style = new ArchStyle( kit );
		Connections = new ArchConnections( plan, kit );
		Ground = new ArchGround( scene );
	}

	public bool ConnectionsResolved { get; private set; }

	public ArchBuildContext ResolveConnections() {
		if ( ConnectionsResolved ) {
			return this;
		}

		Plan.Normalize();
		Connections.NormalizeBoundaries();
		Connections.ResolveRoads();
		ConnectionsResolved = true;

		return this;
	}
}