@adatechnology/game-floorplan-three 0.10.2 → 0.10.3

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.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  ptBR,
17
17
  rectsOf,
18
18
  specimenSpec
19
- } from "./chunk-Y3Y7NYOL.js";
19
+ } from "./chunk-JZQA7G63.js";
20
20
 
21
21
  // src/navigation/floor-navigator.ts
22
22
  var CELL = 0.1;
@@ -1,17 +1,17 @@
1
- import { DeferredQueue, ModuleScenario, TestableModule, DestructibleSpec } from '@adatechnology/game-contracts';
2
- import { DestructionWorld, DestructionEvent } from '@adatechnology/game-destruction';
1
+ import { DestructibleSpec, DestructionEvent, DeferredQueue, PartState, ObjectState, HitResult, ModuleScenario, TestableModule } from '@adatechnology/game-contracts';
2
+ import { DestructionWorld, DestructionEvent as DestructionEvent$1 } from '@adatechnology/game-destruction';
3
3
  import { DestructionRenderer } from '@adatechnology/game-destruction-three';
4
4
  import { FloorplanResult, ResultGate, FloorplanResultFields, ResultRoom, PlanWall, PlanDoor, PlanWindow, Rect } from '@adatechnology/game-floorplan';
5
5
  import * as THREE_NS from 'three';
6
6
  import { LightBudget, LightHandle } from '@adatechnology/game-render-three';
7
7
  import { DocumentLike, Props3dOptions, Props3d } from '@adatechnology/game-props3d';
8
+ import { StructurePart, Support, DestructibleSpecOptions, Outbuilding, Utilities, WaterTank, Construction, Structure, PlumbingPoint, PlumbingRun } from '@adatechnology/game-floorplan-structure';
8
9
  import { catenary } from '@adatechnology/game-shapes-three';
9
10
  import * as Vegetation from '@adatechnology/game-vegetation';
10
11
  import { PlantSpec } from '@adatechnology/game-vegetation';
11
12
  import * as Interactables from '@adatechnology/game-interactables';
12
13
  import { ObjectSpec, World } from '@adatechnology/game-interactables';
13
14
  import { FloorplanAdapter, HouseholdKit, AdapterOptions, PlanEntry, AdapterPlan, WaterNetwork, AddResult, BlockedFn } from '@adatechnology/game-floorplan-interactables';
14
- import { StructurePart, Support, Outbuilding, Utilities, WaterTank, Construction, Structure, PlumbingPoint, PlumbingRun } from '@adatechnology/game-floorplan-structure';
15
15
  import * as VegetationThree from '@adatechnology/game-vegetation/three';
16
16
 
17
17
  /** Texts the house shows to the player (interaction prompts, messages, outbuilding labels), by locale. */
@@ -100,6 +100,117 @@ interface SpeciesLibrary {
100
100
  toSpec(species: string): PlantSpec;
101
101
  }
102
102
 
