@adatechnology/game-floorplan 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -65,7 +65,8 @@ declare function palette(o?: PaletteOptions): Palette;
65
65
  type Rect = [number, number, number, number];
66
66
  type Vec2 = [number, number];
67
67
  type Weights = Record<string, number>;
68
- type Json = any;
68
+ /** An open value from a template or a plugin: narrow it before use. */
69
+ type Json = unknown;
69
70
  type MeshFront = '+z' | '-z' | '+x' | '-x';
70
71
  type Mount = 'ceiling' | 'wall' | 'window' | 'support' | 'floor' | 'roof' | 'ground' | 'wall_top' | (string & {});
71
72
  /** How an item is coloured: a palette role, a fixed colour, or a seeded pick from a list. */
@@ -134,6 +135,10 @@ interface SlotDef {
134
135
  facing?: FacingRule;
135
136
  target?: string;
136
137
  slide?: number;
138
+ /** Parent slot id of an `on`/`inside` slot (copied from `on` when the room's slots are expanded). */
139
+ parent?: string;
140
+ /** The slot may sit over door and stair swing zones. */
141
+ floorFree?: boolean;
137
142
  [extra: string]: Json;
138
143
  }
139
144
  type SlotLibrary = SlotDef[] | ((room: {
@@ -273,7 +278,7 @@ interface TemplateDef {
273
278
  veranda?: boolean;
274
279
  steelDoor?: boolean;
275
280
  };
276
- facadeExtra?: (facade: Json, rng: Rng, w: number, d: number, o: FloorplanOptions) => void;
281
+ facadeExtra?: (facade: Facade, rng: Rng, w: number, d: number, o: FloorplanOptions) => void;
277
282
  building?: (w: number, d: number, o: FloorplanOptions) => Json;
278
283
  singleFloor?: boolean;
279
284
  /** Place tag of the building for finds (`house`, `pharmacy`...). */
@@ -297,14 +302,14 @@ interface TemplateDef {
297
302
  reservations?: (plan: Plan) => void;
298
303
  /** Own paths from the doors that sit away from the building edge (tents); replaces the generated ones. */
299
304
  paths?: (plan: Plan, context: {
300
- gates: Json[];
305
+ gates: PlanGate[];
301
306
  setback: number;
302
307
  marginLeft: number;
303
308
  marginRight: number;
304
309
  backyard: number;
305
310
  w: number;
306
311
  d: number;
307
- }) => Json[];
312
+ }) => LotPath[];
308
313
  /** Sides built against a neighbour (`left` / `right`): exempt from the side setback. */
309
314
  partyWalls?: ('left' | 'right')[];
310
315
  options?: Json;
@@ -350,13 +355,13 @@ interface CarClearance {
350
355
  interface ResultExtensionContext {
351
356
  plan: Plan;
352
357
  /** The result built so far: the plan, the items, the state items and the extensions that ran before. */
353
- result: Json;
358
+ result: FloorplanResult;
354
359
  seed: number | string;
355
360
  /** Seeded stream of the extension: `createRng(seed, seedKey ?? name)`. */
356
361
  rng: Rng;
357
362
  options: FloorplanOptions;
358
363
  }
359
- type ResultExtensionRun = (context: ResultExtensionContext) => Json;
364
+ type ResultExtensionRun = (context: ResultExtensionContext) => unknown;
360
365
  interface ResultExtensionOptions {
361
366
  /** Extensions that must run first. */
362
367
  after?: string[];
@@ -440,6 +445,156 @@ interface Room {
440
445
  seedKey?: string;
441
446
  ground?: string;
442
447
  }
448
+ /** Axis a wall or opening runs along: `u` is across the lot (x), `v` is front to back (z). */
449
+ type PlanAxis = 'u' | 'v';
450
+ /** A door placed on a wall of one storey (`Plan.doors`). */
451
+ interface PlanDoor {
452
+ id: string;
453
+ floor: number;
454
+ u: number;
455
+ v: number;
456
+ axis: PlanAxis;
457
+ /** Position of the wall line on the other axis. */
458
+ pos: number;
459
+ /** Centre of the door along the wall. */
460
+ at: number;
461
+ width: number;
462
+ /** Room on each side; `b` is `outside` on an exterior door. */
463
+ a: string;
464
+ b: string;
465
+ opensTo: string;
466
+ exterior: boolean;
467
+ side: string | null;
468
+ leaves: number;
469
+ model: string;
470
+ type: string;
471
+ steps: number;
472
+ hinge: string;
473
+ /** Swing areas on both sides that furniture keeps clear of. */
474
+ zones: Rect[];
475
+ /** Left open (set by a house state). */
476
+ open?: boolean;
477
+ /** Blocked shut, e.g. barricaded (set by a house state). */
478
+ blocked?: boolean;
479
+ }
480
+ /** One straight piece of wall or railing of one storey (`Plan.walls`). */
481
+ interface PlanWall {
482
+ floor: number;
483
+ axis: PlanAxis;
484
+ u0: number;
485
+ v0: number;
486
+ u1: number;
487
+ v1: number;
488
+ thickness: number;
489
+ /** Room ids on each face (`outside` for the street side). */
490
+ sides: [string, string];
491
+ exterior: boolean;
492
+ type: 'railing' | 'wall';
493
+ /** Height in metres (the storey ceiling for a full wall). */
494
+ h: number;
495
+ }
496
+ /** A window on an exterior wall (`Plan.windows`). */
497
+ interface PlanWindow {
498
+ id: string;
499
+ floor: number;
500
+ u: number;
501
+ v: number;
502
+ axis: PlanAxis;
503
+ pos: number;
504
+ at: number;
505
+ width: number;
506
+ /** Sill and head heights above the storey floor. */
507
+ y0: number;
508
+ y1: number;
509
+ room: string;
510
+ side: string;
511
+ /** Boarded up (set by a house state). */
512
+ boards?: boolean;
513
+ }
514
+ /** A gate in the lot boundary (`Plan.gates`). */
515
+ interface PlanGate {
516
+ id: string;
517
+ type: string;
518
+ model: string;
519
+ u: number;
520
+ v: number;
521
+ axis: PlanAxis;
522
+ width: number;
523
+ height: number;
524
+ side: string;
525
+ /** What the gate leads to (`door`, `inner_garage`...), or null. */
526
+ to: string | null;
527
+ material: string;
528
+ zones: Rect[];
529
+ /** Starts open (set by a template or a later pass). */
530
+ open?: boolean;
531
+ }
532
+ /** A door or a lot gate: anything a path or the furniture fill has to keep clear. */
533
+ type PlanOpening = PlanDoor | PlanGate;
534
+ /** A walkway or driveway across the lot (`Plan.paths`). */
535
+ interface LotPath {
536
+ id: string;
537
+ type: 'pedestrian' | 'vehicle' | string;
538
+ /** Gate the path starts at, or null when it starts at no gate. */
539
+ from: string | null;
540
+ to: string;
541
+ width: number;
542
+ rects: Rect[];
543
+ points: Vec2[];
544
+ }
545
+ /** How one side of the lot is closed (wall, fence or railing). */
546
+ interface LotBoundary {
547
+ type: string;
548
+ material: string;
549
+ height: number;
550
+ top: string;
551
+ totalHeight: number;
552
+ thickness: number;
553
+ }
554
+ /** One straight piece of the lot boundary. */
555
+ interface LotPerimeterPiece extends LotBoundary {
556
+ id: string;
557
+ side: string;
558
+ u0: number;
559
+ v0: number;
560
+ u1: number;
561
+ v1: number;
562
+ }
563
+ /** The lot around the building (`Plan.lot`). */
564
+ interface Lot {
565
+ rect: Rect;
566
+ setback: number;
567
+ sideYard: {
568
+ left: number;
569
+ right: number;
570
+ };
571
+ backyard: number;
572
+ style: string;
573
+ zones: Room[];
574
+ perimeter: LotPerimeterPiece[];
575
+ gates: PlanGate[];
576
+ paths: LotPath[];
577
+ pool: boolean;
578
+ }
579
+ /** The known fields of a facade. */
580
+ interface FacadeFields {
581
+ style: string;
582
+ color: {
583
+ name: string;
584
+ hex: string;
585
+ };
586
+ finish: string;
587
+ grilles: boolean;
588
+ roof: string;
589
+ balcony: boolean;
590
+ veranda: boolean;
591
+ steelDoor: boolean;
592
+ floors: number;
593
+ }
594
+ /** The look of the building from the street (`Plan.facade`); templates may add fields through `facadeExtra`. */
595
+ interface Facade extends FacadeFields {
596
+ [extra: string]: unknown;
597
+ }
443
598
  interface Plan {
444
599
  w: number;
445
600
  d: number;
@@ -455,13 +610,13 @@ interface Plan {
455
610
  }[];
456
611
  rooms: Room[];
457
612
  zones: Room[];
458
- doors: Json[];
459
- windows: Json[];
460
- walls: Json[];
461
- gates: Json[];
462
- paths: Json[];
463
- lot: Json;
464
- facade?: Json;
613
+ doors: PlanDoor[];
614
+ windows: PlanWindow[];
615
+ walls: PlanWall[];
616
+ gates: PlanGate[];
617
+ paths: LotPath[];
618
+ lot: Lot | null;
619
+ facade?: Facade;
465
620
  openPairs: Record<number, [string, string][]>;
466
621
  zoning?: ZoningReport;
467
622
  /** Lot areas the building keeps out of the fill (set by `TemplateDef.reservations`). */
@@ -475,7 +630,16 @@ interface Plan {
475
630
  playerRadius: number;
476
631
  carClearance: CarClearance;
477
632
  }
478
- interface Slot {
633
+ /** Where a resolved slot sits inside the room: its cell, facing, the room part and the walls it leans on. */
634
+ interface SlotCell {
635
+ rect: Rect;
636
+ f: Vec2;
637
+ enclosed: string[];
638
+ R: Rect;
639
+ size: Vec2;
640
+ }
641
+ /** The known fields of a resolved slot. */
642
+ interface SlotFields {
479
643
  id: string;
480
644
  room: string;
481
645
  floor: number;
@@ -483,11 +647,35 @@ interface Slot {
483
647
  anchor: string;
484
648
  side: string | null;
485
649
  cats: Weights;
650
+ slide?: number;
651
+ required: boolean;
652
+ chance: number;
653
+ clearance: number;
654
+ front: string;
655
+ group: string | null;
656
+ requires: string | null;
657
+ /** Parent slot of an `on`/`inside` slot. */
658
+ on: string | null;
659
+ target: string | null;
486
660
  valid: boolean;
487
661
  reason: string | null;
662
+ x: number;
663
+ z: number;
664
+ ry: number;
665
+ w: number;
666
+ d: number;
667
+ frontU: number;
668
+ frontV: number;
669
+ aabb: Rect;
670
+ /** Null on an invalid slot. */
671
+ _cell: SlotCell | null;
672
+ }
673
+ /** A slot of a room after it has been placed (`resolveSlot`); a library may carry fields of its own. */
674
+ interface Slot extends SlotFields {
488
675
  [extra: string]: Json;
489
676
  }
490
- interface PlacedItem {
677
+ /** The known fields of a placed item (`PlacedItem` without its open extras). */
678
+ interface PlacedItemFields {
491
679
  id: string;
492
680
  type: string;
493
681
  category: string;
@@ -503,8 +691,149 @@ interface PlacedItem {
503
691
  outdoor: boolean;
504
692
  aabb: Rect;
505
693
  color?: number | string;
694
+ /** Facing of the item's front. */
695
+ frontU?: number;
696
+ frontV?: number;
697
+ /** Slot that placed it, and the item it stands on or in. */
698
+ slot?: string;
699
+ on?: string | null;
700
+ mode?: 'on' | 'inside' | null;
701
+ clearance?: number;
702
+ flat?: boolean;
703
+ low?: boolean;
704
+ decor?: boolean;
705
+ overhead?: boolean;
706
+ /** Driver side of a car (unit vector). */
707
+ driver?: Vec2;
708
+ carClearance?: CarClearance;
709
+ /** Storeys a stair or passage room connects, or the id of the item this one serves (a gas cylinder names its stove). */
710
+ link?: {
711
+ from: number;
712
+ to: number;
713
+ } | string;
714
+ /** Unrounded footprint used by the fill, dropped from the result. */
715
+ _r?: Rect;
716
+ _seedId?: string;
717
+ /** Where a decor item hangs (`floor`, `wall`...). */
718
+ mount?: Mount;
719
+ /** Colour rule set by a plugin; replaced by `color` in the result. */
720
+ colorSpec?: ItemColor;
721
+ }
722
+ /** An item placed by the fill, a decor pass or a state plugin; plugins may add fields of their own. */
723
+ interface PlacedItem extends PlacedItemFields {
506
724
  [extra: string]: Json;
507
725
  }
726
+ /** A storey of the result. */
727
+ interface ResultFloor {
728
+ index: number;
729
+ label?: string;
730
+ name?: string;
731
+ number?: number;
732
+ y0: number;
733
+ ceiling: number;
734
+ }
735
+ /** A room of the result, with its first part spread as `u0..v1` and the colour roles of its wall and floor. */
736
+ interface ResultRoom {
737
+ id: string;
738
+ type: string;
739
+ label?: string;
740
+ name?: string;
741
+ floor: number;
742
+ u0: number;
743
+ v0: number;
744
+ u1: number;
745
+ v1: number;
746
+ parts: Rect[];
747
+ link: number[] | null;
748
+ ceiling: number;
749
+ color: {
750
+ wall: string;
751
+ floor: string;
752
+ };
753
+ }
754
+ /** A gate of the result lot. */
755
+ interface ResultGate extends Omit<PlanGate, 'zones' | 'open'> {
756
+ open: boolean;
757
+ color: string;
758
+ }
759
+ /** The lot of the result (null for apartments). */
760
+ interface ResultLot {
761
+ rect: Rect;
762
+ setback: number;
763
+ backyard: number;
764
+ sideYard: {
765
+ left: number;
766
+ right: number;
767
+ };
768
+ style: string;
769
+ pool: boolean;
770
+ zones: {
771
+ id: string;
772
+ type: string;
773
+ label?: string;
774
+ name?: string;
775
+ parts: Rect[];
776
+ ground?: string;
777
+ }[];
778
+ perimeter: (LotPerimeterPiece & {
779
+ color: string;
780
+ })[];
781
+ gates: ResultGate[];
782
+ paths: LotPath[];
783
+ }
784
+ /** The facade of the result: the plan facade with the palette colour and the colour roles. */
785
+ interface ResultFacade extends Omit<FacadeFields, 'color'> {
786
+ color: {
787
+ name?: string;
788
+ key: string;
789
+ hex: string;
790
+ };
791
+ roles: Record<string, string>;
792
+ [extra: string]: unknown;
793
+ }
794
+ /** An item of the result: the placed item without its internal fields, with its colour role or value. */
795
+ interface ResultItem extends Omit<PlacedItemFields, '_r' | '_seedId' | 'colorSpec'> {
796
+ [extra: string]: unknown;
797
+ }
798
+ /** The known fields of a `generate` result. */
799
+ interface FloorplanResultFields {
800
+ template: string;
801
+ name: string;
802
+ use: string;
803
+ seed: number | string;
804
+ style: string;
805
+ state: string;
806
+ locale?: string;
807
+ w: number;
808
+ d: number;
809
+ floors: ResultFloor[];
810
+ rooms: ResultRoom[];
811
+ walls: PlanWall[];
812
+ doors: PlanDoor[];
813
+ windows: PlanWindow[];
814
+ openPairs: [string, string][];
815
+ facade: ResultFacade;
816
+ lot: ResultLot | null;
817
+ items: ResultItem[];
818
+ stateItems: ResultItem[];
819
+ colors: Palette;
820
+ /** Output of `TemplateDef.building`. */
821
+ building: Json;
822
+ missing: {
823
+ room: string;
824
+ slot: string;
825
+ }[];
826
+ /** Storey of an apartment unit. */
827
+ floorNumber?: number;
828
+ partyWalls: string[];
829
+ /** Output of `TemplateDef.config`. */
830
+ config?: Json;
831
+ zoning?: ZoningReport;
832
+ }
833
+ /** What `generate` returns. Result extensions add their output under their own name. */
834
+ interface FloorplanResult extends FloorplanResultFields {
835
+ [extension: string]: unknown;
836
+ }
508
837
  interface ZoneDef {
509
838
  id: string;
510
839
  /** Generic use strings: `residential_single`, `residential_multi`, `commercial`, `mixed`, `industrial`... */
@@ -566,13 +895,39 @@ interface StatePlugin {
566
895
  /** Adjusts the palette roles (HSL) before the contrast rules run. */
567
896
  adjustPalette?(roles: Record<string, Hsl>): void;
568
897
  }
898
+ /** Walkability grid of a room (`createGrid`): cells of `gs` metres, the walkable ones and the entry cells. */
899
+ interface WalkGrid {
900
+ gs: number;
901
+ u0: number;
902
+ v0: number;
903
+ nx: number;
904
+ nz: number;
905
+ inside: Uint8Array;
906
+ entries: [number, number][];
907
+ center: [number, number];
908
+ }
909
+ /** Options of `PlacementContext.placeOnFloor`. */
910
+ interface PlaceOnFloorOptions {
911
+ /** Treat the item as flat (no clearance or walkability check). */
912
+ flat?: boolean;
913
+ /** Candidate rectangles to try instead of the corners and walls. */
914
+ cands?: Rect[];
915
+ /** Footprint to use instead of the catalogue size. */
916
+ dim?: readonly number[];
917
+ /** Try the candidates in order instead of shuffled. */
918
+ ordered?: boolean;
919
+ /** Rejects a candidate. */
920
+ without?: (rect: Rect) => boolean;
921
+ /** Walkability grid to check instead of the room's. */
922
+ railing?: WalkGrid;
923
+ }
569
924
  interface PlacementContext {
570
- make(room: Room, type: string, rect: Rect, front: Vec2, extra?: Json): PlacedItem;
925
+ make(room: Room, type: string, rect: Rect, front: Vec2, extra?: Partial<PlacedItem>): PlacedItem;
571
926
  add(item: PlacedItem): PlacedItem;
572
- placeOnFloor(room: Room, type: string, rng: Rng, opts?: Json): Rect | null;
927
+ placeOnFloor(room: Room, type: string, rng: Rng, opts?: PlaceOnFloorOptions): Rect | null;
573
928
  itemsOfRoom(room: Room): PlacedItem[];
574
929
  solidsOfRoom(room: Room): Rect[];
575
- gridOf(room: Room): Json;
930
+ gridOf(room: Room): WalkGrid;
576
931
  extraSolids: Record<string, Rect[]>;
577
932
  roomById(id: string): Room | undefined;
578
933
  setIgnored(ids: Set<string> | null): void;
@@ -592,11 +947,11 @@ interface PlacementKit {
592
947
  insideUnion(r: Rect, inners: Rect[]): boolean;
593
948
  usableParts(room: Room, extra?: number): Rect[];
594
949
  zonesOfFloor(plan: Plan, floor: number): Rect[];
595
- windowsOfRoom(plan: Plan, room: Room): Json[];
596
- windowZone(j: Json, outside?: boolean): Rect;
950
+ windowsOfRoom(plan: Plan, room: Room): PlanWindow[];
951
+ windowZone(j: Pick<PlanWindow, 'width' | 'side' | 'u' | 'v' | 'axis'>, outside?: boolean): Rect;
597
952
  roomAt(plan: Plan, u: number, v: number, floor: number): Room | null;
598
- reachable(grid: Json, solids: Rect[], inflation: number): boolean;
599
- createGrid(plan: Plan, room: Room, ignored?: Set<string> | null): Json;
953
+ reachable(grid: WalkGrid, solids: Rect[], inflation: number): boolean;
954
+ createGrid(plan: Plan, room: Room, ignored?: Set<string> | null): WalkGrid;
600
955
  clearRect(r: Rect, f: Vec2, clearance: number): Rect;
601
956
  pickWeighted(rng: Rng, w: Weights): string;
602
957
  createRng(seed: number | string, key: string): Rng;
@@ -605,7 +960,7 @@ interface PlacementKit {
605
960
  shuffle<T>(a: T[], rng: Rng): T[];
606
961
  facingRotation(f: Vec2, type: string): number;
607
962
  cutIntervals(intervals: [number, number][], a: number, b: number): [number, number][];
608
- blocksWindow(it: FurnitureDef, j: Json, overheadOff?: boolean): boolean;
963
+ blocksWindow(it: FurnitureDef, j: Pick<PlanWindow, 'y0'>, overheadOff?: boolean): boolean;
609
964
  }
610
965
  interface DecorPassContext {
611
966
  plan: Plan;
@@ -660,7 +1015,8 @@ interface FloorplanLocale {
660
1015
  interface ViewerLayerContext {
661
1016
  /** Canvas 2D context, already in CSS pixels. */
662
1017
  g: CanvasRenderingContext2D;
663
- plan: Json;
1018
+ /** The `generate` result being drawn. */
1019
+ plan: FloorplanResult;
664
1020
  /** Storey being drawn (0 when `all`). */
665
1021
  floor: number;
666
1022
  /** All storeys at once (the lot view). */
@@ -685,7 +1041,7 @@ interface ViewerLayer {
685
1041
  label: string;
686
1042
  defaultOn?: boolean;
687
1043
  draw(context: ViewerLayerContext): void;
688
- legend?(plan: Json): ViewerLayerLegendEntry[];
1044
+ legend?(plan: FloorplanResult): ViewerLayerLegendEntry[];
689
1045
  }
690
1046
 
691
1047
  /** What a container holds, from the first registered provider that answers (`null` passes to the next); none answering means nothing. */
@@ -693,12 +1049,17 @@ declare function findsFor(query: FindsQuery): readonly FindStack[];
693
1049
  /** Like `findsFor`, but `null` when no provider answered, so a pack can fall back to its own default. */
694
1050
  declare function findsAnswer(query: FindsQuery): readonly FindStack[] | null;
695
1051
 
1052
+ /** A recorded slot: the resolved slot without its internal fields, with the category names only. */
1053
+ interface RecordedSlot extends Omit<SlotFields, '_cell' | 'cats'> {
1054
+ cats: string[];
1055
+ [extra: string]: unknown;
1056
+ }
696
1057
  /** Recorded slots (resolved positions) of every storey and of the lot. */
697
- declare function slots(template: string | TemplateDef, options?: FloorplanOptions): Json[];
1058
+ declare function slots(template: string | TemplateDef, options?: FloorplanOptions): RecordedSlot[];
698
1059
  /** Generates a plan: building, lot, seeded item fill, decor, house state and palette. */
699
- declare function generate(template: string | TemplateDef, options?: FloorplanOptions): Json;
1060
+ declare function generate(template: string | TemplateDef, options?: FloorplanOptions): FloorplanResult;
700
1061
  /** Validates a result of `generate`; returns a list of messages (empty when valid). */
701
- declare function validate(result: Json, options?: {
1062
+ declare function validate(result: FloorplanResult, options?: {
702
1063
  locale?: string;
703
1064
  }): string[];
704
1065
  /** Size limits and default size of a template (they can depend on options such as `tier`). */
@@ -728,7 +1089,7 @@ declare function listTemplates(locale?: string): {
728
1089
  floors: number;
729
1090
  floorRange: [number, number] | null;
730
1091
  lot: boolean;
731
- options: any;
1092
+ options: {};
732
1093
  }[];
733
1094
 
734
1095
  declare const overlaps: (a: Rect, b: Rect, e?: number) => boolean;
@@ -742,11 +1103,11 @@ declare const listLocales: () => string[];
742
1103
  declare function translate(ns: Namespace, key: string, locale?: string, vars?: Record<string, string | number>): string;
743
1104
 
744
1105
  /** Keep-out zone of a window (inside, or outside for the lot). */
745
- declare function windowZone(j: Json, outside?: boolean): Rect;
1106
+ declare function windowZone(j: Pick<PlanWindow, 'width' | 'side' | 'u' | 'v' | 'axis'>, outside?: boolean): Rect;
746
1107
  /** `overheadOff`: the counter sits under the window without its wall cabinet. */
747
1108
  declare function blocksWindow(it: Pick<FurnitureDef, 'window' | 'overhead' | 'windowHeight'> & {
748
1109
  h: number;
749
- }, win: Json, overheadOff?: boolean): boolean;
1110
+ }, win: Pick<PlanWindow, 'y0'>, overheadOff?: boolean): boolean;
750
1111
 
751
1112
  /** All content registries of one engine instance. Content packs fill them through the `register*` functions. */
752
1113
  type Registries = {
@@ -816,6 +1177,36 @@ declare function registerFindsProvider(provider: FindsProvider): void;
816
1177
  /** Adds (or replaces, by id) a layer of the 2D viewer; drawn after the items, before the labels. */
817
1178
  declare function registerViewerLayer(layer: ViewerLayer): void;
818
1179
 
1180
+ /** What the zone checks read from a plan: a generated result or the internal plan. */
1181
+ interface ZoneCheckedPlan {
1182
+ floors: {
1183
+ y0: number;
1184
+ ceiling: number;
1185
+ }[];
1186
+ floorNumber?: number | null;
1187
+ rooms?: {
1188
+ floor: number;
1189
+ parts: readonly (readonly number[])[];
1190
+ }[];
1191
+ w: number;
1192
+ d: number;
1193
+ use?: string;
1194
+ partyWalls?: string[];
1195
+ }
1196
+ /** What the zone checks read from a lot (`result.lot`). */
1197
+ interface ZoneCheckedLot {
1198
+ rect: readonly number[];
1199
+ setback: number;
1200
+ sideYard: {
1201
+ left: number;
1202
+ right: number;
1203
+ };
1204
+ backyard: number;
1205
+ zones: {
1206
+ ground?: string;
1207
+ parts: readonly (readonly number[])[];
1208
+ }[];
1209
+ }
819
1210
  /** Registers an urban zone (zoning rules). Returns the stored definition. */
820
1211
  declare function defineZone(zone: ZoneDef): ZoneDef;
821
1212
  declare const getZone: (id: string) => ZoneDef | undefined;
@@ -826,7 +1217,7 @@ declare function registerPermeableGround(...types: string[]): void;
826
1217
  * Checks a generated lot against a zone and returns the violations (empty when compliant).
827
1218
  * `lot` is `result.lot` (may be null for apartments), `plan` is the result of `generate`.
828
1219
  */
829
- declare function checkLot(zoneIn: string | ZoneDef, lot: Json, plan: Json): ZoneViolation[];
1220
+ declare function checkLot(zoneIn: string | ZoneDef, lot: ZoneCheckedLot | null | undefined, plan: ZoneCheckedPlan): ZoneViolation[];
830
1221
 
831
1222
  declare const version = "0.1.0";
832
1223
  /** Registers `packs` and applies `patch` / `remove` over the catalogs, by id. Items are keyed by `type`, templates by `id`. */
@@ -1117,4 +1508,4 @@ declare function createDetachedHouse(p: DetachedHouseParams): Silhouette;
1117
1508
  */
1118
1509
  declare const engine: FloorplanEngine;
1119
1510
 
1120
- export { type Anchor, type BoundaryRule, type CarClearance, type ChaletParams, type CityBuildingParams, type ColonialParams, type CompanyHouseParams, type CreateFloorplanOptions, type DecorPass, type DecorPassContext, type DetachedHouseParams, type DoorDef, type FacingRule, type FarmhouseParams, type FindStack, type FindsProvider, type FindsQuery, type FloorDef, type FloorplanEngine, type FloorplanLocale, type FloorplanOptions, type FloorplanPack, type FurnitureDef, type GateCfg, type GroundOverlayRule, type Hsl, type ItemColor, type ItemInput, type Json, type LotConfig, type MeshFront, type Mount, type PaletteDraw, type PaletteEarly, type PaletteStyleDef, type PlacedItem, type PlacementContext, type PlacementKit, type Plan, type RandomSource, type Rect, type ResultExtensionContext, type ResultExtensionOptions, type ResultExtensionRun, type Room, type RoomColorDef, type RoomDef, type Side, type Silhouette, type SilhouettePart, type SilhouetteWindow, type SlabHouseParams, type Slot, type SlotDef, type SlotKit, type SlotLibrary, type StateContext, type StatePlugin, type StiltHouseParams, type StyleDef, type TemplateDef, type TwoStoreyParams, type Vec2, type ViewerLayer, type ViewerLayerContext, type ViewerLayerLegendEntry, type Weights, type WindowDef, type ZoneAdjustment, type ZoneDef, type ZoneViolation, type ZoningReport, blocksWindow, boxRadius, checkLot, createChalet, createCityBuilding, createColonialHouse, createCompanyHouse, createDetachedHouse, createFarmhouse, createFloorplan, createRng, createSilhouetteRandom, createSlabHouse, createStiltHouse, createTwoStoreyHouse, defaultFloorplan, defineZone, engine, findsAnswer, findsFor, generate, getZone, hashString, limitsOf, listLocales, listStates, listTemplates, listZones, mulberry32, openingZones, overlaps, palette, registerDecorProfile, registerFindsProvider, registerGroundOverlay, registerItem, registerItems, registerLibrary, registerLibraryAlias, registerLocale, registerPaletteStyle, registerPass, registerPermeableGround, registerResultExtension, registerRoomColors, registerSeedKeys, registerState, registerStyle, registerTemplate, registerViewerLayer, registerWallTop, setStateDistribution, slotKit, slots, translate, validate, version, windowZone };
1511
+ export { type Anchor, type BoundaryRule, type CarClearance, type ChaletParams, type CityBuildingParams, type ColonialParams, type CompanyHouseParams, type CreateFloorplanOptions, type DecorPass, type DecorPassContext, type DetachedHouseParams, type DoorDef, type Facade, type FacadeFields, type FacingRule, type FarmhouseParams, type FindStack, type FindsProvider, type FindsQuery, type FloorDef, type FloorplanEngine, type FloorplanLocale, type FloorplanOptions, type FloorplanPack, type FloorplanResult, type FloorplanResultFields, type FurnitureDef, type GateCfg, type GroundOverlayRule, type Hsl, type ItemColor, type ItemInput, type Json, type Lot, type LotBoundary, type LotConfig, type LotPath, type LotPerimeterPiece, type MeshFront, type Mount, type PaletteDraw, type PaletteEarly, type PaletteStyleDef, type PlaceOnFloorOptions, type PlacedItem, type PlacedItemFields, type PlacementContext, type PlacementKit, type Plan, type PlanAxis, type PlanDoor, type PlanGate, type PlanOpening, type PlanWall, type PlanWindow, type RandomSource, type RecordedSlot, type Rect, type ResultExtensionContext, type ResultExtensionOptions, type ResultExtensionRun, type ResultFacade, type ResultFloor, type ResultGate, type ResultItem, type ResultLot, type ResultRoom, type Room, type RoomColorDef, type RoomDef, type Side, type Silhouette, type SilhouettePart, type SilhouetteWindow, type SlabHouseParams, type Slot, type SlotCell, type SlotDef, type SlotFields, type SlotKit, type SlotLibrary, type StateContext, type StatePlugin, type StiltHouseParams, type StyleDef, type TemplateDef, type TwoStoreyParams, type Vec2, type ViewerLayer, type ViewerLayerContext, type ViewerLayerLegendEntry, type WalkGrid, type Weights, type WindowDef, type ZoneAdjustment, type ZoneCheckedLot, type ZoneCheckedPlan, type ZoneDef, type ZoneViolation, type ZoningReport, blocksWindow, boxRadius, checkLot, createChalet, createCityBuilding, createColonialHouse, createCompanyHouse, createDetachedHouse, createFarmhouse, createFloorplan, createRng, createSilhouetteRandom, createSlabHouse, createStiltHouse, createTwoStoreyHouse, defaultFloorplan, defineZone, engine, findsAnswer, findsFor, generate, getZone, hashString, limitsOf, listLocales, listStates, listTemplates, listZones, mulberry32, openingZones, overlaps, palette, registerDecorProfile, registerFindsProvider, registerGroundOverlay, registerItem, registerItems, registerLibrary, registerLibraryAlias, registerLocale, registerPaletteStyle, registerPass, registerPermeableGround, registerResultExtension, registerRoomColors, registerSeedKeys, registerState, registerStyle, registerTemplate, registerViewerLayer, registerWallTop, setStateDistribution, slotKit, slots, translate, validate, version, windowZone };