Editor/Designers/ArchPillarStage.cs

Static helper that builds a staging scene for pillar assets used in the editor. It constructs an ArchPlan with a single building/room containing a tiled pillar column, computes staging bounds and returns an ArchStaged instance; also provides identity and description string helpers for pillars.

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

namespace Sunless.Architecture;

// One staging of a pillar type, shared by the designer's turntable and the browser's card art. A bay of
// them rather than a single column, so a span, an arcade ring and a capital all read.
public static class ArchPillarStage
{
	public const int ColumnsX = 3;
	public const int ColumnsY = 2;

	public static ArchStaged Of( ArchPillarPart authored, float height )
	{
		var column = authored.Section();

		column.Id = 2;
		column.Placement = PillarPlacement.Grid;
		column.CountX = ColumnsX;
		column.CountY = ColumnsY;

		var room = new ArchRoom
		{
			Id = 1,
			WallHeight = height,
			HasFloor = false,
			RaisedFoundation = false,
			Pillars = new List<ArchPillarPart> { column }
		};

		var building = new ArchBuilding
		{
			Id = 1,
			Rooms = new List<ArchRoom> { room },
			StoreyHeight = height
		};

		var reach = new Vector2( column.Spacing.x * (ColumnsX - 1), column.Spacing.y * (ColumnsY - 1) );

		return new ArchStaged(
			new ArchPlan { Units = new List<ArchUnit> { building } },
			new Vector3( reach.x * 0.5f, reach.y * 0.5f, height * 0.5f ),
			MathF.Max( 320f, MathF.Max( MathF.Max( reach.x, reach.y ), height ) * 1.9f ) );
	}

	public static string Identity( ArchPillarPart column, float height )
	{
		return ArchStageKey.Of( "pillar", $"{column.Type}.{height:0}", column );
	}

	public static string Describe( ArchPillarType type )
	{
		if ( !string.IsNullOrWhiteSpace( type.Description ) )
		{
			return type.Description;
		}

		var column = type.Column;

		return column is null ? "" : $"{column.Width:0}x{column.Depth:0} · {column.Span}";
	}
}