103
+ /** What draws a piece of the structure: a loose group (`obj`), or a range of a merged mesh (`whole` when the range is the whole mesh). */
104
+ type StructureMeshItem = {
105
+ obj: THREE_NS.Object3D;
106
+ mesh?: undefined;
107
+ whole?: undefined;
108
+ v0?: undefined;
109
+ v1?: undefined;
110
+ i0?: undefined;
111
+ i1?: undefined;
112
+ } | {
113
+ obj?: undefined;
114
+ mesh: THREE_NS.Mesh;
115
+ v0: number;
116
+ v1: number;
117
+ i0: number;
118
+ i1: number;
119
+ whole: boolean;
120
+ };
121
+ /** A piece of the house's structure: the part of the plan (or a tagged piece the plan does not have), how many meshes draw it, and what it holds. */
122
+ type HouseStructurePart = StructurePart & {
123
+ meshes: number;
124
+ extra: boolean;
125
+ contains?: unknown;
126
+ explodes?: unknown;
127
+ tags?: string[];
128
+ thickness?: number;
129
+ fill?: number;
130
+ [field: string]: unknown;
131
+ };
132
+ /** A support of the house's structure (`extra` when the house added it: what is fitted into a wall rests on it). */
133
+ type HouseSupport = Support & {
134
+ extra?: boolean;
135
+ };
136
+ /** `house.structure`: the parts and supports of the house, the meshes that draw each part and the destructible spec. */
137
+ interface HouseStructure {
138
+ system: string;
139
+ parts: HouseStructurePart[];
140
+ supports: HouseSupport[];
141
+ levels: number[];
142
+ elevation: number;
143
+ byId: Map<string, HouseStructurePart>;
144
+ meshesOf(id: string): StructureMeshItem[];
145
+ /** The piece a raycast hit (object and face index): merged mesh by its ranges, single-piece mesh or loose group by userData. */
146
+ pieceId(obj: THREE_NS.Object3D | null, face?: number | null): string | null;
147
+ spec(options?: DestructibleSpecOptions | null): DestructibleSpec;
148
+ [field: string]: unknown;
149
+ }
150
+ /** The breach view of a house (`createBreachView`): draws the units that come out of its walls. */
151
+ interface BreachView {
152
+ stage(event: DestructionEvent): boolean;
153
+ spall(event: DestructionEvent): boolean;
154
+ claim(): void;
155
+ chip(event: DestructionEvent): boolean;
156
+ drop(partId: string): void;
157
+ setLod(level: number): void;
158
+ restore(): void;
159
+ flush(budgetMs?: number): number;
160
+ release(): void;
161
+ deferredQueue(): DeferredQueue;
162
+ has(partId: string): boolean;
163
+ statistics(): {
164
+ walls: number;
165
+ gone: number;
166
+ craters: number;
167
+ flakes: number;
168
+ units: number;
169
+ };
170
+ }
171
+ /** What undoes `follow`: the house's drawing back, the listener gone, and the per-frame painting. */
172
+ interface HouseFollow {
173
+ restore(): void;
174
+ dispose(): void;
175
+ update(): void;
176
+ }
177
+ /** `house.destruction`: the adapter of the house to the destruction world (`cfg.destruction`). */
178
+ interface HouseDestruction {
179
+ world: DestructionWorld | null;
180
+ id: string | null;
181
+ active: boolean;
182
+ renderer: HouseDestructionRenderer | null;
183
+ spec: DestructibleSpec | null;
184
+ specOptions: DestructibleSpecOptions | null;
185
+ breach: BreachView;
186
+ onEvent(fn: (e: DestructionEvent) => void): () => void;
187
+ hide(id: string): void;
188
+ dropPiece(id: string): void;
189
+ restore(): void;
190
+ sync(): void;
191
+ ranges(): Record<string, BoundMeshes[]>;
192
+ activate(world?: DestructionWorld | null, specOptions?: DestructibleSpecOptions | null): HouseDestruction;
193
+ deactivate(): void;
194
+ follow(world: DestructionWorld, id: string, spec: DestructibleSpec): HouseFollow;
195
+ piece(id: string): PartState | null;
196
+ state(): ObjectState | null;
197
+ reset(): void;
198
+ strike(pid: string, point: {
199
+ x: number;
200
+ y: number;
201
+ z: number;
202
+ } | null | undefined, type: string | undefined, amount: number | null | undefined, d?: {
203
+ hpMax?: number;
204
+ } | null): HitResult | null;
205
+ animate(dt: number): void;
206
+ statistics(): {
207
+ hiddenPieces: number;
208
+ falling: number;
209
+ fragments: number;
210
+ breached: ReturnType<BreachView['statistics']>;
211
+ };
212
+ }
213
+
103
214
  /** A part of the house a hit can damage (door, window, glass, tank...): the game reads `hp`. */
