Editor manifest for the ArchBeamPart type. It declares metadata used by the editor: kind, slot, hosts, label, glyph, subtool, draw order, layer stage, outlines (loops) and height resolution for beam parts.
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;
namespace Sunless.Architecture;
public sealed class ArchBeamManifest : ArchKindManifest<ArchBeamPart>
{
public override ArchKind Kind => ArchKind.Beam;
public override string Slot => "Beams";
public override IEnumerable<Type> Hosts => new[] { typeof( ArchRoom ) };
public override string Label => "Beams";
public override string Glyph => "view_stream";
// Timber hung under a plane is the same drag as a box standing on one, so it rides the boolean tool.
public override string Subtool => ArchSubtools.Bool;
public override int DirectRank => 9;
public override ArchLayerStage Stage( object payload ) => ArchLayerStage.Structure;
public override IReadOnlyList<List<Vector2>> Loops( object payload )
{
if ( payload is not ArchBeamPart beam )
{
return Array.Empty<List<Vector2>>();
}
var outline = beam.Outline();
return outline.Count >= 3 ? new List<List<Vector2>> { outline } : Array.Empty<List<Vector2>>();
}
public override float Height( object payload, float fallback )
{
return payload is ArchBeamPart beam ? beam.Soffit : fallback;
}
}