@adatechnology/game-floorplan-three 0.3.1 → 0.4.1

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
@@ -1852,8 +1852,8 @@ function installRoofGutters(K, shared) {
1852
1852
  t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
1853
1853
  return ((t ^ t >>> 14) >>> 0) / 4294967296;
1854
1854
  };
1855
- const draw = rnd() < p, light = rnd() < 0.6;
1856
- void draw;
1855
+ const draw2 = rnd() < p, light = rnd() < 0.6;
1856
+ void draw2;
1857
1857
  const on = true;
1858
1858
  return { on, rnd, color: high ? 3816770 : light ? 15527921 : 10857392, bad: (shared.ctx.colors.meta && shared.ctx.colors.meta.state) === "abandoned" || R.state === "abandoned", fallback: false };
1859
1859
  }
@@ -6715,6 +6715,7 @@ function installDestructionWorld(K, shared) {
6715
6715
  }
6716
6716
 
6717
6717
  // src/build/build.ts
6718
+ import { markKitOrigin } from "@adatechnology/game-contracts";
6718
6719
  function installBuildBuild(K, shared) {
6719
6720
  const { THREE, cfg, rectsOf: rectsOf2, invalidateShadow, colliderChanged, VERSION: VERSION2, CARS, EPS, LIGHTS, MIRRORS, Y0, animateClotheslines, animateDoors, animateInteractive, applyLeaf, applyOutbuildings, applyPart, applyPiece, assembleInteractive, baseboardAndSidewalk, buildStairs, building, carModel, chooseMirror, closeScene, collideAt, createWater, cursor, doorText, doors, electricalStructure, elevator, floorsAndSlabs, gatesInteractive, houseItems, ivAssemble, ivBuild, ivDispose, ivParts, ivPublish, ivUpdate, lightOn, linkDoorLeaves, mailboxInteractive, newInteractiveState, newMirrorState, outbuildings, paths, perimeter, placeSwitches, roofs, roomAt, solar, targetOf, terrain, toggleDoor, toggleLight, walls, waterPipes, windows, props, TYPES, IVK, VEG, vegMaterials, markGroups, assembleStructure, createHouseDestruction, newState, enter, tagDamage } = K;
6720
6721
  function build(r0, opts) {
@@ -6821,7 +6822,7 @@ function installBuildBuild(K, shared) {
6821
6822
  assembleInteractive(gs);
6822
6823
  linkDoorLeaves();
6823
6824
  mailboxInteractive();
6824
- const root = new THREE.Group(), house = new THREE.Group();
6825
+ const root = markKitOrigin(new THREE.Group(), { owner: "game-floorplan-three", kind: "structure", id: r.template }), house = new THREE.Group();
6825
6826
  root.name = "house3d";
6826
6827
  root.add(house);
6827
6828
  shared.mirrors.house = house;
@@ -8562,6 +8563,7 @@ function createFloorplanTestModule(options = {}) {
8562
8563
 
8563
8564
  // src/furniture/spec.ts
8564
8565
  import { inferJoints } from "@adatechnology/game-destruction";
8566
+ import { markKitOrigin as markKitOrigin2 } from "@adatechnology/game-contracts";
8565
8567
  import { residentialItems } from "@adatechnology/game-floorplan-residential";
8566
8568
  var WOOD_THIN = 0.035;
8567
8569
  var FLOOR_TOUCH = 5e-3;
@@ -8682,7 +8684,7 @@ function recordSpec(THREE, name, root, run, opts) {
8682
8684
  const spec = { name, parts, joints, tags: ["furniture"] };
8683
8685
  const colors = new Map(drawn.map((p) => [p.id, p.color]));
8684
8686
  const build = (T3) => {
8685
- const group = new T3.Group();
8687
+ const group = markKitOrigin2(new T3.Group(), { owner: "game-floorplan-three", kind: "furniture", id: name });
8686
8688
  group.name = name;
8687
8689
  const mats = /* @__PURE__ */ new Map();
8688
8690
  for (const p of parts) {
@@ -8769,6 +8771,67 @@ function tapSpec(THREE, opts = {}) {
8769
8771
  K.PARTS.length = before;
8770
8772
  return { spec: made.spec, build: made.build, spout: [water.pos[0] - root.x, water.pos[1], water.pos[2] - root.z] };
8771
8773
  }
8774
+
8775
+ // src/wall.ts
8776
+ import { buildStructure, masonryConstruction } from "@adatechnology/game-floorplan-structure";
8777
+ var PLASTER = 15262420;
8778
+ var WALL_ID = "wall_0_0";
8779
+ function wallPlan(options) {
8780
+ const { w, h, thickness = 0.15, finish = "plaster", color = PLASTER } = options;
8781
+ const facade = { finish, roof: "none", floors: 1 };
8782
+ const wall = { id: WALL_ID, floor: 0, axis: "u", u0: -w / 2, v0: 0, u1: w / 2, v1: 0, thickness, sides: ["outside", "outside"], exterior: true, type: "wall", h };
8783
+ const plan = {
8784
+ template: "wall",
8785
+ name: "wall",
8786
+ style: "mid",
8787
+ state: "normal",
8788
+ w,
8789
+ d: thickness,
8790
+ floors: [{ index: 0, y0: 0, ceiling: h }],
8791
+ rooms: [],
8792
+ walls: [wall],
8793
+ doors: [],
8794
+ windows: [],
8795
+ items: [],
8796
+ stateItems: [],
8797
+ openPairs: [],
8798
+ partyWalls: [],
8799
+ missing: [],
8800
+ facade,
8801
+ colors: { facade: color, wall: color },
8802
+ lot: null,
8803
+ building: null,
8804
+ waterTank: null,
8805
+ outbuildings: []
8806
+ };
8807
+ plan.construction = masonryConstruction({ ...plan, facade: { ...facade, roof: "colonial" } });
8808
+ plan.structure = buildStructure(plan, { wallDetail: "coarse", construction: plan.construction, roof: false });
8809
+ return plan;
8810
+ }
8811
+ function draw(THREE, plan, options) {
8812
+ return create(THREE, { ...options, fleet: null }).build(plan, { quality: "game", terrain: false, noPerimeter: true, pieces: "meshes" });
8813
+ }
8814
+ function label(house) {
8815
+ for (const [id, items] of Object.entries(house.destruction.ranges())) {
8816
+ for (const item of items) {
8817
+ const object = item.isObject3D ? item : item.mesh;
8818
+ object.userData.destructionPart = id;
8819
+ }
8820
+ }
8821
+ return house.group;
8822
+ }
8823
+ function wallPiece(THREE, options) {
8824
+ const plan = wallPlan(options);
8825
+ const houseOptions = options.house ?? {};
8826
+ const probe = draw(THREE, plan, { ...houseOptions, destruction: void 0, destructionRenderer: void 0 });
8827
+ const spec = probe.structure.spec({ wallDetail: "coarse" });
8828
+ probe.dispose();
8829
+ return {
8830
+ plan,
8831
+ spec,
8832
+ build: (T) => label(draw(T, plan, houseOptions))
8833
+ };
8834
+ }
8772
8835
  export {
8773
8836
  DEFAULT_SPECIMENS,
8774
8837
  FLOORPLAN_AREA_ID,
@@ -8792,6 +8855,8 @@ export {
8792
8855
  ptBR,
8793
8856
  rectsOf,
8794
8857
  specimenSpec,
8795
- tapSpec
8858
+ tapSpec,
8859
+ wallPiece,
8860
+ wallPlan
8796
8861
  };
8797
8862
  //# sourceMappingURL=index.js.map