@adatechnology/game-floorplan 0.2.2 → 0.3.0
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/README.md +6 -0
- package/dist/index.d.ts +234 -171
- package/dist/index.global.js +352 -196
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +258 -194
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -105,6 +105,12 @@ pnpm --filter @adatechnology/game-floorplan viewer:build # writes packages/gam
|
|
|
105
105
|
|
|
106
106
|
See [MIGRATION.md](MIGRATION.md) for the old-to-new name tables.
|
|
107
107
|
|
|
108
|
+
## By instance
|
|
109
|
+
|
|
110
|
+
`createFloorplan({ packs, patch, remove })` makes an engine of its own; nothing is shared with the global `engine`, which stays as a deprecated delegate of `defaultFloorplan()`.
|
|
111
|
+
`packs` is a list of content packs, applied in order: each is a function `(engine) => void` or an object with `register(engine)` (for example `(target) => register(target, { region: 'br' })` of `game-floorplan-residential`).
|
|
112
|
+
`patch` merges fields by id (items by `type`, templates by `id`) and `remove` lists ids to take out; an id that does not exist is ignored and warned about once in development.
|
|
113
|
+
|
|
108
114
|
## Português
|
|
109
115
|
|
|
110
116
|
Gerador procedural de plantas de casas e lotes, com semente: casca da casa, lote, slots de móveis, preenchimento por semente, paleta de cores harmônica, estados da casa (plugins) e zoneamento urbano.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { DeepPartial } from '@adatechnology/game-contracts';
|
|
2
|
+
|
|
1
3
|
/** Seeded random helpers. Same seed and key always produce the same stream. */
|
|
2
4
|
type Rng = () => number;
|
|
3
5
|
declare function mulberry32(a: number): Rng;
|
|
@@ -5,6 +7,60 @@ declare function hashString(input: string | number): number;
|
|
|
5
7
|
/** Independent stream for a `(seed, key)` pair. */
|
|
6
8
|
declare const createRng: (seed: string | number, key: string) => Rng;
|
|
7
9
|
|
|
10
|
+
/** Tools handed to a style recipe. `jit` and `rng` draw from the style's seeded stream: draw order is part of the contract. */
|
|
11
|
+
interface PaletteDraw {
|
|
12
|
+
rng: Rng;
|
|
13
|
+
base: [string, number, number, number];
|
|
14
|
+
H0: number;
|
|
15
|
+
H1: number;
|
|
16
|
+
H2: number;
|
|
17
|
+
jit(v: number, a: number): number;
|
|
18
|
+
hsl(h: number, s: number, l: number): Hsl;
|
|
19
|
+
}
|
|
20
|
+
interface PaletteEarly {
|
|
21
|
+
/** Accent mode: true saturates walls, false puts accents on objects. */
|
|
22
|
+
wallMode: boolean;
|
|
23
|
+
/** Maximum wall saturation. */
|
|
24
|
+
sMax: number;
|
|
25
|
+
/** Facade, wall, gate, roof, ceiling... in insertion order. */
|
|
26
|
+
roles: Record<string, Hsl>;
|
|
27
|
+
/** General floor `[h, s, l]` for room types that do not define their own. */
|
|
28
|
+
generalFloor: [number, number, number];
|
|
29
|
+
}
|
|
30
|
+
interface PaletteStyleDef {
|
|
31
|
+
/** Legacy stream suffix; defaults to the style id. */
|
|
32
|
+
seedKey?: string;
|
|
33
|
+
/** Facade colour table `[labelKey, h, s, l]`. */
|
|
34
|
+
facadeColors: [string, number, number, number][];
|
|
35
|
+
/** Draws up to the room colours (before the room loop). */
|
|
36
|
+
early(d: PaletteDraw): PaletteEarly;
|
|
37
|
+
/** Draws the object roles (wood, fabrics, metal, ground colours) after the room loop. */
|
|
38
|
+
late(d: PaletteDraw, e: PaletteEarly): Record<string, Hsl>;
|
|
39
|
+
}
|
|
40
|
+
interface PaletteContext extends PaletteDraw {
|
|
41
|
+
style: string;
|
|
42
|
+
sMax: number;
|
|
43
|
+
wallMode: boolean;
|
|
44
|
+
generalFloor: [number, number, number];
|
|
45
|
+
}
|
|
46
|
+
interface PaletteOptions {
|
|
47
|
+
seed?: number | string;
|
|
48
|
+
style?: string;
|
|
49
|
+
state?: string;
|
|
50
|
+
}
|
|
51
|
+
type Palette = {
|
|
52
|
+
meta: {
|
|
53
|
+
seed: number | string;
|
|
54
|
+
style: string;
|
|
55
|
+
state: string;
|
|
56
|
+
scheme: string;
|
|
57
|
+
base: string;
|
|
58
|
+
accentMode: 'wall' | 'object';
|
|
59
|
+
};
|
|
60
|
+
} & Record<string, number | object>;
|
|
61
|
+
/** Seeded colour-harmony palette: a facade base colour, a harmony scheme, role colours and contrast rules. */
|
|
62
|
+
declare function palette(o?: PaletteOptions): Palette;
|
|
63
|
+
|
|
8
64
|
/** Axis-aligned rectangle `[u0, v0, u1, v1]`. `u` runs along the facade, `v` from the street to the back. */
|
|
9
65
|
type Rect = [number, number, number, number];
|
|
10
66
|
type Vec2 = [number, number];
|
|
@@ -632,94 +688,11 @@ interface ViewerLayer {
|
|
|
632
688
|
legend?(plan: Json): ViewerLayerLegendEntry[];
|
|
633
689
|
}
|
|
634
690
|
|
|
635
|
-
/** Tools handed to a style recipe. `jit` and `rng` draw from the style's seeded stream: draw order is part of the contract. */
|
|
636
|
-
interface PaletteDraw {
|
|
637
|
-
rng: Rng;
|
|
638
|
-
base: [string, number, number, number];
|
|
639
|
-
H0: number;
|
|
640
|
-
H1: number;
|
|
641
|
-
H2: number;
|
|
642
|
-
jit(v: number, a: number): number;
|
|
643
|
-
hsl(h: number, s: number, l: number): Hsl;
|
|
644
|
-
}
|
|
645
|
-
interface PaletteEarly {
|
|
646
|
-
/** Accent mode: true saturates walls, false puts accents on objects. */
|
|
647
|
-
wallMode: boolean;
|
|
648
|
-
/** Maximum wall saturation. */
|
|
649
|
-
sMax: number;
|
|
650
|
-
/** Facade, wall, gate, roof, ceiling... in insertion order. */
|
|
651
|
-
roles: Record<string, Hsl>;
|
|
652
|
-
/** General floor `[h, s, l]` for room types that do not define their own. */
|
|
653
|
-
generalFloor: [number, number, number];
|
|
654
|
-
}
|
|
655
|
-
interface PaletteStyleDef {
|
|
656
|
-
/** Legacy stream suffix; defaults to the style id. */
|
|
657
|
-
seedKey?: string;
|
|
658
|
-
/** Facade colour table `[labelKey, h, s, l]`. */
|
|
659
|
-
facadeColors: [string, number, number, number][];
|
|
660
|
-
/** Draws up to the room colours (before the room loop). */
|
|
661
|
-
early(d: PaletteDraw): PaletteEarly;
|
|
662
|
-
/** Draws the object roles (wood, fabrics, metal, ground colours) after the room loop. */
|
|
663
|
-
late(d: PaletteDraw, e: PaletteEarly): Record<string, Hsl>;
|
|
664
|
-
}
|
|
665
|
-
interface PaletteContext extends PaletteDraw {
|
|
666
|
-
style: string;
|
|
667
|
-
sMax: number;
|
|
668
|
-
wallMode: boolean;
|
|
669
|
-
generalFloor: [number, number, number];
|
|
670
|
-
}
|
|
671
|
-
interface PaletteOptions {
|
|
672
|
-
seed?: number | string;
|
|
673
|
-
style?: string;
|
|
674
|
-
state?: string;
|
|
675
|
-
}
|
|
676
|
-
type Palette = {
|
|
677
|
-
meta: {
|
|
678
|
-
seed: number | string;
|
|
679
|
-
style: string;
|
|
680
|
-
state: string;
|
|
681
|
-
scheme: string;
|
|
682
|
-
base: string;
|
|
683
|
-
accentMode: 'wall' | 'object';
|
|
684
|
-
};
|
|
685
|
-
} & Record<string, number | object>;
|
|
686
|
-
/** Seeded colour-harmony palette: a facade base colour, a harmony scheme, role colours and contrast rules. */
|
|
687
|
-
declare function palette(o?: PaletteOptions): Palette;
|
|
688
|
-
|
|
689
691
|
/** What a container holds, from the first registered provider that answers (`null` passes to the next); none answering means nothing. */
|
|
690
692
|
declare function findsFor(query: FindsQuery): readonly FindStack[];
|
|
691
693
|
/** Like `findsFor`, but `null` when no provider answered, so a pack can fall back to its own default. */
|
|
692
694
|
declare function findsAnswer(query: FindsQuery): readonly FindStack[] | null;
|
|
693
695
|
|
|
694
|
-
declare function registerItem(def: ItemInput): FurnitureDef;
|
|
695
|
-
declare function registerItems(list: ItemInput[]): void;
|
|
696
|
-
declare function registerLibrary(id: string, library: SlotLibrary): void;
|
|
697
|
-
declare function registerLibraryAlias(alias: string, id: string): void;
|
|
698
|
-
declare function registerTemplate<T extends TemplateDef>(t: T): T;
|
|
699
|
-
declare function registerStyle(style: StyleDef): void;
|
|
700
|
-
declare function registerPaletteStyle(id: string, def: PaletteStyleDef): void;
|
|
701
|
-
declare function registerRoomColors(list: RoomColorDef[]): void;
|
|
702
|
-
declare function registerDecorProfile(styleId: string, profile: Json): void;
|
|
703
|
-
declare function registerPass(name: string, run: DecorPass): void;
|
|
704
|
-
declare function registerGroundOverlay(rule: GroundOverlayRule): void;
|
|
705
|
-
declare function registerWallTop(id: string, height: number): void;
|
|
706
|
-
/** Legacy RNG stream names for rooms and items, so seeds recorded before the English ids still reproduce. */
|
|
707
|
-
declare function registerSeedKeys(keys: {
|
|
708
|
-
rooms?: Record<string, string>;
|
|
709
|
-
items?: Record<string, string>;
|
|
710
|
-
}): void;
|
|
711
|
-
/** Registers a house state. The engine only ships `normal`. */
|
|
712
|
-
declare function registerState(name: string, plugin: StatePlugin): void;
|
|
713
|
-
/** Default state draw when `options.state` is absent: `{ state: weight }` on its own seeded stream. */
|
|
714
|
-
declare function setStateDistribution(weights: Record<string, number> | null, seedKey?: string): void;
|
|
715
|
-
declare const listStates: () => string[];
|
|
716
|
-
/** Adds a named piece to every result, after the state and before the zoning report; its output lands in `result[name]`. */
|
|
717
|
-
declare function registerResultExtension(name: string, run: ResultExtensionRun, options?: ResultExtensionOptions): void;
|
|
718
|
-
/** Registers who answers what a container holds (the item packs, from phase 3 on). */
|
|
719
|
-
declare function registerFindsProvider(provider: FindsProvider): void;
|
|
720
|
-
/** Adds (or replaces, by id) a layer of the 2D viewer; drawn after the items, before the labels. */
|
|
721
|
-
declare function registerViewerLayer(layer: ViewerLayer): void;
|
|
722
|
-
|
|
723
696
|
/** Recorded slots (resolved positions) of every storey and of the lot. */
|
|
724
697
|
declare function slots(template: string | TemplateDef, options?: FloorplanOptions): Json[];
|
|
725
698
|
/** Generates a plan: building, lot, seeded item fill, decor, house state and palette. */
|
|
@@ -758,6 +731,9 @@ declare function listTemplates(locale?: string): {
|
|
|
758
731
|
options: any;
|
|
759
732
|
}[];
|
|
760
733
|
|
|
734
|
+
declare const overlaps: (a: Rect, b: Rect, e?: number) => boolean;
|
|
735
|
+
declare function openingZones(u: number, v: number, axis: 'u' | 'v', width: number, depth: number): Rect[];
|
|
736
|
+
|
|
761
737
|
type Namespace = keyof FloorplanLocale;
|
|
762
738
|
/** Registers (or extends) the strings of a language. Packs call this with their JSON files. */
|
|
763
739
|
declare function registerLocale(code: string, table: FloorplanLocale): void;
|
|
@@ -765,8 +741,80 @@ declare const listLocales: () => string[];
|
|
|
765
741
|
/** Looks a key up in a namespace. Falls back to English, then to the key itself. `{n}`-style variables are replaced. */
|
|
766
742
|
declare function translate(ns: Namespace, key: string, locale?: string, vars?: Record<string, string | number>): string;
|
|
767
743
|
|
|
768
|
-
/**
|
|
769
|
-
declare
|
|
744
|
+
/** Keep-out zone of a window (inside, or outside for the lot). */
|
|
745
|
+
declare function windowZone(j: Json, outside?: boolean): Rect;
|
|
746
|
+
/** `overheadOff`: the counter sits under the window without its wall cabinet. */
|
|
747
|
+
declare function blocksWindow(it: Pick<FurnitureDef, 'window' | 'overhead' | 'windowHeight'> & {
|
|
748
|
+
h: number;
|
|
749
|
+
}, win: Json, overheadOff?: boolean): boolean;
|
|
750
|
+
|
|
751
|
+
/** All content registries of one engine instance. Content packs fill them through the `register*` functions. */
|
|
752
|
+
type Registries = {
|
|
753
|
+
CATALOG: Record<string, FurnitureDef>;
|
|
754
|
+
LIBRARIES: Record<string, SlotLibrary>;
|
|
755
|
+
LIBRARY_ALIAS: Record<string, string>;
|
|
756
|
+
TEMPLATES: Record<string, TemplateDef>;
|
|
757
|
+
STYLES: Record<string, StyleDef>;
|
|
758
|
+
STYLE_ALIAS: Record<string, string>;
|
|
759
|
+
PALETTE_STYLES: Record<string, PaletteStyleDef>;
|
|
760
|
+
ROOM_COLORS: RoomColorDef[];
|
|
761
|
+
PASSES: {
|
|
762
|
+
name: string;
|
|
763
|
+
run: DecorPass;
|
|
764
|
+
}[];
|
|
765
|
+
DECOR_PROFILES: Record<string, Json>;
|
|
766
|
+
GROUND_OVERLAYS: GroundOverlayRule[];
|
|
767
|
+
STATE_PLUGINS: Record<string, StatePlugin>;
|
|
768
|
+
WALL_TOP_HEIGHTS: Record<string, number>;
|
|
769
|
+
SEED_KEYS: {
|
|
770
|
+
rooms: Record<string, string>;
|
|
771
|
+
items: Record<string, string>;
|
|
772
|
+
};
|
|
773
|
+
stateDistribution: {
|
|
774
|
+
weights: Record<string, number> | null;
|
|
775
|
+
seedKey: string;
|
|
776
|
+
};
|
|
777
|
+
RESULT_EXTENSIONS: ResultExtension[];
|
|
778
|
+
FINDS_PROVIDERS: FindsProvider[];
|
|
779
|
+
VIEWER_LAYERS: ViewerLayer[];
|
|
780
|
+
LOCALES: Record<string, FloorplanLocale>;
|
|
781
|
+
ZONES: Record<string, ZoneDef>;
|
|
782
|
+
PERMEABLE_GROUNDS: Set<string>;
|
|
783
|
+
};
|
|
784
|
+
declare function registerItem(def: ItemInput): FurnitureDef;
|
|
785
|
+
declare function registerItems(list: ItemInput[]): void;
|
|
786
|
+
declare function registerLibrary(id: string, library: SlotLibrary): void;
|
|
787
|
+
declare function registerLibraryAlias(alias: string, id: string): void;
|
|
788
|
+
declare function registerTemplate<T extends TemplateDef>(t: T): T;
|
|
789
|
+
declare function registerStyle(style: StyleDef): void;
|
|
790
|
+
declare function registerPaletteStyle(id: string, def: PaletteStyleDef): void;
|
|
791
|
+
declare function registerRoomColors(list: RoomColorDef[]): void;
|
|
792
|
+
declare function registerDecorProfile(styleId: string, profile: Json): void;
|
|
793
|
+
declare function registerPass(name: string, run: DecorPass): void;
|
|
794
|
+
declare function registerGroundOverlay(rule: GroundOverlayRule): void;
|
|
795
|
+
declare function registerWallTop(id: string, height: number): void;
|
|
796
|
+
/** Legacy RNG stream names for rooms and items, so seeds recorded before the English ids still reproduce. */
|
|
797
|
+
declare function registerSeedKeys(keys: {
|
|
798
|
+
rooms?: Record<string, string>;
|
|
799
|
+
items?: Record<string, string>;
|
|
800
|
+
}): void;
|
|
801
|
+
/** Registers a house state. The engine only ships `normal`. */
|
|
802
|
+
declare function registerState(name: string, plugin: StatePlugin): void;
|
|
803
|
+
/** Default state draw when `options.state` is absent: `{ state: weight }` on its own seeded stream. */
|
|
804
|
+
declare function setStateDistribution(weights: Record<string, number> | null, seedKey?: string): void;
|
|
805
|
+
declare const listStates: () => string[];
|
|
806
|
+
interface ResultExtension {
|
|
807
|
+
name: string;
|
|
808
|
+
run: ResultExtensionRun;
|
|
809
|
+
after: string[];
|
|
810
|
+
seedKey: string;
|
|
811
|
+
}
|
|
812
|
+
/** Adds a named piece to every result, after the state and before the zoning report; its output lands in `result[name]`. */
|
|
813
|
+
declare function registerResultExtension(name: string, run: ResultExtensionRun, options?: ResultExtensionOptions): void;
|
|
814
|
+
/** Registers who answers what a container holds (the item packs, from phase 3 on). */
|
|
815
|
+
declare function registerFindsProvider(provider: FindsProvider): void;
|
|
816
|
+
/** Adds (or replaces, by id) a layer of the 2D viewer; drawn after the items, before the labels. */
|
|
817
|
+
declare function registerViewerLayer(layer: ViewerLayer): void;
|
|
770
818
|
|
|
771
819
|
/** Registers an urban zone (zoning rules). Returns the stored definition. */
|
|
772
820
|
declare function defineZone(zone: ZoneDef): ZoneDef;
|
|
@@ -780,15 +828,104 @@ declare function registerPermeableGround(...types: string[]): void;
|
|
|
780
828
|
*/
|
|
781
829
|
declare function checkLot(zoneIn: string | ZoneDef, lot: Json, plan: Json): ZoneViolation[];
|
|
782
830
|
|
|
783
|
-
declare const
|
|
784
|
-
|
|
831
|
+
declare const version = "0.1.0";
|
|
832
|
+
/** Registers `packs` and applies `patch` / `remove` over the catalogs, by id. Items are keyed by `type`, templates by `id`. */
|
|
833
|
+
type CreateFloorplanOptions = {
|
|
834
|
+
/** Content packs, applied in order: a function `(engine) => void` or an object with `register(engine)`. */
|
|
835
|
+
readonly packs?: readonly FloorplanPack[];
|
|
836
|
+
readonly patch?: {
|
|
837
|
+
readonly items?: Readonly<Record<string, DeepPartial<FurnitureDef>>>;
|
|
838
|
+
readonly templates?: Readonly<Record<string, DeepPartial<TemplateDef>>>;
|
|
839
|
+
};
|
|
840
|
+
readonly remove?: {
|
|
841
|
+
readonly items?: readonly string[];
|
|
842
|
+
readonly templates?: readonly string[];
|
|
843
|
+
};
|
|
844
|
+
};
|
|
845
|
+
type FloorplanPack = ((engine: FloorplanEngine) => void) | {
|
|
846
|
+
readonly register: (engine: FloorplanEngine) => void;
|
|
847
|
+
};
|
|
848
|
+
declare function buildEngine(scope: Registries): {
|
|
849
|
+
version: string;
|
|
850
|
+
generate: typeof generate;
|
|
851
|
+
slots: typeof slots;
|
|
852
|
+
validate: typeof validate;
|
|
853
|
+
palette: typeof palette;
|
|
854
|
+
limitsOf: typeof limitsOf;
|
|
855
|
+
listTemplates: typeof listTemplates;
|
|
856
|
+
listStates: () => string[];
|
|
857
|
+
registerItem: typeof registerItem;
|
|
858
|
+
registerItems: typeof registerItems;
|
|
859
|
+
registerLibrary: typeof registerLibrary;
|
|
860
|
+
registerLibraryAlias: typeof registerLibraryAlias;
|
|
861
|
+
registerTemplate: typeof registerTemplate;
|
|
862
|
+
registerStyle: typeof registerStyle;
|
|
863
|
+
registerPaletteStyle: typeof registerPaletteStyle;
|
|
864
|
+
registerRoomColors: typeof registerRoomColors;
|
|
865
|
+
registerDecorProfile: typeof registerDecorProfile;
|
|
866
|
+
registerPass: typeof registerPass;
|
|
867
|
+
registerGroundOverlay: typeof registerGroundOverlay;
|
|
868
|
+
registerWallTop: typeof registerWallTop;
|
|
869
|
+
registerSeedKeys: typeof registerSeedKeys;
|
|
870
|
+
registerState: typeof registerState;
|
|
871
|
+
setStateDistribution: typeof setStateDistribution;
|
|
872
|
+
registerLocale: typeof registerLocale;
|
|
873
|
+
registerResultExtension: typeof registerResultExtension;
|
|
874
|
+
registerFindsProvider: typeof registerFindsProvider;
|
|
875
|
+
findsFor: typeof findsFor;
|
|
876
|
+
findsAnswer: typeof findsAnswer;
|
|
877
|
+
registerViewerLayer: typeof registerViewerLayer;
|
|
878
|
+
viewerLayers: ViewerLayer[];
|
|
879
|
+
blocksWindow: typeof blocksWindow;
|
|
880
|
+
defineZone: typeof defineZone;
|
|
881
|
+
getZone: (id: string) => ZoneDef | undefined;
|
|
882
|
+
listZones: () => ZoneDef[];
|
|
883
|
+
checkLot: typeof checkLot;
|
|
884
|
+
registerPermeableGround: typeof registerPermeableGround;
|
|
885
|
+
slotKit: SlotKit;
|
|
886
|
+
translate: typeof translate;
|
|
887
|
+
listLocales: () => string[];
|
|
888
|
+
templates: Record<string, TemplateDef>;
|
|
889
|
+
catalog: Record<string, FurnitureDef>;
|
|
890
|
+
libraries: Record<string, SlotLibrary>;
|
|
891
|
+
styles: Record<string, StyleDef>;
|
|
892
|
+
paletteStyles: Record<string, PaletteStyleDef>;
|
|
893
|
+
createRng: (seed: string | number, key: string) => Rng;
|
|
894
|
+
mulberry32: typeof mulberry32;
|
|
895
|
+
hashString: typeof hashString;
|
|
896
|
+
overlaps: (a: Rect, b: Rect, e?: number) => boolean;
|
|
897
|
+
windowZone: typeof windowZone;
|
|
898
|
+
openingZones: typeof openingZones;
|
|
899
|
+
color: {
|
|
900
|
+
lstar: (n: number) => number;
|
|
901
|
+
hex: (n: number) => string;
|
|
902
|
+
hsl: (n: number) => Hsl;
|
|
903
|
+
HIGH_SATURATION: number;
|
|
904
|
+
MIN_WALL_FLOOR_CONTRAST: number;
|
|
905
|
+
MIN_FABRIC_FLOOR_CONTRAST: number;
|
|
906
|
+
};
|
|
907
|
+
constants: {
|
|
908
|
+
WALL_THICKNESS: number;
|
|
909
|
+
DOOR_CLEARANCE: number;
|
|
910
|
+
PLAYER_RADIUS: number;
|
|
911
|
+
DOOR_EDGE_CLEARANCE: number;
|
|
912
|
+
WINDOW_EDGE_CLEARANCE: number;
|
|
913
|
+
OVERHEAD_TOP: number;
|
|
914
|
+
CAR_CLEARANCE: {
|
|
915
|
+
readonly driver: 0.8;
|
|
916
|
+
readonly side: 0.6;
|
|
917
|
+
readonly end: 0.6;
|
|
918
|
+
};
|
|
919
|
+
};
|
|
920
|
+
};
|
|
921
|
+
type FloorplanEngine = ReturnType<typeof buildEngine>;
|
|
922
|
+
/** An engine of its own: registries, zones and locales are not shared with any other engine on the page. */
|
|
923
|
+
declare function createFloorplan(options?: CreateFloorplanOptions): FloorplanEngine;
|
|
924
|
+
/** The engine the global `engine` stands for, created on first use. Content packs of the old `register(engine)` calls fill this one. */
|
|
925
|
+
declare function defaultFloorplan(): FloorplanEngine;
|
|
785
926
|
|
|
786
|
-
/**
|
|
787
|
-
declare
|
|
788
|
-
/** `overheadOff`: the counter sits under the window without its wall cabinet. */
|
|
789
|
-
declare function blocksWindow(it: Pick<FurnitureDef, 'window' | 'overhead' | 'windowHeight'> & {
|
|
790
|
-
h: number;
|
|
791
|
-
}, win: Json, overheadOff?: boolean): boolean;
|
|
927
|
+
/** Builders for the slot definitions of a room library. */
|
|
928
|
+
declare const slotKit: SlotKit;
|
|
792
929
|
|
|
793
930
|
/** One primitive of a far-away silhouette. Parts are listed in creation order; `parent` is the index of a group part (`-1` is the root). */
|
|
794
931
|
type SilhouettePart = {
|
|
@@ -974,84 +1111,10 @@ type DetachedHouseParams = Seeded & {
|
|
|
974
1111
|
/** One-storey detached house; boarded windows get two crossed planks each. */
|
|
975
1112
|
declare function createDetachedHouse(p: DetachedHouseParams): Silhouette;
|
|
976
1113
|
|
|
977
|
-
declare const version = "0.1.0";
|
|
978
1114
|
/**
|
|
979
|
-
* The engine
|
|
980
|
-
*
|
|
1115
|
+
* The global engine. Content packs take it as an argument (`register(engine)`), so that several bundles (ESM or IIFE) fill the same registries.
|
|
1116
|
+
* @deprecated use `createFloorplan({ packs, patch, remove })`, an engine of its own, or `defaultFloorplan()` for the shared one.
|
|
981
1117
|
*/
|
|
982
|
-
declare const engine:
|
|
983
|
-
version: string;
|
|
984
|
-
generate: typeof generate;
|
|
985
|
-
slots: typeof slots;
|
|
986
|
-
validate: typeof validate;
|
|
987
|
-
palette: typeof palette;
|
|
988
|
-
limitsOf: typeof limitsOf;
|
|
989
|
-
listTemplates: typeof listTemplates;
|
|
990
|
-
listStates: () => string[];
|
|
991
|
-
registerItem: typeof registerItem;
|
|
992
|
-
registerItems: typeof registerItems;
|
|
993
|
-
registerLibrary: typeof registerLibrary;
|
|
994
|
-
registerLibraryAlias: typeof registerLibraryAlias;
|
|
995
|
-
registerTemplate: typeof registerTemplate;
|
|
996
|
-
registerStyle: typeof registerStyle;
|
|
997
|
-
registerPaletteStyle: typeof registerPaletteStyle;
|
|
998
|
-
registerRoomColors: typeof registerRoomColors;
|
|
999
|
-
registerDecorProfile: typeof registerDecorProfile;
|
|
1000
|
-
registerPass: typeof registerPass;
|
|
1001
|
-
registerGroundOverlay: typeof registerGroundOverlay;
|
|
1002
|
-
registerWallTop: typeof registerWallTop;
|
|
1003
|
-
registerSeedKeys: typeof registerSeedKeys;
|
|
1004
|
-
registerState: typeof registerState;
|
|
1005
|
-
setStateDistribution: typeof setStateDistribution;
|
|
1006
|
-
registerLocale: typeof registerLocale;
|
|
1007
|
-
registerResultExtension: typeof registerResultExtension;
|
|
1008
|
-
registerFindsProvider: typeof registerFindsProvider;
|
|
1009
|
-
findsFor: typeof findsFor;
|
|
1010
|
-
findsAnswer: typeof findsAnswer;
|
|
1011
|
-
registerViewerLayer: typeof registerViewerLayer;
|
|
1012
|
-
viewerLayers: ViewerLayer[];
|
|
1013
|
-
blocksWindow: typeof blocksWindow;
|
|
1014
|
-
defineZone: typeof defineZone;
|
|
1015
|
-
getZone: (id: string) => ZoneDef | undefined;
|
|
1016
|
-
listZones: () => ZoneDef[];
|
|
1017
|
-
checkLot: typeof checkLot;
|
|
1018
|
-
registerPermeableGround: typeof registerPermeableGround;
|
|
1019
|
-
slotKit: SlotKit;
|
|
1020
|
-
translate: typeof translate;
|
|
1021
|
-
listLocales: () => string[];
|
|
1022
|
-
templates: Record<string, TemplateDef>;
|
|
1023
|
-
catalog: Record<string, FurnitureDef>;
|
|
1024
|
-
libraries: Record<string, SlotLibrary>;
|
|
1025
|
-
styles: Record<string, StyleDef>;
|
|
1026
|
-
paletteStyles: Record<string, PaletteStyleDef>;
|
|
1027
|
-
createRng: (seed: string | number, key: string) => Rng;
|
|
1028
|
-
mulberry32: typeof mulberry32;
|
|
1029
|
-
hashString: typeof hashString;
|
|
1030
|
-
overlaps: (a: Rect, b: Rect, e?: number) => boolean;
|
|
1031
|
-
windowZone: typeof windowZone;
|
|
1032
|
-
openingZones: typeof openingZones;
|
|
1033
|
-
color: {
|
|
1034
|
-
lstar: (n: number) => number;
|
|
1035
|
-
hex: (n: number) => string;
|
|
1036
|
-
hsl: (n: number) => Hsl;
|
|
1037
|
-
HIGH_SATURATION: number;
|
|
1038
|
-
MIN_WALL_FLOOR_CONTRAST: number;
|
|
1039
|
-
MIN_FABRIC_FLOOR_CONTRAST: number;
|
|
1040
|
-
};
|
|
1041
|
-
constants: {
|
|
1042
|
-
WALL_THICKNESS: number;
|
|
1043
|
-
DOOR_CLEARANCE: number;
|
|
1044
|
-
PLAYER_RADIUS: number;
|
|
1045
|
-
DOOR_EDGE_CLEARANCE: number;
|
|
1046
|
-
WINDOW_EDGE_CLEARANCE: number;
|
|
1047
|
-
OVERHEAD_TOP: number;
|
|
1048
|
-
CAR_CLEARANCE: {
|
|
1049
|
-
readonly driver: 0.8;
|
|
1050
|
-
readonly side: 0.6;
|
|
1051
|
-
readonly end: 0.6;
|
|
1052
|
-
};
|
|
1053
|
-
};
|
|
1054
|
-
};
|
|
1055
|
-
type FloorplanEngine = typeof engine;
|
|
1118
|
+
declare const engine: FloorplanEngine;
|
|
1056
1119
|
|
|
1057
|
-
export { type Anchor, type BoundaryRule, type CarClearance, type ChaletParams, type CityBuildingParams, type ColonialParams, type CompanyHouseParams, 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 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, createRng, createSilhouetteRandom, createSlabHouse, createStiltHouse, createTwoStoreyHouse, 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 };
|
|
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 };
|