@adatechnology/game-interactables-household 0.8.1 → 0.8.3

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
@@ -9,6 +9,7 @@ import { GOODS_ITEMS, GOODS_PROVENANCE, GOODS_STRINGS } from "@adatechnology/gam
9
9
  var door = (material, joint = "hinge", piece2 = "door") => ({ material, joint, piece: piece2 });
10
10
  var drawer = { material: "mdf", joint: "slide", piece: "drawer" };
11
11
  var knob = { material: "plastic", joint: "clip", piece: "knob" };
12
+ var mainLever = { material: "plastic", joint: "clip", piece: "breaker" };
12
13
  var tap = { material: "steel", joint: "screw", piece: "handle" };
13
14
  var mdfBody = { material: "mdf", joint: "screw" };
14
15
  var cabinet = { body: mdfBody, parts: [[/^drawer/, drawer], [/^door/, door("mdf")]] };
@@ -43,19 +44,23 @@ var DESTRUCTION = {
43
44
  wall_socket: { body: { material: "plastic", joint: "screw" }, parts: [] },
44
45
  wall_switch: { body: { material: "plastic", joint: "screw" }, parts: [["rocker", { material: "plastic", joint: "clip", piece: "rocker" }]] },
45
46
  // a cast concrete pole (NBR 8451: CA-50 bars in the concrete), its segments held by the bars; the meter box, the cross arm and the bracket are bolted to it
46
- service_entrance: { body: { material: "concrete", joint: "rebar", reinforcement: POLE_CAGE }, parts: [["meter_door", door("steel")]] },
47
+ service_entrance: { body: { material: "concrete", joint: "rebar", reinforcement: POLE_CAGE }, parts: [["meter_door", door("steel")], ["main_breaker", mainLever]] },
47
48
  conduit_run: { body: { material: "plastic", joint: "clip" }, parts: [] },
48
- service_mast: { body: { material: "steel", joint: "clip" }, parts: [] },
49
+ // one galvanised pipe bent over the top: its stretches are the same steel (welded, not clipped: the clamps hold it to the wall, not to itself)
50
+ service_mast: { body: { material: "steel", joint: "weld" }, parts: [] },
49
51
  electrical_panel: {
50
52
  body: { material: "steel", joint: "screw" },
51
53
  parts: [[/^breaker/, { material: "plastic", joint: "clip", piece: "breaker" }], ["door", door("steel")]]
52
54
  },
53
- power_meter: { body: { material: "plastic", joint: "screw" }, parts: [["door", door("plastic")]] },
55
+ power_meter: { body: { material: "plastic", joint: "screw" }, parts: [["door", door("plastic")], ["main_breaker", mainLever]] },
54
56
  tv: { body: { material: "plastic", joint: "screw" }, parts: [["power", { material: "plastic", joint: "clip", piece: "button" }]] },
55
57
  microwave: { body: { material: "steel", joint: "screw" }, parts: [["door", door("steel")], ["dial", knob]] },
56
58
  washing_machine: { body: { material: "steel", joint: "screw" }, parts: [["dial", knob], ["door", door("tempered_glass")]] },
57
59
  sofa: { body: upholstery, parts: [] },
58
60
  armchair: { body: upholstery, parts: [] },
61
+ pouf: { body: upholstery, parts: [] },
62
+ box_bed: { body: upholstery, parts: [] },
63
+ upholstered_chair: { body: upholstery, parts: [] },
59
64
  dining_chair: { body: { material: "wood_hard", joint: "screw" }, parts: [] },
60
65
  bed_double: { body: { material: "wood_soft", joint: "screw" }, parts: [] },
61
66
  bed_single: { body: { material: "wood_soft", joint: "screw" }, parts: [] },
@@ -1271,9 +1276,12 @@ var en_default = {
1271
1276
  "type.washing_machine": "Washing machine",
1272
1277
  "type.sofa": "Sofa",
1273
1278
  "type.armchair": "Armchair",
1279
+ "type.pouf": "Pouf",
1274
1280
  "type.dining_chair": "Dining chair",
1281
+ "type.upholstered_chair": "Upholstered chair",
1275
1282
  "type.bed_double": "Double bed",
1276
1283
  "type.bed_single": "Single bed",
1284
+ "type.box_bed": "Box bed",
1277
1285
  "type.bench": "Bench",
1278
1286
  "type.blinds": "Blinds",
1279
1287
  "type.curtain": "Curtain",
@@ -1426,6 +1434,13 @@ var en_default = {
1426
1434
  "prompt.breaker.off": "Switch on {circuit}",
1427
1435
  "prompt.breaker.off.verb": "Switch on",
1428
1436
  "prompt.breaker.off.object": "{circuit}",
1437
+ "prompt.main_breaker": "Main breaker",
1438
+ "prompt.main_breaker.on": "Switch off the main breaker",
1439
+ "prompt.main_breaker.on.verb": "Switch off",
1440
+ "prompt.main_breaker.on.object": "the main breaker",
1441
+ "prompt.main_breaker.off": "Switch on the main breaker",
1442
+ "prompt.main_breaker.off.verb": "Switch on",
1443
+ "prompt.main_breaker.off.object": "the main breaker",
1429
1444
  "type.bunk_bed": "Bunk bed",
1430
1445
  "type.wood_stove": "Wood stove",
1431
1446
  "type.fireplace": "Fireplace",
@@ -1521,9 +1536,12 @@ var pt_BR_default = {
1521
1536
  "type.washing_machine": "M\xE1quina de lavar",
1522
1537
  "type.sofa": "Sof\xE1",
1523
1538
  "type.armchair": "Poltrona",
1539
+ "type.pouf": "Pufe",
1524
1540
  "type.dining_chair": "Cadeira",
1541
+ "type.upholstered_chair": "Cadeira estofada",
1525
1542
  "type.bed_double": "Cama de casal",
1526
1543
  "type.bed_single": "Cama de solteiro",
1544
+ "type.box_bed": "Cama box",
1527
1545
  "type.bench": "Banco",
1528
1546
  "type.blinds": "Persiana",
1529
1547
  "type.curtain": "Cortina",
@@ -1676,6 +1694,13 @@ var pt_BR_default = {
1676
1694
  "prompt.breaker.off": "Ligar {circuit}",
1677
1695
  "prompt.breaker.off.verb": "Ligar",
1678
1696
  "prompt.breaker.off.object": "{circuit}",
1697
+ "prompt.main_breaker": "Disjuntor geral",
1698
+ "prompt.main_breaker.on": "Desligar o disjuntor geral",
1699
+ "prompt.main_breaker.on.verb": "Desligar",
1700
+ "prompt.main_breaker.on.object": "o disjuntor geral",
1701
+ "prompt.main_breaker.off": "Ligar o disjuntor geral",
1702
+ "prompt.main_breaker.off.verb": "Ligar",
1703
+ "prompt.main_breaker.off.object": "o disjuntor geral",
1679
1704
  "type.bunk_bed": "Beliche",
1680
1705
  "type.wood_stove": "Fog\xE3o a lenha",
1681
1706
  "type.fireplace": "Lareira",
@@ -2132,6 +2157,17 @@ var types_default = [
2132
2157
  pushable: true,
2133
2158
  massKg: 25
2134
2159
  },
2160
+ {
2161
+ id: "pouf",
2162
+ group: "seating",
2163
+ w: 0.45,
2164
+ d: 0.45,
2165
+ h: 0.42,
2166
+ y: 0,
2167
+ solid: true,
2168
+ pushable: true,
2169
+ massKg: 4
2170
+ },
2135
2171
  {
2136
2172
  id: "dining_chair",
2137
2173
  group: "seating",
@@ -2142,6 +2178,16 @@ var types_default = [
2142
2178
  solid: true,
2143
2179
  massKg: 5
2144
2180
  },
2181
+ {
2182
+ id: "upholstered_chair",
2183
+ group: "seating",
2184
+ w: 0.46,
2185
+ d: 0.52,
2186
+ h: 0.92,
2187
+ y: 0,
2188
+ solid: true,
2189
+ massKg: 6
2190
+ },
2145
2191
  {
2146
2192
  id: "bed_double",
2147
2193
  group: "seating",
@@ -2164,6 +2210,17 @@ var types_default = [
2164
2210
  pushable: true,
2165
2211
  massKg: 30
2166
2212
  },
2213
+ {
2214
+ id: "box_bed",
2215
+ group: "seating",
2216
+ w: 1.38,
2217
+ d: 1.88,
2218
+ h: 0.72,
2219
+ y: 0,
2220
+ solid: true,
2221
+ pushable: true,
2222
+ massKg: 75
2223
+ },
2167
2224
  {
2168
2225
  id: "bench",
2169
2226
  group: "seating",
@@ -2644,7 +2701,7 @@ function serviceEntrance(c) {
2644
2701
  const t = i / 14;
2645
2702
  gp.push([round3(g0[0] + (gh[0] - g0[0]) * t), round3(g0[1] + (gh[1] - g0[1]) * t - (c.M.sag ?? 0.5) * 4 * t * (1 - t)), round3(g0[2] + (gh[2] - g0[2]) * t)]);
2646
2703
  }
2647
- c.add("wires", { id: "drop", kind: "drop", radius: 6e-3, points: gp });
2704
+ c.add("wires", { id: "drop", kind: "drop", radius: 6e-3, points: gp, span: { material: "copper", section: 8e-6 } });
2648
2705
  c.add("wires", { id: "hook", kind: "cable", radius: 4e-3, points: [[0.22, round3(ay + 0.17), 0], [0.12, round3(ay + 0.06), 0.05], [round3(g0[0]), round3(g0[1]), 0]] });
2649
2706
  c.spec.colliders = [];
2650
2707
  c.collider("pole", -0.15, 0, -0.15, 0.15, h, 0.15);
@@ -2664,6 +2721,7 @@ function serviceEntrance(c) {
2664
2721
  c.rod("plain", "z", 0, my + 0.28, mz + 0.045, 0.07, 4e-3, 15263968);
2665
2722
  for (let i = 0; i < 4; i++) c.b("plain", -0.06 + i * 0.03, my + 0.34, mz + 0.047, -0.04 + i * 0.03, my + 0.37, mz + 0.05, 2763306);
2666
2723
  c.b("plain", -0.06, my + 0.12, mz + 0.03, 0.06, my + 0.2, mz + 0.045, 4868686);
2724
+ mainBreaker(c, [0, my + 0.16, mz + 0.045], "meter_door");
2667
2725
  c.part(
2668
2726
  "meter_door",
2669
2727
  [-mx, my + 0.25, mz + 0.062],
@@ -2684,7 +2742,7 @@ function serviceEntrance(c) {
2684
2742
  const t = i / n;
2685
2743
  pts.push([round3(A[0] + (house[0] - A[0]) * t), round3(A[1] + (house[1] - A[1]) * t - sag * 4 * t * (1 - t)), round3(A[2] + (house[2] - A[2]) * t)]);
2686
2744
  }
2687
- c.add("wires", { id: "drop", kind: "drop", radius: 8e-3, points: pts });
2745
+ c.add("wires", { id: "drop", kind: "drop", radius: 8e-3, points: pts, span: { material: "aluminium", section: 2e-5 } });
2688
2746
  c.add("wires", { id: "riser", kind: "conduit", radius: 0.014, points: [[0.05, my + 0.5, mz], [0.05, my + 0.7, 0.14], [0.05, round3(ay + 0.05), 0.115], [0, round3(A[1]), 0]] });
2689
2747
  c.add("wires", { id: "earth", kind: "cable", radius: 6e-3, points: [[-0.1, my, mz], [-0.16, 0.9, 0.16], [-0.16, 0.05, 0.18]] });
2690
2748
  c.cyl("metal", -0.16, 1e-3, 0.18, 0.01, 0.3, 12088115, "cyl6");
@@ -2906,6 +2964,19 @@ function electricalPanel(c) {
2906
2964
  });
2907
2965
  c.spec.colliders = [];
2908
2966
  }
2967
+ function mainBreaker(c, at, door2) {
2968
+ const [x, y, z] = at;
2969
+ c.part(
2970
+ "main_breaker",
2971
+ [x, y, z],
2972
+ { kind: "rocker", axis: [1, 0, 0], angle: 0.5 },
2973
+ () => {
2974
+ c.b("plain", x - 0.012, y - 0.022, z, x + 0.012, y + 0.022, z + 0.014, 13122090);
2975
+ },
2976
+ { t0: 1, requires: door2, at: false, noSweep: true }
2977
+ );
2978
+ c.interact("toggle_main_breaker", [round3(x), round3(y), round3(z + 0.03)], { do: "toggle_main", part: "main_breaker" }, "prompt.main_breaker", 1.4);
2979
+ }
2909
2980
  function powerMeter(c) {
2910
2981
  const { hw, hd, h, y0 } = c;
2911
2982
  const body = c.main(9080466);
@@ -2921,6 +2992,8 @@ function powerMeter(c) {
2921
2992
  for (let i = 0; i < 5; i++) c.b("plain", cx - 0.05 + i * 0.02, cy + 0.025, sh.iz0 + 0.048, cx - 0.034 + i * 0.02, cy + 0.05, sh.iz0 + 0.05, 2763306);
2922
2993
  c.rod("plain", "z", cx, cy - 0.02, sh.iz0 + 0.049, 0.026, 2e-3, 14209216);
2923
2994
  c.b("plain", cx - 0.05, y0 + 0.025, sh.iz0, cx + 0.05, y0 + 0.07, sh.iz0 + 0.04, 4868686);
2995
+ c.b("plain", cx + 0.055, y0 + 0.025, sh.iz0, cx + 0.085, y0 + 0.075, sh.iz0 + 0.03, 4868686);
2996
+ mainBreaker(c, [cx + 0.07, y0 + 0.05, sh.iz0 + 0.03], "door");
2924
2997
  const px = -hw + 4e-3;
2925
2998
  const f = 0.028;
2926
2999
  const wy0 = y0 + 0.02;
@@ -3294,6 +3367,9 @@ function shower(c) {
3294
3367
  c.spec.colliders = [];
3295
3368
  c.collider("wall_back", -hw, 0, -hd, hw, h, -hd + 0.03);
3296
3369
  c.collider("wall_left", -hw, 0, -hd + 0.03, -hw + 0.03, h, hd - 0.05);
3370
+ c.collider("glass_side", hw - 0.032, 0, -hd + 0.03, hw, h, hd);
3371
+ if (hingeX - (-hw + 0.03) > 0.02) c.collider("glass_fixed", -hw + 0.03, 0, zFront - 4e-3, hingeX - 4e-3, h, zFront + 4e-3);
3372
+ c.add("colliders", { id: "glass_door", center: [round3((hingeX + dx1) / 2), round3(h / 2), round3(zFront)], half: [round3(dw / 2), round3(h / 2), 4e-3], part: "glass_door", offWhenOpen: true });
3297
3373
  }
3298
3374
  var FLUSH_TRAVEL = 8e-3;
3299
3375
  var BOWL_Z = 0.12;
@@ -3359,8 +3435,205 @@ function toilet(c) {
3359
3435
  c.add("damage", { target: "self", kind: "plastic", hp: 60 });
3360
3436
  }
3361
3437
 
3362
- // src/builders/seating.ts
3438
+ // src/builders/upholstery.ts
3439
+ var COVER = 6e-3;
3440
+ var BOARD = 0.03;
3441
+ var RAIL = 0.04;
3442
+ var SPRING_WIDTH = 9e-3;
3443
+ var SPRING_THICK = 3e-3;
3444
+ function sideBox(c, sign, material, a, b, y0, z0, y1, z1, color) {
3445
+ c.b(material, sign < 0 ? -b : a, y0, z0, sign < 0 ? -a : b, y1, z1, color);
3446
+ }
3447
+ function seatBase(c, f, k) {
3448
+ const { hw, hd } = c;
3449
+ const { legH, baseTop, armW, seatCount } = f;
3450
+ const ix0 = -hw + armW;
3451
+ const ix1 = hw - armW;
3452
+ const zFront = hd - COVER;
3453
+ const zBack = -hd + COVER;
3454
+ c.b("wood", -hw + COVER, legH, zFront - RAIL, hw - COVER, baseTop, zFront, k.wood);
3455
+ c.b("wood", -hw + COVER, legH, zBack, hw - COVER, baseTop, zBack + RAIL, k.wood);
3456
+ for (const s of [-1, 1]) sideBox(c, s, "wood", hw - COVER - RAIL, hw - COVER, legH, zBack + RAIL, baseTop, zFront - RAIL, shade(k.wood, 0.92));
3457
+ for (let i = 1; i < seatCount; i++) {
3458
+ const x = ix0 + (ix1 - ix0) * i / seatCount;
3459
+ c.b("wood", x - RAIL / 2, legH, zBack + RAIL, x + RAIL / 2, baseTop, zFront - RAIL, shade(k.wood, 0.85));
3460
+ }
3461
+ const strips = seatCount === 1 ? 4 : 6;
3462
+ for (let i = 0; i < strips; i++) {
3463
+ const x = ix0 + 0.03 + i * (ix1 - ix0 - 0.06 - SPRING_WIDTH) / (strips - 1);
3464
+ c.b("metal", x, baseTop, zBack + 0.01, x + SPRING_WIDTH, baseTop + SPRING_THICK, zFront - 0.01, 4869200);
3465
+ }
3466
+ c.b("fabric", -hw, legH, zFront, hw, baseTop, hd, k.dark);
3467
+ c.b("fabric", -hw, legH, -hd, hw, baseTop, zBack, k.dark);
3468
+ for (const s of [-1, 1]) sideBox(c, s, "fabric", hw - COVER, hw, legH, zBack, baseTop, zFront, k.dark);
3469
+ }
3470
+ function backRest(c, f, k) {
3471
+ const { hw, hd } = c;
3472
+ const { baseTop, backDepth, top } = f;
3473
+ const z0 = -hd + COVER;
3474
+ const zPad = -hd + backDepth;
3475
+ for (const s of [-1, 1]) sideBox(c, s, "wood", hw - COVER - RAIL, hw - COVER, baseTop, z0, top, z0 + RAIL, k.wood);
3476
+ c.b("wood", -hw + COVER + RAIL, top - RAIL, z0, hw - COVER - RAIL, top, z0 + RAIL, k.wood);
3477
+ c.b("wood", -hw + COVER + RAIL, baseTop + 0.12, z0, hw - COVER - RAIL, baseTop + 0.12 + RAIL, z0 + RAIL, shade(k.wood, 0.9));
3478
+ c.b("foam", -hw + COVER, baseTop + SPRING_THICK, z0 + RAIL, hw - COVER, top, zPad, k.fab);
3479
+ c.b("fabric", -hw, baseTop, -hd, hw, top, z0, k.dark);
3480
+ for (const s of [-1, 1]) sideBox(c, s, "fabric", hw - COVER, hw, baseTop, z0, top, zPad, k.fab);
3481
+ }
3482
+ function armFrame(c, f, sign, k) {
3483
+ const { hw, hd } = c;
3484
+ const { baseTop, armW, backDepth } = f;
3485
+ const z0 = -hd + backDepth;
3486
+ const z1 = hd - COVER;
3487
+ const frameTop = f.armTop - armW;
3488
+ const coverTop = f.armTop - armW / 2;
3489
+ const innerEdge = hw - armW;
3490
+ sideBox(c, sign, "wood", hw - COVER - BOARD, hw - COVER, baseTop, z0, frameTop, z1 - BOARD, k.wood);
3491
+ sideBox(c, sign, "wood", innerEdge + COVER, innerEdge + COVER + BOARD, baseTop, z0, frameTop, z1 - BOARD, k.wood);
3492
+ sideBox(c, sign, "wood", innerEdge + COVER, hw - COVER, baseTop, z1 - BOARD, frameTop, z1, shade(k.wood, 0.92));
3493
+ sideBox(c, sign, "wood", innerEdge + COVER + BOARD, hw - COVER - BOARD, frameTop - BOARD, z0, frameTop, z1 - BOARD, shade(k.wood, 0.85));
3494
+ sideBox(c, sign, "fabric", hw - COVER, hw, baseTop, z0, coverTop, z1, k.fab);
3495
+ sideBox(c, sign, "fabric", innerEdge, innerEdge + COVER, baseTop, z0, coverTop, z1, k.light);
3496
+ sideBox(c, sign, "fabric", innerEdge, hw, baseTop, z1, coverTop, z1 + COVER, k.fab);
3497
+ }
3498
+ function sofaStructure(c, f, k) {
3499
+ seatBase(c, f, k);
3500
+ backRest(c, f, k);
3501
+ for (const s of [-1, 1]) armFrame(c, f, s, k);
3502
+ }
3503
+ function bedBase(c, slatColour, frameTop, matTop) {
3504
+ const { hw, hd } = c;
3505
+ const x0 = -hw + 0.05;
3506
+ const x1 = hw - 0.05;
3507
+ const z0 = -hd + 0.06;
3508
+ const z1 = hd - 0.05;
3509
+ const slats = Math.round((z1 - z0) / 0.12);
3510
+ const pitch = (z1 - z0 - 0.07) / (slats - 1);
3511
+ for (let i = 0; i < slats; i++) c.b("wood", x0, frameTop - 0.02, z0 + i * pitch, x1, frameTop, z0 + i * pitch + 0.07, slatColour);
3512
+ c.b("wood", -0.03, frameTop - 0.06, z0, 0.03, frameTop - 0.02, z1, shade(slatColour, 0.8));
3513
+ mattress(c, { x0: -hw + 0.057, x1: hw - 0.057, z0: -hd + 0.065, z1: hd - 0.055, bottom: frameTop, top: matTop });
3514
+ }
3515
+ function mattress(c, m) {
3516
+ const { x0: m0, x1: m1, z0: n0, z1: n1, bottom: frameTop, top: matTop } = m;
3517
+ c.b("foam", m0 + COVER, frameTop + COVER, n0 + COVER, m1 - COVER, matTop - COVER, n1 - COVER, 15920868);
3518
+ c.b("fabric", m0, frameTop, n0, m1, frameTop + COVER, n1, 14210248);
3519
+ c.b("fabric", m0, matTop - COVER, n0, m1, matTop, n1, 15657696);
3520
+ c.b("fabric", m0, frameTop + COVER, n0, m0 + COVER, matTop - COVER, n1, 15657696);
3521
+ c.b("fabric", m1 - COVER, frameTop + COVER, n0, m1, matTop - COVER, n1, 15657696);
3522
+ c.b("fabric", m0 + COVER, frameTop + COVER, n0, m1 - COVER, matTop - COVER, n0 + COVER, 15657696);
3523
+ c.b("fabric", m0 + COVER, frameTop + COVER, n1 - COVER, m1 - COVER, matTop - COVER, n1, 15657696);
3524
+ c.b("fabric", m0 - 3e-3, frameTop + 0.12, n0 - 3e-3, m1 + 3e-3, frameTop + 0.126, n1 + 3e-3, 14210248);
3525
+ }
3526
+
3527
+ // src/builders/upholstered.ts
3363
3528
  var FACE = 0;
3529
+ var RAIL2 = 0.04;
3530
+ function pouf(c) {
3531
+ const { hw, hd } = c;
3532
+ const wood = c.wood(9071176);
3533
+ const fab = c.fabric(8018538);
3534
+ const dark = shade(fab, 0.8);
3535
+ const legH = 0.06;
3536
+ const wall = 0.018;
3537
+ const deckTop = 0.278;
3538
+ const foamTop = 0.404;
3539
+ const top = 0.41;
3540
+ for (const sx of [-1, 1]) for (const sz of [-1, 1]) c.b("wood", sx < 0 ? -hw + COVER : hw - COVER - 0.05, 0, sz < 0 ? -hd + COVER : hd - COVER - 0.05, sx < 0 ? -hw + COVER + 0.05 : hw - COVER, legH, sz < 0 ? -hd + COVER + 0.05 : hd - COVER, 3811870);
3541
+ c.b("wood", -hw + COVER, legH, hd - COVER - wall, hw - COVER, deckTop - wall, hd - COVER, wood);
3542
+ c.b("wood", -hw + COVER, legH, -hd + COVER, hw - COVER, deckTop - wall, -hd + COVER + wall, wood);
3543
+ for (const s of [-1, 1]) c.b("wood", s < 0 ? -hw + COVER : hw - COVER - wall, legH, -hd + COVER + wall, s < 0 ? -hw + COVER + wall : hw - COVER, deckTop - wall, hd - COVER - wall, shade(wood, 0.92));
3544
+ c.b("wood", -hw + COVER, deckTop - wall, -hd + COVER, hw - COVER, deckTop, hd - COVER, shade(wood, 0.85));
3545
+ c.b("foam", -hw + COVER, deckTop, -hd + COVER, hw - COVER, foamTop, hd - COVER, fab);
3546
+ c.b("fabric", -hw, legH, hd - COVER, hw, foamTop, hd, dark);
3547
+ c.b("fabric", -hw, legH, -hd, hw, foamTop, -hd + COVER, dark);
3548
+ for (const s of [-1, 1]) c.b("fabric", s < 0 ? -hw : hw - COVER, legH, -hd + COVER, s < 0 ? -hw + COVER : hw, foamTop, hd - COVER, dark);
3549
+ c.b("fabric", -hw, foamTop, -hd, hw, top, hd, mix(fab, 16777215, 0.08));
3550
+ c.add("seats", { id: "seat", pose: "sit", pos: [0, round3(foamTop), 0], ry: FACE, exit: [0, 0, round3(hd + 0.45)] });
3551
+ c.interact("sit", [0, top + 0.3, 0.1], { do: "sit", seat: "seat" }, "prompt.sit", 1.5);
3552
+ }
3553
+ function boxBase(c, legH, baseTop) {
3554
+ const { hw, hd } = c;
3555
+ const wood = 9071176;
3556
+ const dark = 4870232;
3557
+ const zFront = hd - COVER;
3558
+ const zBack = -hd + COVER;
3559
+ c.b("wood", -hw + COVER, legH, zFront - RAIL2, hw - COVER, baseTop, zFront, wood);
3560
+ c.b("wood", -hw + COVER, legH, zBack, hw - COVER, baseTop, zBack + RAIL2, wood);
3561
+ c.b("wood", -hw + COVER + RAIL2, legH, -RAIL2 / 2, hw - COVER - RAIL2, baseTop, RAIL2 / 2, shade(wood, 0.85));
3562
+ for (const s of [-1, 1]) c.b("wood", s < 0 ? -hw + COVER : hw - COVER - RAIL2, legH, zBack + RAIL2, s < 0 ? -hw + COVER + RAIL2 : hw - COVER, baseTop, zFront - RAIL2, shade(wood, 0.92));
3563
+ for (const x of [-hw + COVER + RAIL2, hw - COVER - RAIL2 - 0.05, -0.025]) for (const z of [zBack, zFront - 0.05]) c.b("wood", x, 0, z, x + 0.05, legH, z + 0.05, 3811870);
3564
+ const strips = 11;
3565
+ const x0 = -hw + COVER + RAIL2 + 0.02;
3566
+ const x1 = hw - COVER - RAIL2 - 0.02 - SPRING_WIDTH;
3567
+ for (let i = 0; i < strips; i++) {
3568
+ const x = x0 + i * (x1 - x0) / (strips - 1);
3569
+ c.b("metal", x, baseTop, zBack + 0.01, x + SPRING_WIDTH, baseTop + SPRING_THICK, zFront - 0.01, 4869200);
3570
+ }
3571
+ c.b("fabric", -hw, legH, zFront, hw, baseTop, hd, dark);
3572
+ c.b("fabric", -hw, legH, -hd, hw, baseTop, zBack, dark);
3573
+ for (const s of [-1, 1]) c.b("fabric", s < 0 ? -hw : hw - COVER, legH, zBack, s < 0 ? -hw + COVER : hw, baseTop, zFront, dark);
3574
+ }
3575
+ function boxBed(c) {
3576
+ const { hw, hd } = c;
3577
+ const legH = 0.05;
3578
+ const baseTop = 0.35;
3579
+ const matBottom = baseTop + SPRING_THICK;
3580
+ const matTop = matBottom + 0.22;
3581
+ boxBase(c, legH, baseTop);
3582
+ mattress(c, { x0: -hw + 0.02, x1: hw - 0.02, z0: -hd + 0.02, z1: hd - 0.02, bottom: matBottom, top: matTop });
3583
+ const pw = (c.w - 0.14) / 2;
3584
+ for (let i = 0; i < 2; i++) {
3585
+ const cx = -hw + 0.07 + (i + 0.5) * pw;
3586
+ c.b("foam", cx - pw / 2 + 0.03, matTop, -hd + 0.09, cx + pw / 2 - 0.03, matTop + 0.13, -hd + 0.5, 16184558, 0, 0.08);
3587
+ const id = `lie_${i + 1}`;
3588
+ c.add("seats", { id, pose: "lie", pos: [round3(cx), round3(matTop), round3(-hd + 0.95)], ry: FACE, eye: 0.26, exit: [round3((i === 0 ? -1 : 1) * (hw + 0.5)), 0, round3(-hd + 1.1)] });
3589
+ c.interact(`lie_${id}`, [round3(cx), round3(matTop + 0.3), round3(-hd + 0.95)], { do: "sit", seat: id }, "prompt.lie", 1.8);
3590
+ }
3591
+ }
3592
+ function upholsteredChair(c) {
3593
+ const { hw, hd, h } = c;
3594
+ const wood = c.wood(8018490);
3595
+ const fab = c.fabric(9075306);
3596
+ const dark = shade(fab, 0.85);
3597
+ const leg = 0.04;
3598
+ const boardBottom = 0.382;
3599
+ const boardTop = 0.4;
3600
+ const padTop = 0.454;
3601
+ const seatTop = 0.46;
3602
+ for (const sx of [-1, 1]) {
3603
+ const x0 = sx < 0 ? -hw : hw - leg;
3604
+ c.b("wood", x0, 0, hd - leg, x0 + leg, boardBottom, hd, wood);
3605
+ c.b("wood", x0, 0, -hd, x0 + leg, h, -hd + leg, shade(wood, 0.9));
3606
+ }
3607
+ c.b("wood", -hw + leg, boardBottom - 0.06, hd - leg + 0.01, hw - leg, boardBottom, hd - 0.01, shade(wood, 0.85));
3608
+ c.b("wood", -hw + leg, boardBottom - 0.06, -hd + 0.01, hw - leg, boardBottom, -hd + leg - 0.01, shade(wood, 0.85));
3609
+ for (const sx of [-1, 1]) c.b("wood", sx < 0 ? -hw + 0.01 : hw - leg + 0.01, boardBottom - 0.06, -hd + leg, sx < 0 ? -hw + leg - 0.01 : hw - 0.01, boardBottom, hd - leg, shade(wood, 0.8));
3610
+ c.b("wood", -hw + 0.01, boardBottom, -hd + leg, hw - 0.01, boardTop, hd - 0.01, wood);
3611
+ const sx0 = -hw + 0.012;
3612
+ const sx1 = hw - 0.012;
3613
+ const sz0 = -hd + leg + 5e-3;
3614
+ const sz1 = hd - 0.012;
3615
+ c.b("foam", sx0 + COVER, boardTop, sz0 + COVER, sx1 - COVER, padTop, sz1 - COVER, fab);
3616
+ c.b("fabric", sx0, boardTop, sz1 - COVER, sx1, padTop, sz1, dark);
3617
+ c.b("fabric", sx0, boardTop, sz0, sx1, padTop, sz0 + COVER, dark);
3618
+ for (const s of [-1, 1]) c.b("fabric", s < 0 ? sx0 : sx1 - COVER, boardTop, sz0 + COVER, s < 0 ? sx0 + COVER : sx1, padTop, sz1 - COVER, dark);
3619
+ c.b("fabric", sx0, padTop, sz0, sx1, seatTop, sz1, mix(fab, 16777215, 0.08));
3620
+ const bx0 = -hw + leg;
3621
+ const bx1 = hw - leg;
3622
+ c.b("wood", bx0, h - 0.08, -hd + 5e-3, bx1, h, -hd + leg - 5e-3, wood);
3623
+ c.b("wood", bx0, 0.5, -hd + 8e-3, bx1, h - 0.08, -hd + 0.02, shade(wood, 1.05));
3624
+ const pz0 = -hd + 0.02;
3625
+ const pz1 = -hd + 0.064;
3626
+ c.b("foam", bx0 + COVER, 0.5 + COVER, pz0, bx1 - COVER, h - 0.08 - COVER, pz1, fab);
3627
+ c.b("fabric", bx0 + COVER, 0.5 + COVER, pz1, bx1 - COVER, h - 0.08 - COVER, pz1 + COVER, dark);
3628
+ c.b("fabric", bx0 + COVER, 0.5, pz0, bx1 - COVER, 0.5 + COVER, pz1 + COVER, dark);
3629
+ c.b("fabric", bx0 + COVER, h - 0.08 - COVER, pz0, bx1 - COVER, h - 0.08, pz1 + COVER, dark);
3630
+ for (const s of [-1, 1]) c.b("fabric", s < 0 ? bx0 : bx1 - COVER, 0.5, pz0, s < 0 ? bx0 + COVER : bx1, h - 0.08, pz1 + COVER, dark);
3631
+ c.add("seats", { id: "seat", pose: "sit", pos: [0, round3(seatTop + 0.04), 0.04], ry: FACE, exit: [0, 0, round3(hd + 0.45)] });
3632
+ c.interact("sit", [0, seatTop + 0.3, 0.1], { do: "sit", seat: "seat" }, "prompt.sit", 1.5);
3633
+ }
3634
+
3635
+ // src/builders/seating.ts
3636
+ var FACE2 = 0;
3364
3637
  function sofaLike(c, n, lie) {
3365
3638
  const { hw, hd, h } = c;
3366
3639
  const fab = c.fabric(7041144);
@@ -3370,18 +3643,16 @@ function sofaLike(c, n, lie) {
3370
3643
  const legH = 0.12;
3371
3644
  const seatY = 0.44;
3372
3645
  const baseTop = 0.28;
3373
- for (const sx of [-1, 1]) for (const sz of [-1, 1]) c.b("wood", sx * (hw - 0.07) - 0.025, 0, sz * (hd - 0.07) - 0.025, sx * (hw - 0.07) + 0.025, legH, sz * (hd - 0.07) + 0.025, 3811870);
3374
- c.b("fabric", -hw, legH, -hd, hw, baseTop, hd, dark);
3375
- c.b("fabric", -hw + armW, baseTop - 0.01, hd - 0.02, hw - armW, baseTop + 0.02, hd + 4e-3, shade(fab, 0.7));
3376
3646
  const bt = 0.2;
3377
- c.b("fabric", -hw, baseTop, -hd, hw, h - 0.07 - bt / 2, -hd + bt, fab);
3378
- c.rod("fabric", "x", 0, h - 0.07 - bt / 2, -hd + bt / 2, bt / 2, c.w - 4e-3, fab);
3379
3647
  const armTop = 0.62;
3648
+ const backTop = h - 0.07 - bt / 2;
3649
+ const wood = 5914672;
3650
+ for (const sx of [-1, 1]) for (const sz of [-1, 1]) c.b("wood", sx * (hw - 0.07) - 0.025, 0, sz * (hd - 0.07) - 0.025, sx * (hw - 0.07) + 0.025, legH, sz * (hd - 0.07) + 0.025, 3811870);
3651
+ sofaStructure(c, { legH, baseTop, armW, backDepth: bt, armTop, top: backTop, seatCount: n }, { wood, fab, dark, light });
3652
+ c.rod("fabric", "x", 0, backTop, -hd + bt / 2, bt / 2, c.w - 4e-3, fab);
3380
3653
  for (const s of [-1, 1]) {
3381
3654
  const x0 = s < 0 ? -hw : hw - armW;
3382
- c.b("fabric", s < 0 ? x0 : x0 + 6e-3, baseTop, -hd + bt, s < 0 ? x0 + armW - 6e-3 : x0 + armW, armTop - armW / 2, hd, fab);
3383
3655
  c.rod("fabric", "z", x0 + armW / 2, armTop - armW / 2, (-hd + bt + hd) / 2, armW / 2, hd - (-hd + bt) - 4e-3, fab);
3384
- c.b("fabric", s < 0 ? x0 + armW - 0.012 : x0, baseTop + 0.02, -hd + bt + 3e-3, s < 0 ? x0 + armW : x0 + 0.012, armTop - armW / 2 + 3e-3, hd - 0.02, light);
3385
3656
  }
3386
3657
  const ix0 = -hw + armW;
3387
3658
  const ix1 = hw - armW;
@@ -3393,12 +3664,12 @@ function sofaLike(c, n, lie) {
3393
3664
  const x0 = ix0 + i * cw + 4e-3;
3394
3665
  const x1 = ix0 + (i + 1) * cw - 4e-3;
3395
3666
  const col = i % 2 === 0 ? light : fab;
3396
- c.b("fabric", x0, baseTop + 0.02, sz0 + 0.02, x1, seatY, sz1, col);
3667
+ c.b("foam", x0, baseTop + SPRING_THICK, sz0 + 0.02, x1, seatY, sz1, col);
3397
3668
  c.b("fabric", x0 + 0.01, seatY, sz0 + 0.03, x1 - 0.01, seatY + 0.025, sz1 - 0.01, mix(col, 16777215, 0.06));
3398
3669
  c.b("fabric", x0 + 3e-3, baseTop + 0.025, sz1 - 6e-3, x1 - 3e-3, seatY + 0.02, sz1 + 3e-3, shade(col, 0.75));
3399
- c.b("fabric", x0 + 5e-3, seatY + 0.02, sz0 + 0.02, x1 - 5e-3, h - 0.12, sz0 + 0.19, col, 0, -0.18);
3670
+ c.b("foam", x0 + 5e-3, seatY + 0.02, sz0 + 0.02, x1 - 5e-3, h - 0.12, sz0 + 0.19, col, 0, -0.18);
3400
3671
  const cx = (x0 + x1) / 2;
3401
- seats.push({ id: `seat_${i + 1}`, pose: "sit", pos: [round3(cx), round3(seatY + 0.03), round3(sz0 + (sz1 - sz0) * 0.55)], ry: FACE, exit: [round3(cx), 0, round3(hd + 0.55)] });
3672
+ seats.push({ id: `seat_${i + 1}`, pose: "sit", pos: [round3(cx), round3(seatY + 0.03), round3(sz0 + (sz1 - sz0) * 0.55)], ry: FACE2, exit: [round3(cx), 0, round3(hd + 0.55)] });
3402
3673
  }
3403
3674
  for (const s of seats) c.add("seats", { ...s, eye: 0.62 });
3404
3675
  if (lie) {
@@ -3424,11 +3695,11 @@ function diningChair(c) {
3424
3695
  c.b("wood", -hw + 0.014, seatY - 0.09, -hd + 0.04, -hw + 0.04, seatY - 0.04, hd - 0.04, shade(wood, 0.85));
3425
3696
  c.b("wood", hw - 0.04, seatY - 0.09, -hd + 0.04, hw - 0.014, seatY - 0.04, hd - 0.04, shade(wood, 0.85));
3426
3697
  c.b("wood", -hw, seatY - 0.03, -hd, hw, seatY, hd, wood);
3427
- c.b("fabric", -hw + 0.02, seatY, -hd + 0.05, hw - 0.02, seatY + 0.04, hd - 0.02, cush);
3698
+ c.b("foam", -hw + 0.02, seatY, -hd + 0.05, hw - 0.02, seatY + 0.04, hd - 0.02, cush);
3428
3699
  c.b("fabric", -hw + 0.03, seatY + 0.04, -hd + 0.06, hw - 0.03, seatY + 0.045, hd - 0.03, mix(cush, 16777215, 0.1));
3429
3700
  c.b("wood", -hw + 0.014, h - 0.1, -hd + 0.014, hw - 0.014, h - 0.03, -hd + 0.04, wood);
3430
3701
  for (let i = 0; i < 3; i++) c.b("wood", -hw + 0.07 + i * ((c.w - 0.14) / 3), seatY + 0.06, -hd + 0.015, -hw + 0.07 + i * ((c.w - 0.14) / 3) + 0.04, h - 0.1, -hd + 0.035, shade(wood, 1.05));
3431
- c.add("seats", { id: "seat", pose: "sit", pos: [0, round3(seatY + 0.05), 0.02], ry: FACE, exit: [0, 0, round3(hd + 0.45)] });
3702
+ c.add("seats", { id: "seat", pose: "sit", pos: [0, round3(seatY + 0.05), 0.02], ry: FACE2, exit: [0, 0, round3(hd + 0.45)] });
3432
3703
  c.interact("sit", [0, seatY + 0.3, 0.1], { do: "sit", seat: "seat" }, "prompt.sit", 1.5);
3433
3704
  }
3434
3705
  function bedBuild(c, double) {
@@ -3444,9 +3715,7 @@ function bedBuild(c, double) {
3444
3715
  c.b("wood", -hw, 0.14, -hd, hw, h, -hd + 0.06, shade(wood, 0.92));
3445
3716
  c.b("wood", -hw + 0.06, h - 0.08, -hd + 0.06, hw - 0.06, h - 0.02, -hd + 0.07, shade(wood, 1.12));
3446
3717
  c.b("wood", -hw + 0.06, 0.5, -hd + 0.06, hw - 0.06, h - 0.1, -hd + 0.068, shade(wood, 0.84));
3447
- c.b("wood", -hw + 0.05, frameTop - 0.04, -hd + 0.06, hw - 0.05, frameTop, hd - 0.05, shade(wood, 0.7));
3448
- c.b("fabric", -hw + 0.055, frameTop, -hd + 0.065, hw - 0.055, matTop, hd - 0.055, 15657696);
3449
- c.b("fabric", -hw + 0.052, frameTop + 0.02, -hd + 0.062, hw - 0.052, frameTop + 0.026, hd - 0.052, 14210248);
3718
+ bedBase(c, shade(wood, 0.7), frameTop, matTop);
3450
3719
  c.b("fabric", -hw + 0.04, matTop - 0.01, -hd + 0.65, hw - 0.04, matTop + 0.06, hd - 0.035, sheet);
3451
3720
  c.b("fabric", -hw + 0.04, matTop + 0.06, -hd + 0.65, hw - 0.04, matTop + 0.066, -hd + 0.75, mix(sheet, 16777215, 0.4));
3452
3721
  for (let i = 0; i < 4; i++) c.b("fabric", -hw + 0.05, matTop + 0.062, -hd + 0.9 + i * 0.28, hw - 0.05, matTop + 0.067, -hd + 0.93 + i * 0.28, mix(sheet, 16777215, 0.18));
@@ -3455,11 +3724,11 @@ function bedBuild(c, double) {
3455
3724
  const seats = [];
3456
3725
  for (let i = 0; i < np; i++) {
3457
3726
  const cx = -hw + 0.07 + (i + 0.5) * pw;
3458
- c.b("fabric", cx - pw / 2 + 0.03, matTop, -hd + 0.09, cx + pw / 2 - 0.03, matTop + 0.13, -hd + 0.5, 16184558, 0, 0.08);
3727
+ c.b("foam", cx - pw / 2 + 0.03, matTop, -hd + 0.09, cx + pw / 2 - 0.03, matTop + 0.13, -hd + 0.5, 16184558, 0, 0.08);
3459
3728
  const id = double ? `lie_${i + 1}` : "lie";
3460
3729
  seats.push(id);
3461
3730
  const sx = double ? i === 0 ? -1 : 1 : 0;
3462
- c.add("seats", { id, pose: "lie", pos: [round3(cx), round3(matTop), round3(-hd + 0.95)], ry: FACE, eye: 0.26, exit: [round3(sx * (hw + 0.5) || hw + 0.5), 0, round3(-hd + 1.1)] });
3731
+ c.add("seats", { id, pose: "lie", pos: [round3(cx), round3(matTop), round3(-hd + 0.95)], ry: FACE2, eye: 0.26, exit: [round3(sx * (hw + 0.5) || hw + 0.5), 0, round3(-hd + 1.1)] });
3463
3732
  }
3464
3733
  for (const id of seats) {
3465
3734
  const s = c.spec.seats.find((x) => x.id === id);
@@ -3492,7 +3761,7 @@ function bench(c) {
3492
3761
  const step = (c.w - 0.2) / n;
3493
3762
  for (let i = 0; i < n; i++) {
3494
3763
  const x = round3(-hw + 0.1 + (i + 0.5) * step);
3495
- c.add("seats", { id: `seat_${i + 1}`, pose: "sit", pos: [x, round3(seatY + 0.03), 0.02], ry: FACE, exit: [x, 0, round3(hd + 0.5)] });
3764
+ c.add("seats", { id: `seat_${i + 1}`, pose: "sit", pos: [x, round3(seatY + 0.03), 0.02], ry: FACE2, exit: [x, 0, round3(hd + 0.5)] });
3496
3765
  c.interact(`sit_${i + 1}`, [x, seatY + 0.3, 0.1], { do: "sit", seat: `seat_${i + 1}` }, "prompt.sit", 1.5);
3497
3766
  }
3498
3767
  }
@@ -3515,9 +3784,9 @@ function bunkBed(c) {
3515
3784
  c.b("wood", -hw + post + 0.03, deck - 0.02, -hd + 0.03, hw - post - 0.03, deck + 4e-3, zEnd - 0.03, shade(wood, 0.7));
3516
3785
  }
3517
3786
  for (const [deck, top, id] of [[lowDeck, lowTop, "lower"], [highDeck, highTop, "upper"]]) {
3518
- c.b("fabric", -hw + post + 0.035, deck + 4e-3, -hd + 0.035, hw - post - 0.035, top, zEnd - 0.035, 15657696);
3787
+ c.b("foam", -hw + post + 0.035, deck + 4e-3, -hd + 0.035, hw - post - 0.035, top, zEnd - 0.035, 15657696);
3519
3788
  c.b("fabric", -hw + post + 0.04, top - 0.12, -hd + 0.65, hw - post - 0.04, top + 0.035, zEnd - 0.04, id === "upper" ? mix(sheet, 16777215, 0.15) : sheet);
3520
- c.b("fabric", -hw + post + 0.1, top, -hd + 0.07, hw - post - 0.1, top + 0.1, -hd + 0.45, 16184558, 0, 0.08);
3789
+ c.b("foam", -hw + post + 0.1, top, -hd + 0.07, hw - post - 0.1, top + 0.1, -hd + 0.45, 16184558, 0, 0.08);
3521
3790
  }
3522
3791
  c.b("wood", -hw + post, highTop + 0.04, -hd + post, -hw + post + 0.03, highTop + 0.3, zEnd - post - 0.45, wood);
3523
3792
  c.b("wood", hw - post - 0.03, highTop + 0.04, -hd + post, hw - post, highTop + 0.3, zEnd - post - 0.45, wood);
@@ -3526,7 +3795,7 @@ function bunkBed(c) {
3526
3795
  for (const x of [-0.2, 0.2]) c.b("wood", x - 0.02, 0.06, zEnd, x + 0.02, highTop + 0.3, hd, shade(wood, 1.1));
3527
3796
  for (let i = 0; i < 5; i++) c.b("wood", -0.2, 0.3 + i * 0.22, zEnd + 5e-3, 0.2, 0.34 + i * 0.22, hd - 0.01, wood);
3528
3797
  for (const [id, top, ex] of [["lie_lower", lowTop, 1], ["lie_upper", highTop, -1]]) {
3529
- c.add("seats", { id, pose: "lie", pos: [0, round3(top), round3(-hd + 0.95)], ry: FACE, eye: 0.26, exit: [round3(ex * (hw + 0.5)), 0, round3(-hd + 1.1)] });
3798
+ c.add("seats", { id, pose: "lie", pos: [0, round3(top), round3(-hd + 0.95)], ry: FACE2, eye: 0.26, exit: [round3(ex * (hw + 0.5)), 0, round3(-hd + 1.1)] });
3530
3799
  c.interact(`lie_${id}`, [0, round3(top + 0.3), round3(-hd + 0.95)], { do: "sit", seat: id }, "prompt.lie", 1.8);
3531
3800
  }
3532
3801
  }
@@ -5386,6 +5655,9 @@ var BUILDERS = {
5386
5655
  washing_machine: washingMachine,
5387
5656
  sofa,
5388
5657
  armchair,
5658
+ pouf,
5659
+ box_bed: boxBed,
5660
+ upholstered_chair: upholsteredChair,
5389
5661
  dining_chair: diningChair,
5390
5662
  bed_double: bedDouble,
5391
5663
  bed_single: bedSingle,