feat: add facing orientation to parts

Replace the face/back boolean with a three-state facing (face, back,
standing) seeded from setup placements. Parts now orient about the
anchor at the resting face/edge, so back-down parts sit on the table
instead of below it and standing parts rest on their bottom edge.
This commit is contained in:
2026-08-10 11:47:58 +08:00
parent aa23e93b3f
commit d663f4afea
13 changed files with 126 additions and 36 deletions
+1
View File
@@ -65,6 +65,7 @@ const setupValue = z.union([z.string(), z.array(z.string())]);
const setupPlacement = z.object({
path: z.string(),
parts: setupValue,
facing: z.enum(['face', 'back', 'standing']).optional(),
});
const setupSchema = z.object({
+8
View File
@@ -157,6 +157,12 @@ export interface Surface {
export type SetupValue = string | string[];
/**
* How a part is oriented on the board. `face` lays it flat front-up, `back`
* flips it over front-down, and `standing` stands it on its bottom edge.
*/
export type Facing = 'face' | 'back' | 'standing';
/**
* One setup placement: move `parts` to `path`. Entries are applied in order,
* so a part listed in a later entry ends up on that entry's path.
@@ -166,6 +172,8 @@ export interface SetupPlacement {
path: string;
/** Parts to place: a part id, a bare type (expands to all of that type), or a list of either. */
parts: SetupValue;
/** Initial facing for the placed parts; defaults to `face`. */
facing?: Facing;
}
/** Seeds the state store: the enabled surfaces and an ordered list of placements. */