104
215
  interface Damageable {
105
216
  type: string;
@@ -227,7 +338,7 @@ interface HouseRendererOptions {
227
338
  /** A part took damage (`house.damage`, a hit of the destruction world): the part, or for a wall `{ type: 'wall', damageable, collider }`. */
228
339
  onDamage?: (part: HousePart | HouseWallDamage, point: HousePoint | null | undefined, type: string) => void;
229
340
  /** Every event of the destruction world about this house, with the house's inner group. */
230
- onWreck?: (event: DestructionEvent, house: THREE_NS.Group) => void;
341
+ onWreck?: (event: DestructionEvent$1, house: THREE_NS.Group) => void;
231
342
  /** The player acts on something; returning `false` cancels it. */
232
343
  onInteract?: (target: HouseInteractTarget, action?: InteractionTarget | KitInteractionTarget) => boolean | void;
233
344
  /** A room's light turned on or off (`on` is what it shows now). */
@@ -410,9 +521,9 @@ interface House {
410
521
  electrical: ElectricalInfo | null;
411
522
  gutters: GutterInfo | null;
412
523
  /** The structure of the house (`game-floorplan-structure`): its parts and `spec()`, the destructible spec. */
413
- structure: any;
524
+ structure: HouseStructure;
414
525
  /** The adapter to the destruction world (`destruction` option). */
415
- destruction: any;
526
+ destruction: HouseDestruction;
416
527
  update(dt: number, time?: number, focus?: HousePoint): void;
417
528
  show(options?: {
418
529
  floor?: number;
package/dist/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AreaContext, D as DEFAULT_SPECIMENS, F as FLOORPLAN_AREA_ID, d as FloorplanEngineLike, e as FloorplanTestOptions, S as SPECIMEN_AT, o as SpecimenDef, p as TemplateGroup, r as buildSpecimenMeshes, s as createFloorplanTestModule, t as createHouseScenarios, y as specimenSpec } from './testing-BK7QmoUq.js';
1
+ export { A as AreaContext, D as DEFAULT_SPECIMENS, F as FLOORPLAN_AREA_ID, d as FloorplanEngineLike, e as FloorplanTestOptions, S as SPECIMEN_AT, o as SpecimenDef, p as TemplateGroup, r as buildSpecimenMeshes, s as createFloorplanTestModule, t as createHouseScenarios, y as specimenSpec } from './testing-DWLAejq6.js';
2
2
  import '@adatechnology/game-contracts';
3
3
  import '@adatechnology/game-destruction';
4
4
  import '@adatechnology/game-destruction-three';
@@ -6,9 +6,9 @@ import '@adatechnology/game-floorplan';
6
6
  import 'three';
7
7
  import '@adatechnology/game-render-three';
8
8
  import '@adatechnology/game-props3d';
9
+ import '@adatechnology/game-floorplan-structure';
9
10
  import '@adatechnology/game-shapes-three';
10
11
  import '@adatechnology/game-vegetation';
11
12
  import '@adatechnology/game-interactables';
12
13
  import '@adatechnology/game-floorplan-interactables';
13
- import '@adatechnology/game-floorplan-structure';
14
14
  import '@adatechnology/game-vegetation/three';
package/dist/testing.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  createFloorplanTestModule,
7
7
  createHouseScenarios,
8
8
  specimenSpec
9
- } from "./chunk-Y3Y7NYOL.js";
9
+ } from "./chunk-JZQA7G63.js";
10
10
  export {
11
11
  DEFAULT_SPECIMENS,
12
12
  FLOORPLAN_AREA_ID,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adatechnology/game-floorplan-three",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "license": "MIT",
5
5
  "description": "three.js renderer for @adatechnology/game-floorplan: walls, doors, windows, floors, stairs, roofs, lot, furniture, lights, mirrors and cars of a plan, bound to the destruction of its structure, plus the floor navigator.",
6
6
  "keywords": [
@@ -42,10 +42,10 @@
42
42
  "MIGRATION.md"
43
43
  ],
44
44
  "dependencies": {
45
- "@adatechnology/game-contracts": "^0.27.0",
46
- "@adatechnology/game-destruction": "^0.18.1",
45
+ "@adatechnology/game-contracts": "^0.28.0",
46
+ "@adatechnology/game-destruction": "^0.18.2",
47
47
  "@adatechnology/game-floorplan-interactables": "^1.0.0",
48
- "@adatechnology/game-floorplan-structure": "^2.1.2",
48
+ "@adatechnology/game-floorplan-structure": "^2.1.3",
49
49
  "@adatechnology/game-props3d": "^0.3.3",
50
50
  "@adatechnology/game-render-three": "^0.2.0",
51
51
  "@adatechnology/game-shapes-three": "^0.3.1",
@@ -53,9 +53,9 @@
53
53
  },
54
54
  "peerDependencies": {
55
55
  "three": "^0.160.0",
56
- "@adatechnology/game-floorplan": "^0.3.5",
56
+ "@adatechnology/game-floorplan": "^0.3.6",
57
57
  "@adatechnology/game-vegetation": "^0.2.1",
58
- "@adatechnology/game-interactables": "^0.2.19"
58
+ "@adatechnology/game-interactables": "^0.2.20"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/node": "^22.10.7",
@@ -64,14 +64,14 @@
64
64
  "tsup": "^8.5.1",
65
65
  "typescript": "^5.7.3",
66
66
  "vitest": "^3.2.4",
67
- "@adatechnology/game-floorplan": "^0.3.5",
67
+ "@adatechnology/game-floorplan": "^0.3.6",
68
68
  "@adatechnology/game-kit-defaults": "^0.2.0",
69
- "@adatechnology/game-interactables": "^0.2.19",
69
+ "@adatechnology/game-interactables": "^0.2.20",
70
70
  "@adatechnology/game-interactables-household": "^0.5.0",
71
- "@adatechnology/game-interactables-three": "^0.2.6",
71
+ "@adatechnology/game-interactables-three": "^0.2.7",
72
72
  "@adatechnology/game-floorplan-commercial": "^6.0.0",
73
73
  "@adatechnology/golden-tool": "^0.0.0",
74
- "@adatechnology/game-destruction-three": "^0.17.1",
74
+ "@adatechnology/game-destruction-three": "^0.17.3",
75
75
  "@adatechnology/game-vegetation": "^0.2.1",
76
76
  "@adatechnology/game-vegetation-species": "^0.2.0",
77
77
  "@adatechnology/game-floorplan-rural": "^5.0.1",