@adatechnology/game-interactables-household 0.6.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.d.ts CHANGED
@@ -33,7 +33,7 @@ interface HouseholdItem extends PropItem {
33
33
  id: string;
34
34
  label?: string;
35
35
  }>;
36
- /** `conduit_run`: polyline in object-local coordinates. */
36
+ /** `conduit_run`: polyline in object-local coordinates. `service_mast`: the axis of the mast's pipe, foot to the weatherhead's open end (default: a straight mast of the item's height bent over the top). */
37
37
  points?: Vec3[];
38
38
  /** `service_entrance`: where the drop wire ends (the house attachment point), object-local. */
39
39
  house?: Vec3;
@@ -18901,6 +18901,7 @@ var GameInteractablesHousehold = (() => {
18901
18901
  wall_switch: { body: { material: "plastic", joint: "screw" }, parts: [["rocker", { material: "plastic", joint: "clip", piece: "rocker" }]] },
18902
18902
  service_entrance: { body: { material: "steel", joint: "bolt" }, parts: [["meter_door", door("steel")]] },
18903
18903
  conduit_run: { body: { material: "plastic", joint: "clip" }, parts: [] },
18904
+ service_mast: { body: { material: "steel", joint: "clip" }, parts: [] },
18904
18905
  electrical_panel: {
18905
18906
  body: { material: "steel", joint: "screw" },
18906
18907
  parts: [[/^breaker/, { material: "plastic", joint: "clip", piece: "breaker" }], ["door", door("steel")]]
@@ -20094,6 +20095,7 @@ var GameInteractablesHousehold = (() => {
20094
20095
  "type.wall_socket": "Wall socket",
20095
20096
  "type.wall_switch": "Light switch",
20096
20097
  "type.service_entrance": "Service entrance pole",
20098
+ "type.service_mast": "Service mast (pontalete)",
20097
20099
  "type.conduit_run": "Conduit run",
20098
20100
  "type.tv": "Television",
20099
20101
  "type.microwave": "Microwave",
@@ -20338,6 +20340,7 @@ var GameInteractablesHousehold = (() => {
20338
20340
  "type.wall_socket": "Tomada",
20339
20341
  "type.wall_switch": "Interruptor",
20340
20342
  "type.service_entrance": "Poste de entrada de energia",
20343
+ "type.service_mast": "Pontalete de entrada de energia",
20341
20344
  "type.conduit_run": "Eletroduto",
20342
20345
  "type.tv": "Televis\xE3o",
20343
20346
  "type.microwave": "Micro-ondas",
@@ -20844,6 +20847,16 @@ var GameInteractablesHousehold = (() => {
20844
20847
  solid: true,
20845
20848
  massKg: 60
20846
20849
  },
20850
+ {
20851
+ id: "service_mast",
20852
+ group: "electrical",
20853
+ w: 0.1,
20854
+ d: 0.25,
20855
+ h: 4.4,
20856
+ y: 0,
20857
+ solid: true,
20858
+ massKg: 14
20859
+ },
20847
20860
  {
20848
20861
  id: "electrical_panel",
20849
20862
  group: "electrical",
@@ -21403,7 +21416,20 @@ var GameInteractablesHousehold = (() => {
21403
21416
  c.interact("use_switch", [0, round3(cy), round3(zp + 0.02)], { do: "toggle_switch", switch: "switch" }, "prompt.switch", 1);
21404
21417
  c.spec.colliders = [];
21405
21418
  }
21419
+ var NETWORK_POST = { half: 0.07, anchor: 5.7, bracket: 0.06 };
21420
+ function networkPost(c) {
21421
+ const { h } = c;
21422
+ const { half, anchor, bracket } = NETWORK_POST;
21423
+ c.b("plain", -half, 0, -half, half, h, half, c.main(11119009));
21424
+ c.b("metal", -0.02, anchor - 0.06, -half - bracket, 0.02, anchor + 0.04, -half - 2e-3, 4869200);
21425
+ 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]] });
21426
+ c.cyl("metal", 0.04, 1e-3, -half - 0.12, 0.01, 0.3, 12088115, "cyl6");
21427
+ c.spec.colliders = [];
21428
+ c.collider("pole", -half, 0, -half, half, h, half);
21429
+ c.add("damage", { target: "self", kind: "masonry", hp: 400 });
21430
+ }
21406
21431
  function serviceEntrance(c) {
21432
+ if (c.M.variant === "network") return networkPost(c);
21407
21433
  const { hw, h } = c;
21408
21434
  const pole = c.main(11119009);
21409
21435
  const top = h - 0.1;
@@ -21478,6 +21504,33 @@ var GameInteractablesHousehold = (() => {
21478
21504
  c.add("wires", { id: "conduit", kind: "conduit", radius: 0.012, points: pts });
21479
21505
  c.spec.colliders = [];
21480
21506
  }
21507
+ var MAST = { radius: 0.021, bend: 0.08, capRadius: 0.032, capLength: 0.06, color: 11120307 };
21508
+ function mastAxis(h) {
21509
+ const top = h - MAST.bend - MAST.radius * 1.2;
21510
+ const arc = Array.from({ length: 8 }, (_, index) => {
21511
+ const angle = Math.PI * (index + 1) / 8;
21512
+ return [0, round3(top + MAST.bend * Math.sin(angle)), round3(-MAST.bend * Math.cos(angle))];
21513
+ });
21514
+ return [[0, 0, -MAST.bend], [0, top, -MAST.bend], ...arc];
21515
+ }
21516
+ function pipeSegment(c, a, b) {
21517
+ const dy = b[1] - a[1];
21518
+ const dz = b[2] - a[2];
21519
+ const length = Math.hypot(dy, dz);
21520
+ if (length < 1e-4) return;
21521
+ 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");
21522
+ const reach = length + MAST.radius * 0.4;
21523
+ 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);
21524
+ }
21525
+ function serviceMast(c) {
21526
+ const points = c.M.points && c.M.points.length >= 2 ? c.M.points.map((p) => [...p]) : mastAxis(c.h);
21527
+ for (let index = 0; index + 1 < points.length; index++) pipeSegment(c, points[index], points[index + 1]);
21528
+ const end = points[points.length - 1];
21529
+ c.cyl("metal", end[0], end[1] - MAST.capLength, end[2], MAST.capRadius, MAST.capLength, MAST.color, "cyl");
21530
+ c.spec.colliders = [];
21531
+ const foot = points[0];
21532
+ c.collider("mast", foot[0] - MAST.radius, foot[1], foot[2] - MAST.radius, foot[0] + MAST.radius, end[1], foot[2] + MAST.radius);
21533
+ }
21481
21534
  function tv(c) {
21482
21535
  const { hw, hd, w, h, y0 } = c;
21483
21536
  const bz = 0.04;
@@ -24045,6 +24098,7 @@ var GameInteractablesHousehold = (() => {
24045
24098
  wall_switch: wallSwitch,
24046
24099
  service_entrance: serviceEntrance,
24047
24100
  conduit_run: conduitRun,
24101
+ service_mast: serviceMast,
24048
24102
  electrical_panel: electricalPanel,
24049
24103
  power_meter: powerMeter,
24050
24104
  tv,