Editor class defining an ArchPillarType used by the editor. It stores metadata (name, title, description, icon), a Column part template, which UI groups it shows, and helper methods to check visibility and create a configured pillar part instance.
using System.Collections.Generic;
using Sandbox;
namespace Sunless.Architecture;
public enum ArchPillarGroup
{
Section,
Footing,
Ends,
Span
}
// A pillar with no position yet - no second list of fields to drift.
public sealed class ArchPillarType
{
public int Version { get; set; } = 1;
public string Name { get; set; } = "pillar";
public string Title { get; set; } = "Pillar";
public string Description { get; set; } = "";
public string Icon { get; set; } = "view_column";
public ArchPillarPart Column { get; set; } = new();
// Empty means every group, so a pre-existing type keeps its panel.
public List<ArchPillarGroup> Shows { get; set; } = new();
public bool Wants( ArchPillarGroup group ) => Shows.Count == 0 || Shows.Contains( group );
public ArchPillarPart Standing( Vector2 origin, float baseHeight, float height )
{
var part = Column.Section();
part.Type = Name;
part.Origin = origin;
part.BaseHeight = baseHeight;
part.Height = height;
return part;
}
}