Editor/Cabinet/ArchCabinetMounts.cs
using System;
using System.Collections.Generic;
namespace Sunless.Architecture;
// Every place something can be snapped onto a carcass, written out for the same reason every other table in this
// library is. A mount is resolved off the module's own frame by ArchCabinetShape, so a procedural front and a
// prefab door land on the same plane and neither carries an offset of its own.
//
// One frame serves all of them: the origin is the piece's TOP at its -x -y corner, +x stands out of the wall the
// way every arch moulding section is authored, +y runs along the run and +z is up - and the piece fills +x by
// Space.x, +y by Space.y and -z by Space.z. So a front's -x edge is the carcass face and a counter's is the wall,
// and art modelled to that corner needs no offset of its own anywhere.
public static class ArchCabinetMounts {
public const string Front = "Front";
public const string FrontUpper = "Front Upper";
public const string Drawer = "Drawer";
public const string Worktop = "Worktop";
public const string Plinth = "Plinth";
// The WHOLE module, seat to head, for a type made of art rather than boxes. It exists only on a prefabbed type -
// a generated one has no single mount that means "all of this", and would offer a second place to hang a door.
public const string Carcass = "Carcass";
public const string CornerCarcass = "Corner Carcass";
// The crown band a run with no counter carries instead of one. It takes the top of the carcass rather than
// standing over it, exactly as a worktop does, so a wall unit crowned and one left plain reach the same head.
public const string Cornice = "Cornice";
// The angled face of the unit standing where two runs meet, banded exactly as a flat one is - the same drawer
// over it and the same split across it, or the corner reads as a different piece of joinery from the run butting
// onto it. Its frame is turned 45° off either run, so a prefab corner front hangs on it exactly as a flat one
// hangs on Front.
public const string CornerFront = "Corner Front";
public const string CornerFrontUpper = "Corner Front Upper";
public const string CornerDrawer = "Corner Drawer";
public const string Handle = "Handle";
public const string HandleUpper = "Handle Upper";
public const string CornerHandle = "Corner Handle";
public const string CornerHandleUpper = "Corner Handle Upper";
public static IReadOnlyList<string> All { get; } = new[]
{
Front, FrontUpper, Drawer, CornerFront, CornerFrontUpper, CornerDrawer, Worktop, Plinth, Cornice, Carcass,
CornerCarcass, Handle, HandleUpper, CornerHandle, CornerHandleUpper
};
// The flat mount a corner one follows when the run says nothing about the corner itself, so retyping a run
// dresses its corner unit with it.
public static string Flat( string corner ) {
if ( Same( corner, CornerFrontUpper ) ) {
return FrontUpper;
}
return Same( corner, CornerDrawer ) ? Drawer : Front;
}
public static bool Same( string one, string other ) => string.Equals( one, other, StringComparison.OrdinalIgnoreCase );
}