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:
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
import { useMemo } from 'react';
|
||||
import { create } from 'zustand';
|
||||
import type { Candidate, Package, Route, Surface } from '@tts/bgm';
|
||||
import type { Candidate, Facing, Package, Route, Surface } from '@tts/bgm';
|
||||
|
||||
/** The placement state of a single part on the board. */
|
||||
export interface PartState {
|
||||
@@ -19,8 +19,8 @@ export interface PartState {
|
||||
path: string;
|
||||
/** The part's position in its path's stack. */
|
||||
index: number;
|
||||
/** Whether the part's face is up (`true`) or down (`false`). */
|
||||
face: boolean;
|
||||
/** How the part is oriented on the board. */
|
||||
facing: Facing;
|
||||
}
|
||||
|
||||
/** Source-of-truth game state. */
|
||||
@@ -47,8 +47,8 @@ export interface Placement {
|
||||
index: number;
|
||||
/** The number of pieces on the path. */
|
||||
stackSize: number;
|
||||
/** Whether the piece's face is up. */
|
||||
face: boolean;
|
||||
/** How the piece is oriented on the board. */
|
||||
facing: Facing;
|
||||
}
|
||||
|
||||
interface TabletopState extends GameState {
|
||||
@@ -169,7 +169,7 @@ export function computeSurfacePlacements(surface: Surface, parts: Record<string,
|
||||
piece,
|
||||
index: ps.index,
|
||||
stackSize,
|
||||
face: ps.face,
|
||||
facing: ps.facing,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user