Editor manifest class for 'Trim' architecture parts. It specifies kind, UI slot, host types, label, icon glyph, subtool, layering stage, how to compute loops from a part path, and height extraction from the part payload.
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;
namespace Sunless.Architecture;
public sealed class ArchTrimManifest : ArchKindManifest<ArchTrimPart>
{
public override ArchKind Kind => ArchKind.Trim;
public override string Slot => "Trims";
public override IEnumerable<Type> Hosts => new[] { typeof( ArchRoom ), typeof( ArchPorchPart ) };
public override string Label => "Trim";
public override string Glyph => ArchIcons.Get( "subtool_trim", "border_style" );
public override string Subtool => ArchSubtools.Bool;
public override ArchLayerStage Stage( object payload ) => ArchLayerStage.Finish;
public override IReadOnlyList<List<Vector2>> Loops( object payload )
{
if ( payload is not ArchTrimPart trim )
{
return base.Loops( payload );
}
return new List<List<Vector2>> { trim.Path.Select( point => new Vector2( point.x, point.y ) ).ToList() };
}
public override float Height( object payload, float fallback )
{
return payload is ArchTrimPart trim && trim.Path.Count > 0 ? trim.Path[0].z : fallback;
}
}