@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 +1 -1
- package/dist/index.global.js +54 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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",
|
|
@@ -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",
|
|
@@ -2544,7 +2557,20 @@ function wallSwitch(c) {
|
|
|
2544
2557
|
c.interact("use_switch", [0, round3(cy), round3(zp + 0.02)], { do: "toggle_switch", switch: "switch" }, "prompt.switch", 1);
|
|
2545
2558
|
c.spec.colliders = [];
|
|
2546
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
|
+
}
|
|
2547
2572
|
function serviceEntrance(c) {
|
|
2573
|
+
if (c.M.variant === "network") return networkPost(c);
|
|
2548
2574
|
const { hw, h } = c;
|
|
2549
2575
|
const pole = c.main(11119009);
|
|
2550
2576
|
const top = h - 0.1;
|
|
@@ -2619,6 +2645,33 @@ function conduitRun(c) {
|
|
|
2619
2645
|
c.add("wires", { id: "conduit", kind: "conduit", radius: 0.012, points: pts });
|
|
2620
2646
|
c.spec.colliders = [];
|
|
2621
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
|
+
}
|
|
2622
2675
|
function tv(c) {
|
|
2623
2676
|
const { hw, hd, w, h, y0 } = c;
|
|
2624
2677
|
const bz = 0.04;
|
|
@@ -5186,6 +5239,7 @@ var BUILDERS = {
|
|
|
5186
5239
|
wall_switch: wallSwitch,
|
|
5187
5240
|
service_entrance: serviceEntrance,
|
|
5188
5241
|
conduit_run: conduitRun,
|
|
5242
|
+
service_mast: serviceMast,
|
|
5189
5243
|
electrical_panel: electricalPanel,
|
|
5190
5244
|
power_meter: powerMeter,
|
|
5191
5245
|
tv,
|