Editor/Floor/ArchApproachPart.cs

Editor class defining an approach part for architectural floor editing. It stores identity, placement (origin, yaw), geometry (width, nodes, run, splay), appearance (palette, kerbs, rails) and helper properties/methods for spline detection and constructing an ArchCurve.

File Access
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;

namespace Sunless.Architecture;

public enum ApproachKind
{
	Steps,
	Ramp
}

// What carries the climb inside a rising walkway link.
public enum WalkwayInterior
{
	None,
	Stairs,
	Ramp
}

// Both measured from grade to the same floor.
public sealed class ArchApproachPart : IArchPainted, IArchNamed
{
	public int Id { get; set; }
	public string Name { get; set; } = "Approach";
	public ApproachKind Kind { get; set; } = ApproachKind.Steps;
	// 0 finds the one it points at - name it only when two roads face the wall.
	public int RoadId { get; set; }
	// Wider at the kerb so a car can turn in off a moving lane.
	public float Splay { get; set; } = 36f;
	// 0 takes the kit's default.
	public int SplaySegments { get; set; }

	// On the wall face, running OUT from the building.
	public Vector2 Origin { get; set; }
	public float Yaw { get; set; }
	public float Width { get; set; } = 48f;
	public List<ArchCurveNode> Nodes { get; set; } = new();

	// Derived from rise and slope unless authored here.
	public float Run { get; set; }
	public bool Kerbs { get; set; } = true;
	public bool Rails { get; set; }
	public ArchPalette Palette { get; set; } = new();

	public bool IsSpline => Nodes.Count >= 2;

	public ArchCurve Curve() => ArchCurve.Of( Nodes );
}