Editor/Wall/ArchFacade.cs
namespace Sunless.Architecture;
// A backdrop shell. ArchRoom.Facade is the flag and ArchWallSection.Lined is what the generators ask; this is
// the AUTHORING half - the one press that empties a storey, so the dock action and arch_convert_to_facade
// cannot strip different things.
//
// The flag alone stops anything from being BUILT inside the room. Emptying additionally throws away the
// authored interior FINISHES, because a shell kept as a vista is one nobody is going back inside: leaving the
// switches set would have the storey come back furnished the moment the flag was cleared by accident.
//
// The slab and the ceiling are structure, not finish, and they stay. A backdrop shell is read through its own
// windows, so a storey with its slab thrown away is a shopfront you can see six floors up through.
public static class ArchFacade {
public static int Empty( ArchRoom room ) {
if ( room is null ) {
return 0;
}
var stripped = 0;
stripped += Cleared( room.Facade, () => room.Facade = true );
stripped += Cleared( !room.FloorBoards, () => room.FloorBoards = false );
foreach ( var wall in room.Walls ) {
stripped += Cleared( !wall.Baseboard, () => wall.Baseboard = false );
stripped += Cleared( !wall.Wainscot, () => wall.Wainscot = false );
stripped += wall.Trims.RemoveAll( trim => trim.Interior );
}
return stripped;
}
static int Cleared( bool already, System.Action strip ) {
strip();
return already ? 0 : 1;
}
}