@adatechnology/game-interactables-household 0.5.0 → 0.7.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/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { GOODS_ITEMS, GOODS_PROVENANCE, GOODS_STRINGS } from "@adatechnology/gam
7
7
 
8
8
  // src/destruction.ts
9
9
  var door = (material, joint = "hinge", piece2 = "door") => ({ material, joint, piece: piece2 });
10
- var drawer = { material: "mdf", joint: "clip", piece: "drawer" };
10
+ var drawer = { material: "mdf", joint: "slide", piece: "drawer" };
11
11
  var knob = { material: "plastic", joint: "clip", piece: "knob" };
12
12
  var tap = { material: "steel", joint: "screw", piece: "handle" };
13
13
  var mdfBody = { material: "mdf", joint: "screw" };
@@ -42,6 +42,7 @@ var DESTRUCTION = {
42
42
  wall_switch: { body: { material: "plastic", joint: "screw" }, parts: [["rocker", { material: "plastic", joint: "clip", piece: "rocker" }]] },
43
43
  service_entrance: { body: { material: "steel", joint: "bolt" }, parts: [["meter_door", door("steel")]] },
44
44
  conduit_run: { body: { material: "plastic", joint: "clip" }, parts: [] },
45
+ service_mast: { body: { material: "steel", joint: "clip" }, parts: [] },
45
46
  electrical_panel: {
46
47
  body: { material: "steel", joint: "screw" },
47
48
  parts: [[/^breaker/, { material: "plastic", joint: "clip", piece: "breaker" }], ["door", door("steel")]]
@@ -1235,6 +1236,7 @@ var en_default = {
1235
1236
  "type.wall_socket": "Wall socket",
1236
1237
  "type.wall_switch": "Light switch",
1237
1238
  "type.service_entrance": "Service entrance pole",
1239
+ "type.service_mast": "Service mast (pontalete)",
1238
1240
  "type.conduit_run": "Conduit run",
1239
1241
  "type.tv": "Television",
1240
1242
  "type.microwave": "Microwave",
@@ -1479,6 +1481,7 @@ var pt_BR_default = {
1479
1481
  "type.wall_socket": "Tomada",
1480
1482
  "type.wall_switch": "Interruptor",
1481
1483
  "type.service_entrance": "Poste de entrada de energia",
1484
+ "type.service_mast": "Pontalete de entrada de energia",
1482
1485
  "type.conduit_run": "Eletroduto",
1483
1486
  "type.tv": "Televis\xE3o",
1484
1487
  "type.microwave": "Micro-ondas",
@@ -1958,9 +1961,9 @@ var types_default = [
1958
1961
  {
1959
1962
  id: "wall_socket",
1960
1963
  group: "electrical",
1961
- w: 0.08,
1964
+ w: 0.075,
1962
1965
  d: 0.03,
1963
- h: 0.08,
1966
+ h: 0.12,
1964
1967
  y: 0.3,
1965
1968
  solid: false,
1966
1969
  massKg: 0.05
@@ -1968,9 +1971,9 @@ var types_default = [
1968
1971
  {
1969
1972
  id: "wall_switch",
1970
1973
  group: "electrical",
1971
- w: 0.08,
1974
+ w: 0.075,
1972
1975
  d: 0.03,
1973
- h: 0.08,
1976
+ h: 0.12,
1974
1977
  y: 1.2,
1975
1978
  solid: false,
1976
1979
  massKg: 0.05
@@ -1985,6 +1988,16 @@ var types_default = [
1985
1988
  solid: true,
1986
1989
  massKg: 60
1987
1990
  },
1991
+ {
1992
+ id: "service_mast",
1993
+ group: "electrical",
1994
+ w: 0.1,
1995
+ d: 0.25,
1996
+ h: 4.4,
1997
+ y: 0,
1998
+ solid: true,
1999
+ massKg: 14
2000
+ },
1988
2001
  {
1989
2002
  id: "electrical_panel",
1990
2003
  group: "electrical",
@@ -2497,13 +2510,14 @@ function plugged(c, id, kind, watts, plug, o = {}) {
2497
2510
  }
2498
2511
 
2499
2512
  // src/builders/electrical.ts
2513
+ var WALL_PLATE = { width: 0.075, height: 0.12, thickness: 0.012, sink: 5e-3 };
2500
2514
  function wallSocket(c) {
2501
- const { hd, w, h, y0 } = c;
2515
+ const { w, h, y0 } = c;
2502
2516
  const cx = 0;
2503
2517
  const cy = y0 + h / 2;
2504
- const zp = -hd + 0.012;
2518
+ const zp = WALL_PLATE.thickness - WALL_PLATE.sink;
2505
2519
  const plate = c.main(15856110);
2506
- c.b("plain", -w / 2, y0, -hd, w / 2, y0 + h, zp, plate);
2520
+ c.b("plain", -w / 2, y0, -WALL_PLATE.sink, w / 2, y0 + h, zp, plate);
2507
2521
  c.b("plain", -w / 2 + 6e-3, y0 + 6e-3, zp, w / 2 - 6e-3, y0 + h - 6e-3, zp + 3e-3, shade(plate, 0.97));
2508
2522
  c.rod("plain", "z", cx, cy, zp + 35e-4, 0.0285, 15e-4, shade(plate, 0.92));
2509
2523
  const dark = 1842206;
@@ -2522,11 +2536,11 @@ function wallSocket(c) {
2522
2536
  c.spec.colliders = [];
2523
2537
  }
2524
2538
  function wallSwitch(c) {
2525
- const { hd, w, h, y0 } = c;
2539
+ const { w, h, y0 } = c;
2526
2540
  const cy = y0 + h / 2;
2527
- const zp = -hd + 0.012;
2541
+ const zp = WALL_PLATE.thickness - WALL_PLATE.sink;
2528
2542
  const plate = c.main(15856110);
2529
- c.b("plain", -w / 2, y0, -hd, w / 2, y0 + h, zp, plate);
2543
+ c.b("plain", -w / 2, y0, -WALL_PLATE.sink, w / 2, y0 + h, zp, plate);
2530
2544
  c.b("plain", -w / 2 + 6e-3, y0 + 6e-3, zp, w / 2 - 6e-3, y0 + h - 6e-3, zp + 3e-3, shade(plate, 0.97));
2531
2545
  c.b("plain", -0.018, cy - 0.032, zp + 3e-3, 0.018, cy + 0.032, zp + 6e-3, shade(plate, 0.85));
2532
2546
  c.part(
@@ -2543,7 +2557,20 @@ function wallSwitch(c) {
2543
2557
  c.interact("use_switch", [0, round3(cy), round3(zp + 0.02)], { do: "toggle_switch", switch: "switch" }, "prompt.switch", 1);
2544
2558
  c.spec.colliders = [];
2545
2559
  }
2560
+ var NETWORK_POST = { half: 0.07, anchor: 5.7, bracket: 0.06 };
2561
+ function networkPost(c) {
2562
+ const { h } = c;
2563
+ const { half, anchor, bracket } = NETWORK_POST;
2564
+ c.b("plain", -half, 0, -half, half, h, half, c.main(11119009));
2565
+ c.b("metal", -0.02, anchor - 0.06, -half - bracket, 0.02, anchor + 0.04, -half - 2e-3, 4869200);
2566
+ c.add("wires", { id: "earth", kind: "cable", radius: 6e-3, points: [[0.04, 1.2, -half - 0.01], [0.04, 0.9, -half - 0.05], [0.04, 0.05, -half - 0.12]] });
2567
+ c.cyl("metal", 0.04, 1e-3, -half - 0.12, 0.01, 0.3, 12088115, "cyl6");
2568
+ c.spec.colliders = [];
2569
+ c.collider("pole", -half, 0, -half, half, h, half);
2570
+ c.add("damage", { target: "self", kind: "masonry", hp: 400 });
2571
+ }
2546
2572
  function serviceEntrance(c) {
2573
+ if (c.M.variant === "network") return networkPost(c);
2547
2574
  const { hw, h } = c;
2548
2575
  const pole = c.main(11119009);
2549
2576
  const top = h - 0.1;
@@ -2618,6 +2645,33 @@ function conduitRun(c) {
2618
2645
  c.add("wires", { id: "conduit", kind: "conduit", radius: 0.012, points: pts });
2619
2646
  c.spec.colliders = [];
2620
2647
  }
2648
+ var MAST = { radius: 0.021, bend: 0.08, capRadius: 0.032, capLength: 0.06, color: 11120307 };
2649
+ function mastAxis(h) {
2650
+ const top = h - MAST.bend - MAST.radius * 1.2;
2651
+ const arc = Array.from({ length: 8 }, (_, index) => {
2652
+ const angle = Math.PI * (index + 1) / 8;
2653
+ return [0, round3(top + MAST.bend * Math.sin(angle)), round3(-MAST.bend * Math.cos(angle))];
2654
+ });
2655
+ return [[0, 0, -MAST.bend], [0, top, -MAST.bend], ...arc];
2656
+ }
2657
+ function pipeSegment(c, a, b) {
2658
+ const dy = b[1] - a[1];
2659
+ const dz = b[2] - a[2];
2660
+ const length = Math.hypot(dy, dz);
2661
+ if (length < 1e-4) return;
2662
+ if (Math.abs(dz) < 1e-6 && dy > 0) return void c.cyl("metal", a[0], a[1], a[2], MAST.radius, length, MAST.color, "cyl");
2663
+ const reach = length + MAST.radius * 0.4;
2664
+ c.cyl("metal", a[0], (a[1] + b[1]) / 2, (a[2] + b[2]) / 2, MAST.radius, reach, MAST.color, "cyl", Math.atan2(dz, dy), 0);
2665
+ }
2666
+ function serviceMast(c) {
2667
+ const points = c.M.points && c.M.points.length >= 2 ? c.M.points.map((p) => [...p]) : mastAxis(c.h);
2668
+ for (let index = 0; index + 1 < points.length; index++) pipeSegment(c, points[index], points[index + 1]);
2669
+ const end = points[points.length - 1];
2670
+ c.cyl("metal", end[0], end[1] - MAST.capLength, end[2], MAST.capRadius, MAST.capLength, MAST.color, "cyl");
2671
+ c.spec.colliders = [];
2672
+ const foot = points[0];
2673
+ c.collider("mast", foot[0] - MAST.radius, foot[1], foot[2] - MAST.radius, foot[0] + MAST.radius, end[1], foot[2] + MAST.radius);
2674
+ }
2621
2675
  function tv(c) {
2622
2676
  const { hw, hd, w, h, y0 } = c;
2623
2677
  const bz = 0.04;
@@ -2832,6 +2886,7 @@ function powerMeter(c) {
2832
2886
  }
2833
2887
 
2834
2888
  // src/builders/kitchen.ts
2889
+ var STOVE_WALL_GAP = 0.04;
2835
2890
  var STEEL = 11843772;
2836
2891
  var CHROME = 13817562;
2837
2892
  function tap2(c, x, y, z, id, partId) {
@@ -2937,7 +2992,7 @@ function stove(c) {
2937
2992
  id: "gas_hose",
2938
2993
  kind: "cable",
2939
2994
  radius: 8e-3,
2940
- points: [[round3(hw - 0.08), 0.18, -hd], [round3(hw - 0.08), 0.12, round3(-hd - 0.12)], [round3(hw - 0.1), 0.06, round3(-hd - 0.3)], [round3(hw - 0.2), 0.03, round3(-hd - 0.5)]]
2995
+ points: [[round3(hw - 0.08), 0.18, -hd], [round3(hw - 0.08), 0.1, round3(-hd - STOVE_WALL_GAP)], [round3(hw - 0.14), 0.04, round3(-hd - STOVE_WALL_GAP)]]
2941
2996
  });
2942
2997
  c.add("damage", { target: "oven_door", kind: "glass", hp: 30 });
2943
2998
  }
@@ -5184,6 +5239,7 @@ var BUILDERS = {
5184
5239
  wall_switch: wallSwitch,
5185
5240
  service_entrance: serviceEntrance,
5186
5241
  conduit_run: conduitRun,
5242
+ service_mast: serviceMast,
5187
5243
  electrical_panel: electricalPanel,
5188
5244
  power_meter: powerMeter,
5189
5245
  tv,
@@ -5282,6 +5338,8 @@ export {
5282
5338
  HOUSEHOLD_ITEM_IDS,
5283
5339
  HOUSEHOLD_REGIONS,
5284
5340
  HOUSEHOLD_TYPES,
5341
+ STOVE_WALL_GAP,
5342
+ WALL_PLATE,
5285
5343
  cornersOf,
5286
5344
  createHousehold,
5287
5345
  createRecorder,