Editor helper for road parts in an architecture plan. It adds extension methods on ArchPlan to get a read-only list of ArchRoadPart objects from the plan's Units and to find a road by id.
using System.Collections.Generic;
using System.Linq;
namespace Sunless.Architecture;
// The plan reaches this module ships, so core declares no list of roads. Filed through Units, so this is a view and
// never something to add to - adding to it would go nowhere.
public static class ArchPlanRoads
{
public static IReadOnlyList<ArchRoadPart> Roads( this ArchPlan plan ) => plan.Units.OfType<ArchRoadPart>().ToList();
public static ArchRoadPart FindRoad( this ArchPlan plan, int id ) => plan.Roads().FirstOrDefault( road => road.Id == id );
}