@adatechnology/game-floorplan-three 0.4.2 → 0.6.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 CHANGED
@@ -58,7 +58,7 @@ const shelf = furnitureSpec(THREE, 'bookcase') // 1.2 x 0.35 x 2 m: uprights, ba
58
58
  world.add(shelf.spec, { id: 'shelf', position: [-3.5, 0, 0] })
59
59
  scene.add(shelf.build(THREE)) // meshes named by part id
60
60
  const table = furnitureSpec(THREE, 'dining_table', { w: 1.6, d: 0.8, h: 0.78, options: { chairs: false } })
61
- table.top // { part: 'wood_0', y: 0.78 }: what loose things rest on
61
+ table.top // { part: 'wood_0_b2', y: 0.78, parts: ['wood_0_b0', ...] }: what loose things rest on (a solid wooden top is boards: it breaks board by board where it is hit)
62
62
  ```
63
63
 
64
64
  `tapSpec(THREE, { kind: 'counter' | 'wall', reach? })` does the same for the team's tap (`counterTap` of the sink, `wallTap` of the laundry tub): the steel parts of the base, column, spout and lever, and `spout`, where the water thread starts (the thread itself is not drawn).
package/dist/index.d.ts CHANGED
@@ -577,9 +577,11 @@ interface FurnitureSpecResult {
577
577
  /** Draws the piece: one mesh per part, named by the part id, coloured as the builder coloured it. */
578
578
  build(THREE: any): any;
579
579
  /** The widest high horizontal part and the height of its upper face (what loose things rest on), or null when the piece has none. */
580
+ /** What loose things rest on. A solid top is boards: `parts` are all of them, `part` the one in the middle. */
580
581
  top: {
581
582
  part: string;
582
583
  y: number;
584
+ parts?: string[];
583
585
  } | null;
584
586
  /** Size the piece was drawn at. */
585
587
  size: {
@@ -599,7 +601,8 @@ interface FurnitureSpecResult {
599
601
  * Materials: `wood` is `wood_hard`, and `wood_soft` for thin boards and panels (under 3.5 cm); `metal` is `steel`; `fabric`, `glass` and `plant` keep
600
602
  * their name; `plain` is `plastic`, or `paper` for shelves and racks (their books and boxes). Parts that touch the floor are anchored. Joints come from
601
603
  * `inferJoints` (screws between wood, welds or bolts between metal...), except that paper rests on what it lies on with a `resting` joint (weak: it falls when
602
- * the board breaks) and is not joined to its neighbours.
604
+ * the board breaks) and is not joined to its neighbours. Shelves and racks stand as a carcass: the sides carry, each shelf needs both of its ends
605
+ * held, and the back panel carries nothing, so a broken side drops the shelves it held, with their books.
603
606
  *
604
607
  * @example
605
608
  * const { spec, build, top } = furnitureSpec(THREE, 'bookcase') // 1.2 x 0.35 x 2 m, boards and books
@@ -648,6 +651,15 @@ interface WallPiece {
648
651
  readonly spec: any;
649
652
  /** Draws the wall with the house renderer: meshes carry `userData.destructionPart` of their part, in the space of the spec. */
650
653
  build(THREE: any): any;
654
+ /**
655
+ * Once a drawing from `build` is in a destruction world as `objectId` (with this `spec`), the house renderer follows its events and draws on it what
656
+ * a generic destruction renderer cannot: the bricks that shots and blows knock out (`chip`) and the opening of a breach, as gaps in the wall's
657
+ * courses. `restore` puts the wall back (after `world.reset`), `dispose` stops following.
658
+ */
659
+ follow(root: any, world: any, objectId: string): {
660
+ restore(): void;
661
+ dispose(): void;
662
+ } | null;
651
663
  }
652
664
  /**
653
665
  * The plan of a free-standing wall along x, centred on the origin: a one-storey plan whose only wall is exterior on both sides, with the masonry construction of