Defines editor-side types for tunnel templates. Contains an enum ArchTunnelGroup for grouping tunnel kinds and a class ArchTunnelType that stores metadata (name, title, description, icon), a default Bore part, a list of groups to show the type for, and helper methods Wants() and Driving() which copies the bore part and sets its Type.
using System.Collections.Generic;
namespace Sunless.Architecture;
// A panel offering every field for every type stops being readable.
public enum ArchTunnelGroup
{
Bore,
Walkway,
Portal,
Ground
}
// A tunnel with no station yet - no second list of fields to keep in step.
public sealed class ArchTunnelType
{
public int Version { get; set; } = 1;
public string Name { get; set; } = "tunnel";
public string Title { get; set; } = "Tunnel";
public string Description { get; set; } = "";
public string Icon { get; set; } = "vpn_lock";
public ArchTunnelPart Bore { get; set; } = new();
// Empty means every group, so a pre-existing type keeps its panel.
public List<ArchTunnelGroup> Shows { get; set; } = new();
public bool Wants( ArchTunnelGroup group ) => Shows.Count == 0 || Shows.Contains( group );
// Services are placed on a bore afterwards; they never come with a type.
public ArchTunnelPart Driving( float from, float to )
{
var part = Bore.Copy( from, to );
part.Type = Name;
return part;
}
}