Editor/Wall/ArchBalconyGen.cs
namespace Sunless.Architecture;

// Nothing here emits a solid of its own: the deck and its coping are the platform engine, the balustrade
// is the barrier engine, and a loggia's own floor is the storey slab the cut left standing.
public static class ArchBalconyGen {
	public static void Build( ArchMesh canvas, ArchBalconyPart balcony, ArchBuilding building, ArchPlan plan, ArchKit kit, ArchStyle style ) {
		var shape = ArchBalcony.Resolve( balcony, building, kit );
		var chain = new[] { balcony.Palette, building.Palette };

		if ( shape.Projects ) {
			using ( canvas.Part( ArchPieces.Balcony ) ) {
				ArchPlatformGen.Build( canvas, ArchBalcony.Slab( balcony, shape ), building, plan, kit, style );
			}
		}

		if ( !shape.Rail ) {
			return;
		}

		using ( canvas.Part( ArchPieces.Balustrade ) ) {
			ArchFixtureGuard.Build( canvas, shape.Edge(), kit, shape.RailHeight, BarrierGround.Level,
				ArchBarrierBrushes.Of( style, chain ), shape.GuardStyle );
		}
	}
}