Extension methods for ArchPlan that enumerate walls. AllWalls returns every ArchWall from the plan parts. WallsOn returns walls filed to rooms whose Floor equals the given level, using an optional ArchKinds table or loading defaults.
using System.Collections.Generic;
using System.Linq;
namespace Sunless.Architecture;
public static class ArchPlanWalls
{
// A wall is filed on a room OR on a deck, so anything that reaches for "every wall in the plan" has to ask here -
// walking the rooms alone is how a parapet stopped being reached by half the passes that reach a wall.
public static IEnumerable<ArchWall> AllWalls( this ArchPlan plan, ArchKinds table = null ) => plan.Parts<ArchWall>( table );
// The walls standing on this STOREY's own plane. A deck's walls are not among them - they stand a whole roof
// higher, and anything working the deck asks the deck for them.
public static IEnumerable<ArchWall> WallsOn( this ArchPlan plan, int level, ArchKinds table = null )
{
var kinds = table ?? ArchKinds.Load();
return plan.AllRooms().Where( room => room.Floor == level ).SelectMany( room => plan.Filed<ArchWall>( room, kinds ) );
}
}