An editor manifest class for the 'Porch' architecture part. It declares metadata for the ArchPorchPart type such as kind, slot, hosts, label, glyph, children kinds, rank, layer stage, footprint loops, and height resolution.
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;
namespace Sunless.Architecture;
public sealed class ArchPorchManifest : ArchKindManifest<ArchPorchPart>
{
public override ArchKind Kind => ArchKind.Porch;
public override string Slot => "Porches";
public override IEnumerable<Type> Hosts => new[] { typeof( ArchRoom ) };
public override string Label => "Porch";
public override string Glyph => ArchIcons.Get( "subtool_porch", "deck" );
public override string Subtool => ArchSubtools.Porch;
public override string HostOutput => "Porch deck and open perimeter";
public override IEnumerable<ArchKind> Children => new[]
{
ArchKind.Stair, ArchKind.Pillar, ArchKind.Trim, ArchKind.Roof, ArchKind.Cut
};
public override int DirectRank => 12;
public override ArchLayerStage Stage( object payload ) => ArchLayerStage.Addition;
public override IReadOnlyList<List<Vector2>> Loops( object payload )
{
if ( payload is not ArchPorchPart porch )
{
return Array.Empty<List<Vector2>>();
}
var footprint = ArchPorch.Footprint( porch );
if ( footprint.Count < 3 )
{
return Array.Empty<List<Vector2>>();
}
return new List<List<Vector2>> { footprint };
}
public override float Height( object payload, float fallback )
{
return payload is ArchPorchPart porch ? porch.BaseHeight : fallback;
}
}