@adatechnology/game-weapons-three 0.27.5 → 0.28.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.
@@ -33,6 +33,7 @@ var GameWeaponsThree = (() => {
33
33
  EXPLOSIVES_AREA_ID: () => EXPLOSIVES_AREA_ID,
34
34
  EXPLOSIVES_TEXT: () => EXPLOSIVES_TEXT,
35
35
  EXPLOSIVE_MODEL_IDS: () => EXPLOSIVE_MODEL_IDS,
36
+ FAMILY_MOTIONS: () => FAMILY_MOTIONS,
36
37
  GAME_DISTANCE_CURVE: () => GAME_DISTANCE_CURVE,
37
38
  GAME_SOUND_CLASSES: () => GAME_SOUND_CLASSES,
38
39
  GROUND_SLOT: () => GROUND_SLOT,
@@ -357,6 +358,12 @@ var GameWeaponsThree = (() => {
357
358
  const flame = flameBase * (1 - rules.flameFillInfluence * (1 - k));
358
359
  return 1 - (1 - Math.min(1, Math.max(0, spark))) * (1 - Math.min(1, Math.max(0, flame)));
359
360
  };
361
+ var sealBlock = (seal, state) => {
362
+ if (seal.spoilsWhenBreached && state.breached) return "breached";
363
+ if (seal.spoilsWhenBreached && state.leaked) return "leaked";
364
+ if (!state.opened) return "sealed";
365
+ return void 0;
366
+ };
360
367
  var FIRST_PERSON_LAYER = 9;
361
368
  var TOOL_CLIP = {
362
369
  DRAW: "draw",
@@ -439,6 +446,52 @@ var GameWeaponsThree = (() => {
439
446
  (from[1] ?? 0) + ((to[1] ?? 0) - (from[1] ?? 0)) * fraction,
440
447
  (from[2] ?? 0) + ((to[2] ?? 0) - (from[2] ?? 0)) * fraction
441
448
  ];
449
+ var quatFromEuler = (e) => {
450
+ const c1 = Math.cos((e[0] ?? 0) / 2), c2 = Math.cos((e[1] ?? 0) / 2), c3 = Math.cos((e[2] ?? 0) / 2);
451
+ const s1 = Math.sin((e[0] ?? 0) / 2), s2 = Math.sin((e[1] ?? 0) / 2), s3 = Math.sin((e[2] ?? 0) / 2);
452
+ return [s1 * c2 * c3 + c1 * s2 * s3, c1 * s2 * c3 - s1 * c2 * s3, c1 * c2 * s3 + s1 * s2 * c3, c1 * c2 * c3 - s1 * s2 * s3];
453
+ };
454
+ var eulerFromQuat = (q) => {
455
+ const [x = 0, y = 0, z = 0, w = 1] = q;
456
+ const m13 = 2 * (x * z + w * y);
457
+ const ey = Math.asin(Math.max(-1, Math.min(1, m13)));
458
+ if (Math.abs(m13) < 0.9999999) return [Math.atan2(-2 * (y * z - w * x), 1 - 2 * (x * x + y * y)), ey, Math.atan2(-2 * (x * y - w * z), 1 - 2 * (y * y + z * z))];
459
+ return [Math.atan2(2 * (y * z + w * x), 1 - 2 * (x * x + z * z)), ey, 0];
460
+ };
461
+ var slerpQuat = (a, b, f) => {
462
+ const [ax = 0, ay = 0, az = 0, aw = 1] = a;
463
+ let [bx = 0, by = 0, bz = 0, bw = 1] = b;
464
+ let cos2 = ax * bx + ay * by + az * bz + aw * bw;
465
+ if (cos2 < 0) {
466
+ cos2 = -cos2;
467
+ bx = -bx;
468
+ by = -by;
469
+ bz = -bz;
470
+ bw = -bw;
471
+ }
472
+ let ka = 1 - f;
473
+ let kb = f;
474
+ if (cos2 < 0.9999) {
475
+ const angle = Math.acos(cos2);
476
+ const sin2 = Math.sin(angle);
477
+ ka = Math.sin((1 - f) * angle) / sin2;
478
+ kb = Math.sin(f * angle) / sin2;
479
+ }
480
+ const out = [ax * ka + bx * kb, ay * ka + by * kb, az * ka + bz * kb, aw * ka + bw * kb];
481
+ const size = Math.hypot(out[0], out[1], out[2], out[3]) || 1;
482
+ return [out[0] / size, out[1] / size, out[2] / size, out[3] / size];
483
+ };
484
+ var mixTurn = (from, to, fraction) => {
485
+ let changed = 0;
486
+ for (let i = 0; i < 3; i++) if (Math.abs((to[i] ?? 0) - (from[i] ?? 0)) > 1e-9) changed++;
487
+ if (changed <= 1) {
488
+ const euler = mix(from, to, fraction);
489
+ return { euler, quat: quatFromEuler(euler) };
490
+ }
491
+ const quat2 = slerpQuat(quatFromEuler(from), quatFromEuler(to), fraction);
492
+ return { euler: eulerFromQuat(quat2), quat: quat2 };
493
+ };
494
+ var IDENTITY = [0, 0, 0, 1];
442
495
  var sampleClip = (clip, partId, time) => {
443
496
  const points = clip.keys.map((key2) => {
444
497
  const pose2 = partId === void 0 ? key2 : key2.parts?.[partId];
@@ -447,14 +500,15 @@ var GameWeaponsThree = (() => {
447
500
  const first = points[0];
448
501
  if (!first || first.t > 0) points.unshift({ t: 0, position: ZERO, rotation: ZERO });
449
502
  const last = points[points.length - 1];
450
- if (!last) return { position: ZERO, rotation: ZERO };
451
- if (time >= last.t) return { position: mix(last.position, last.position, 0), rotation: mix(last.rotation, last.rotation, 0) };
503
+ if (!last) return { position: [0, 0, 0], rotation: [0, 0, 0], quaternion: [...IDENTITY] };
504
+ if (time >= last.t) return { position: mix(last.position, last.position, 0), rotation: mix(last.rotation, last.rotation, 0), quaternion: quatFromEuler(last.rotation) };
452
505
  const index = Math.max(0, points.findIndex((point, i) => time >= point.t && time < (points[i + 1]?.t ?? Infinity)));
453
506
  const from = points[index];
454
507
  const to = points[index + 1];
455
- if (!from || !to) return { position: ZERO, rotation: ZERO };
508
+ if (!from || !to) return { position: [0, 0, 0], rotation: [0, 0, 0], quaternion: [...IDENTITY] };
456
509
  const fraction = to.t > from.t ? (time - from.t) / (to.t - from.t) : 0;
457
- return { position: mix(from.position, to.position, fraction), rotation: mix(from.rotation, to.rotation, fraction) };
510
+ const turn2 = mixTurn(from.rotation, to.rotation, fraction);
511
+ return { position: mix(from.position, to.position, fraction), rotation: turn2.euler, quaternion: turn2.quat };
458
512
  };
459
513
  var leadClipEvents = (clip) => {
460
514
  const events = clip.events ?? [];
@@ -689,6 +743,7 @@ var GameWeaponsThree = (() => {
689
743
  };
690
744
  return registry;
691
745
  };
746
+ var resolveEntry = (registry, entry2, kindField = "kind") => deepMerge(registry.defaults(String(entry2[kindField])), entry2);
692
747
  var KIT_ORIGIN_KEY = "kitOrigin";
693
748
  function markKitOrigin(object2, origin) {
694
749
  const node = object2;
@@ -17164,6 +17219,76 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
17164
17219
  return sections.length ? [{ id: group.id, name: nameIn(group, locale), sections }] : [];
17165
17220
  });
17166
17221
  }
17222
+ var melee_families_default = {
17223
+ families: [
17224
+ {
17225
+ id: "short_blade",
17226
+ note: "a knife held in one hand, edge forward: a diagonal cut from the right shoulder and a straight thrust, one after the other (spec 015 R3, 'golpe curto (faca)')",
17227
+ weapons: [
17228
+ "knife",
17229
+ "tactical_knife",
17230
+ "kabar",
17231
+ "meat_cleaver"
17232
+ ],
17233
+ blows: [
17234
+ {
17235
+ clip: "knife_slash",
17236
+ motion: "slash",
17237
+ seconds: 0.46
17238
+ },
17239
+ {
17240
+ clip: "knife_stab",
17241
+ motion: "stab",
17242
+ seconds: 0.42
17243
+ }
17244
+ ],
17245
+ reset: 1.2
17246
+ },
17247
+ {
17248
+ id: "one_hand_swing",
17249
+ note: "a short heavy tool or blade in one hand (machete, hatchet, hammer, baton, skillet): chopped down from over the right shoulder, the body turning into it as in the knife's cut",
17250
+ weapons: [
17251
+ "machete",
17252
+ "hatchet",
17253
+ "sickle",
17254
+ "hammer",
17255
+ "police_baton",
17256
+ "cast_iron_skillet"
17257
+ ],
17258
+ blows: [
17259
+ {
17260
+ clip: "knife_slash",
17261
+ motion: "chop",
17262
+ seconds: 0.46
17263
+ }
17264
+ ],
17265
+ reset: 1.2
17266
+ },
17267
+ {
17268
+ id: "two_hand_swing",
17269
+ note: "a long weapon in both hands (bat, pipe, crowbar, axe, sledgehammer, katana): swung flat from the right shoulder across the body, the hips leading, as the shovel's swing",
17270
+ weapons: [
17271
+ "baseball_bat",
17272
+ "nail_bat",
17273
+ "iron_pipe",
17274
+ "crowbar",
17275
+ "axe",
17276
+ "sledgehammer",
17277
+ "pickaxe",
17278
+ "katana"
17279
+ ],
17280
+ blows: [
17281
+ {
17282
+ clip: "shovel_swing",
17283
+ motion: "swing",
17284
+ seconds: 0.6
17285
+ }
17286
+ ],
17287
+ reset: 1.2
17288
+ }
17289
+ ]
17290
+ };
17291
+ var MELEE_FAMILIES = melee_families_default.families;
17167
17292
 
17168
17293
  // ../game-render-three/dist/index.js
17169
17294
  var DEFAULT_ANGLE = Math.PI / 3;
@@ -17555,7 +17680,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
17555
17680
  shade: () => shade
17556
17681
  });
17557
17682
 
17558
- // ../game-shapes/dist/chunk-E3X7UDDV.js
17683
+ // ../game-shapes/dist/chunk-QETSTM6M.js
17559
17684
  function canonicalJson(value) {
17560
17685
  if (value === null) return "null";
17561
17686
  if (typeof value === "number") return Object.is(value, -0) ? "-0" : Number.isFinite(value) ? String(value) : JSON.stringify(String(value));
@@ -19877,7 +20002,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19877
20002
  K.cyl("metal", 0, y - 0.06, 0, 0.14, 0.015, gold);
19878
20003
  for (let i = 0; i < 6; i++) {
19879
20004
  const an = i * Math.PI / 3, cx = Math.cos(an), cz = Math.sin(an);
19880
- K.box("metal", cx * 0.14, y - 0.06, cz * 0.14, 0.28, 0.012, 0.012, gold, -an);
20005
+ K.box("metal", cx * 0.14, y - (M.visorScene ? 0.06 : 0.062), cz * 0.14, 0.28, 0.012, 0.012, gold, -an);
19881
20006
  K.cyl("plain", cx * 0.28, y - 0.06, cz * 0.28, 0.02, 0.09, 15787720);
19882
20007
  K.cyl(on ? "emissive" : "plain", cx * 0.28, y + 0.03, cz * 0.28, 0.012, 0.03, on ? 16767120 : 15128752, 0, 0, "sphere");
19883
20008
  K.box("glass", cx * 0.3, y - 0.2, cz * 0.3, 0.025, 0.14, 0.025, 16777215, -an);
@@ -19940,10 +20065,17 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19940
20065
  B.sofa_l = (M, a) => {
19941
20066
  const K = kit(M, a), { w, d } = K.dim("sofa_l"), c = K.fabric(pick(K, [7237752, 9075304, 4544618])), cd = shade(c, 0.82), zb = -d / 2, pf = 0.95, ac = K.accent(13146698), cw = 0.95;
19942
20067
  for (const sx of [-1, 1]) for (const sz of [-1, 1]) K.box("wood", sx * (w / 2 - 0.1), 0, sz * (d / 2 - 0.1), 0.05, 0.08, 0.05, K.wood(2759956));
19943
- K.box("fabric", -(cw / 2), 0.08, zb + pf / 2, w - cw, 0.26, pf, cd);
19944
- K.box("fabric", w / 2 - cw / 2, 0.08, 0, cw, 0.26, d, cd);
20068
+ if (M.visorScene) {
20069
+ K.box("fabric", -(cw / 2), 0.08, zb + pf / 2, w - cw, 0.26, pf, cd);
20070
+ K.box("fabric", w / 2 - cw / 2, 0.08, 0, cw, 0.26, d, cd);
20071
+ } else {
20072
+ const zf = zb + 0.22, xs = -w / 2 + 0.18;
20073
+ K.box("fabric", (xs + w / 2 - cw) / 2, 0.08, (zf + zb + pf) / 2, w / 2 - cw - xs, 0.26, zb + pf - zf, cd);
20074
+ K.box("fabric", w / 2 - cw / 2, 0.08, (zf + d / 2) / 2, cw, 0.26, d / 2 - zf, cd);
20075
+ }
19945
20076
  K.box("fabric", 0, 0.08, zb + 0.11, w, 0.72, 0.22, cd);
19946
- K.box("fabric", -w / 2 + 0.09, 0.08, zb + pf / 2, 0.18, 0.55, pf, cd);
20077
+ if (M.visorScene) K.box("fabric", -w / 2 + 0.09, 0.08, zb + pf / 2, 0.18, 0.55, pf, cd);
20078
+ else K.box("fabric", -w / 2 + 0.09, 0.08, (zb + 0.22 + zb + pf) / 2, 0.18, 0.55, pf - 0.22, cd);
19947
20079
  const nm = 2, mw = (w - cw - 0.18) / nm;
19948
20080
  for (let i = 0; i < nm; i++) K.box("fabric", -w / 2 + 0.18 + (i + 0.5) * mw, 0.34, zb + 0.12 + 0.39, mw - 0.02, 0.16, 0.78, c);
19949
20081
  K.box("fabric", w / 2 - cw / 2, 0.34, 0.035, cw - 0.04, 0.16, d - 0.2, c);
@@ -19962,7 +20094,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19962
20094
  K.box("fabric", 0, 0.55, -d / 2 + 0.5, 0.4, 0.16, 0.12, accent, 0, 0.5);
19963
20095
  const hw = w + 0.5, n = Math.round(hw / 0.11);
19964
20096
  K.box("wood", 0, 0.2, -d / 2 - 0.05, hw, 1, 0.04, shade(wood, 0.7));
19965
- for (let i = 0; i < n; i++) K.box("wood", -hw / 2 + (i + 0.5) * hw / n, 0.25, -d / 2 - 0.02, hw / n - 0.025, 0.95, 0.04, i % 2 ? wood : shade(wood, 1.12));
20097
+ for (let i = 0; i < n; i++) K.box("wood", -hw / 2 + (i + 0.5) * hw / n, 0.25, -d / 2 - 0.02, hw / n - 0.025, M.visorScene ? 0.95 : 0.948, 0.04, i % 2 ? wood : shade(wood, 1.12));
19966
20098
  for (const s of [-1, 1]) {
19967
20099
  K.box("wood", s * (w / 2 + 0.3), 0.35, -d / 2 + 0.22, 0.4, 0.16, 0.36, shade(wood, 1.05));
19968
20100
  K.cyl("plain", s * (w / 2 + 0.3), 0.51, -d / 2 + 0.2, 0.06, 0.03, 15262940);
@@ -19974,8 +20106,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19974
20106
  const K = kit(M, a), { w, d } = K.dim("home_office"), wood = K.wood(13808780), zb = -d / 2;
19975
20107
  K.box("wood", 0, 0.72, 0, w, 0.035, d, wood);
19976
20108
  for (const s of [-1, 1]) K.box("metal", s * (w / 2 - 0.04), 0, 0, 0.035, 0.72, d - 0.1, 2236966);
19977
- K.box("metal", 0, 0.3, zb + 0.05, w - 0.1, 0.03, 0.02, 2236966);
19978
- K.box("plain", w / 2 - 0.25, 0.28, 0, 0.4, 0.44, d - 0.08, 15262940);
20109
+ K.box("metal", 0, 0.3, zb + (M.visorScene ? 0.05 : 0.055), w - (M.visorScene ? 0.1 : 0.11), 0.03, 0.02, 2236966);
20110
+ K.box("plain", w / 2 - 0.25, 0.28, 0, 0.4, M.visorScene ? 0.44 : 0.436, d - 0.08, 15262940);
19979
20111
  for (let i = 0; i < 2; i++) {
19980
20112
  K.box("plain", w / 2 - 0.25, 0.3 + i * 0.2, d / 2 - 0.04, 0.37, 0.18, 0.01, 15920870);
19981
20113
  K.box("metal", w / 2 - 0.25, 0.39 + i * 0.2, d / 2 - 0.03, 0.12, 0.012, 0.012, 10132122);
@@ -19994,10 +20126,11 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19994
20126
  const zc = d / 2 + 0.3, cc = K.fabric(2763310);
19995
20127
  K.box("plain", 0, 0.44, zc, 0.48, 0.07, 0.46, cc);
19996
20128
  K.box("plain", 0, 0.52, zc + 0.22, 0.44, 0.52, 0.07, cc, 0, 0.12);
19997
- K.cyl("metal", 0, 0.06, zc, 0.025, 0.38, 2763306);
20129
+ K.cyl("metal", 0, M.visorScene ? 0.06 : 0.07, zc, 0.025, M.visorScene ? 0.38 : 0.37, 2763306);
19998
20130
  for (let i = 0; i < 5; i++) {
19999
20131
  const an = i * 1.2566, x = Math.cos(an) * 0.17, z = zc + Math.sin(an) * 0.17;
20000
- K.box("metal", Math.cos(an) * 0.085, 0.06, zc + Math.sin(an) * 0.085, 0.18, 0.025, 0.03, 2763306, -an);
20132
+ const lo = M.visorScene ? 0 : i * 15e-4;
20133
+ K.box("metal", Math.cos(an) * 0.085, 0.06 - lo, zc + Math.sin(an) * 0.085, 0.18, 0.025 + 2 * lo, 0.03, 2763306, -an);
20001
20134
  K.cyl("plain", x, 0, z, 0.03, 0.05, 1710618);
20002
20135
  }
20003
20136
  };
@@ -20007,9 +20140,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20007
20140
  K.box("plain", 0, 0, -d / 2 + 0.01, inner, M.visorScene ? h : h - 0.03, 0.02, shade(wood, 0.95));
20008
20141
  for (const s of [-1, 1]) K.box("plain", s * (w / 2 - 0.015), 0, 0, 0.03, h, d, wood);
20009
20142
  K.box("plain", 0, h - 0.03, 0, inner, 0.03, d, wood);
20010
- K.box("plain", 0, 0.06, 0, w - 0.06, 0.02, d - 0.02, wood);
20011
- K.box("plain", 0, 0, 0, w - 0.04, 0.06, d - 0.06, 2763306);
20012
- K.box("plain", dv, 0.06, 0, 0.025, h - 0.09, d - 0.02, wood);
20143
+ K.box("plain", 0, 0.06, M.visorScene ? 0 : 5e-3, w - 0.06, 0.02, M.visorScene ? d - 0.02 : d - 0.03, wood);
20144
+ K.box("plain", 0, 0, 0, M.visorScene ? w - 0.04 : w - 0.06, 0.06, d - 0.06, 2763306);
20145
+ if (M.visorScene) K.box("plain", dv, 0.06, 0, 0.025, h - 0.09, d - 0.02, wood);
20146
+ else K.box("plain", dv, 0.08, 0.01, 0.025, h - 0.11, d - 0.04, wood);
20013
20147
  const rod = h * 0.76;
20014
20148
  K.cyl("metal", (-w / 2 + dv) / 2, rod, 0, 0.012, dv + w / 2 - 0.06, 11580600, 0, Math.PI / 2);
20015
20149
  K.box("plain", (-w / 2 + dv) / 2, rod + 0.05, 0, dv + w / 2 - 0.05, 0.02, d - 0.04, wood);
@@ -20036,7 +20170,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20036
20170
  };
20037
20171
  B.vanity = (M, a) => {
20038
20172
  const K = kit(M, a), { w, d } = K.dim("vanity"), zb = -d / 2, br = 16053488;
20039
- K.cyl("plain", 0, 0, zb + 0.12, 0.08, 0.7, br);
20173
+ K.cyl("plain", 0, M.visorScene ? 0 : 0.03, zb + 0.12, 0.08, M.visorScene ? 0.7 : 0.67, br);
20040
20174
  K.cyl("plain", 0, 0, zb + 0.12, 0.1, 0.03, br);
20041
20175
  K.box("plain", 0, 0.74, 0, w, 0.12, d, br);
20042
20176
  K.box("plain", 0, 0.865, 0.02, w - 0.1, 0.012, d - 0.1, 13949146);
@@ -20047,8 +20181,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20047
20181
  K.box("plain", 0, 1.1, zb + 0.012, 0.52, 0.72, 0.024, K.color("metal", 14999768));
20048
20182
  K.plane("atlas_picture", 0, 1.46, zb + 0.026, 0.46, 0.66, 16777215, 0, 0, 0, atlas("picture").mirror());
20049
20183
  K.box("metal", -w / 2 - 0.02, 0.95, zb + 0.06, 0.03, 0.03, 0.03, 11580600);
20050
- K.box("metal", -w / 2 - 0.02, 0.95, zb + 0.06, 0.28, 0.014, 0.014, 11580600);
20051
- K.box("fabric", -w / 2 - 0.02, 0.62, zb + 0.065, 0.26, 0.34, 0.02, K.accent(3042942));
20184
+ K.box("metal", -w / 2 - 0.02, M.visorScene ? 0.95 : 0.958, zb + 0.06, 0.28, 0.014, 0.014, 11580600);
20185
+ K.box("fabric", -w / 2 - 0.02, 0.62, zb + (M.visorScene ? 0.065 : 0.064), 0.26, 0.34, M.visorScene ? 0.02 : 0.018, K.accent(3042942));
20052
20186
  };
20053
20187
  B.tv_stand = (M, a) => {
20054
20188
  const K = kit(M, a), { w, d } = K.dim("tv_stand"), wood = K.wood(13148272), br = K.color("fabric_main", 15789542);
@@ -20092,7 +20226,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20092
20226
  K.box("plain", w * 0.38, 0, z0 + 0.35, 0.5, 0.4, 0.4, 12098154, 0.2);
20093
20227
  K.box("plain", w * 0.4, 0.4, z0 + 0.33, 0.45, 0.35, 0.38, 11044954, -0.3);
20094
20228
  for (let i = 0; i < 4; i++) {
20095
- K.box("wood", 0, 0.45 + i * 0.3, z0 + 0.62, w + 0.3, 0.14, 0.04, [8017460, 9071172, 7031338, 8018488][i], 0, 0, (i % 2 ? 1 : -1) * (0.06 + K.rnd() * 0.08));
20229
+ K.box("wood", 0, 0.45 + i * 0.3, z0 + 0.62 + (M.visorScene ? 0 : i % 2 * 3e-3), w + 0.3, 0.14, 0.04, [8017460, 9071172, 7031338, 8018488][i], 0, 0, (i % 2 ? 1 : -1) * (0.06 + K.rnd() * 0.08));
20096
20230
  for (const s of [-1, 1]) K.cyl("metal", s * w * 0.4, 0.45 + i * 0.3, z0 + 0.65, 0.012, 0.02, 5921374, Math.PI / 2, 0);
20097
20231
  }
20098
20232
  K.box("wood", -w * 0.4, 0, z0 + 0.9, 0.4, 0.04, 0.4, wood, 0.3, 0, 0.4);
@@ -20151,10 +20285,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20151
20285
  const K = kit(M, a), y = M.y || 0, cs = [13148208, 11549226, 4880954, 14209200, 9058858], rw = [4, 3, 2];
20152
20286
  rw.forEach((n, r) => {
20153
20287
  for (let i = 0; i < n; i++) {
20154
- const x = (i - (n - 1) / 2) * 0.072, c = cs[(i + r * 2) % cs.length];
20155
- K.cyl("plain", x, y + r * 0.1, 0, 0.033, 0.1, c);
20156
- K.cyl("plain", x, y + r * 0.1 + 0.02, 0, 0.0345, 0.055, 15262936);
20157
- K.cyl("metal", x, y + r * 0.1 + 0.1, 0, 0.031, 4e-3, 12106944);
20288
+ const x = (i - (n - 1) / 2) * 0.072, c = cs[(i + r * 2) % cs.length], ry = y + r * (M.visorScene ? 0.1 : 0.104);
20289
+ K.cyl("plain", x, ry, 0, 0.033, 0.1, c);
20290
+ K.cyl("plain", x, ry + 0.02, 0, 0.0345, 0.055, 15262936);
20291
+ K.cyl("metal", x, ry + 0.1, 0, 0.031, 4e-3, 12106944);
20158
20292
  }
20159
20293
  });
20160
20294
  K.cyl("plain", 0.3, y + 0.033, 0.1, 0.033, 0.1, 13148208, 0, Math.PI / 2);
@@ -20173,10 +20307,11 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20173
20307
  const K = kit(M, a), { w, d } = K.dim("floor_mattress"), h = 0.17, c = K.fabric(13156528), ac = K.accent(6965818);
20174
20308
  K.box("fabric", 0, 0, 0, w, h, d, c);
20175
20309
  for (let i = 0; i < 4; i++) K.box("fabric", -w / 2 + (i + 0.5) * w / 4, h, 0, w / 8, 3e-3, d - 0.04, shade(c, 0.86));
20176
- K.box("fabric", 0, h, -d / 2 + 0.28, w * 0.7, 0.1, 0.38, 15789280, 0.05);
20177
- K.box("fabric", 0.03, h, 0.3, w * 0.95, 0.05, d * 0.55, ac, 0.05);
20178
- K.box("fabric", 0.15, h + 0.05, 0, w * 0.5, 0.05, 0.4, shade(ac, 1.2), 0.3);
20179
- K.box("fabric", -0.2, h + 0.05, 0.5, w * 0.3, 0.06, 0.3, shade(ac, 0.8), -0.4);
20310
+ const v = M.visorScene ? 0 : 1;
20311
+ K.box("fabric", 0, h - v * 2e-3, -d / 2 + 0.28, w * 0.7, 0.1 + v * 2e-3, 0.38, 15789280, 0.05);
20312
+ K.box("fabric", 0.03, h - v * 4e-3, 0.3, w * 0.95, 0.05 + v * 4e-3, d * 0.55, ac, 0.05);
20313
+ K.box("fabric", 0.15, h + 0.05 - v * 2e-3, 0, w * 0.5, 0.05, 0.4, shade(ac, 1.2), 0.3);
20314
+ K.box("fabric", -0.2, h + 0.05 - v * 4e-3, 0.5, w * 0.3, 0.06 + v * 4e-3, 0.3, shade(ac, 0.8), -0.4);
20180
20315
  };
20181
20316
  B.lantern = (M, a) => {
20182
20317
  const K = kit(M, a), y = M.y || 0;
@@ -20195,7 +20330,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20195
20330
  K.cyl("plain", x, y + 0.012, z, 0.017, h, 15787720);
20196
20331
  K.cyl("emissive", x, y + 0.012 + h, z, 8e-3, 0.03, i % 2 ? 16760928 : 16767120, 0, 0, "sphere");
20197
20332
  });
20198
- K.cyl("plain", 0.02, y + 0.012, 0, 0.05, 8e-3, 15787720);
20333
+ K.cyl("plain", 0.02, y + (M.visorScene ? 0.012 : 0.01), 0, 0.05, M.visorScene ? 8e-3 : 0.01, 15787720);
20199
20334
  if (M.lit !== false) K.light(0, y + 0.22, 0, 16756832, 5, "candles");
20200
20335
  };
20201
20336
  B.open_suitcases = (M, a) => {
@@ -20204,7 +20339,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20204
20339
  const lx = x, hz2 = z - dd / 2;
20205
20340
  K.box("plain", lx, 0, z, ww, 0.16, dd, c, ry);
20206
20341
  K.box("fabric", lx, 0.12, z, ww - 0.06, 0.05, dd - 0.06, 14209216, ry);
20207
- for (let i = 0; i < 5; i++) K.box("fabric", lx + (K.rnd() - 0.5) * (ww - 0.2), 0.16, z + (K.rnd() - 0.5) * (dd - 0.2), 0.14 + K.rnd() * 0.1, 0.04 + K.rnd() * 0.04, 0.12 + K.rnd() * 0.1, rs[i % 4], K.rnd() * 3);
20342
+ for (let i = 0; i < 5; i++) K.box("fabric", lx + (K.rnd() - 0.5) * (ww - 0.2), M.visorScene ? 0.16 : 0.16 - i * 15e-4, z + (K.rnd() - 0.5) * (dd - 0.2), 0.14 + K.rnd() * 0.1, 0.04 + K.rnd() * 0.04, 0.12 + K.rnd() * 0.1, rs[i % 4], K.rnd() * 3);
20208
20343
  K.ramp("plain", lx, 0.16, hz2, ww, 0.07, dd, c, al);
20209
20344
  K.box("metal", lx + ww * 0.3, 0.1, z + dd / 2, 0.04, 0.03, 0.01, 12632256);
20210
20345
  };
@@ -20213,18 +20348,31 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20213
20348
  };
20214
20349
  B.clothes_on_floor = (M, a) => {
20215
20350
  const K = kit(M, a), { w, d } = K.dim("clothes_on_floor"), cs = [13156520, 4876938, 11028538, 14736592, 6982234, 2763312, K.accent(13146698)];
20351
+ let k = 0;
20352
+ const tops = [];
20353
+ const lay = (m, x, y, z, bw, h, bd, c, r) => {
20354
+ if (M.visorScene) {
20355
+ K.box(m, x, y, z, bw, h, bd, c, r);
20356
+ return;
20357
+ }
20358
+ const y0 = 4e-3 + k++ * 15e-4;
20359
+ let top = y0 + h;
20360
+ while (tops.some((t) => Math.abs(t - top) < 13e-4)) top += 13e-4;
20361
+ tops.push(top);
20362
+ K.box(m, x, y0, z, bw, top - y0, bd, c, r);
20363
+ };
20216
20364
  for (let i = 0; i < 9; i++) {
20217
20365
  const x = (K.rnd() - 0.5) * (w - 0.3), z = (K.rnd() - 0.5) * (d - 0.3), r = K.rnd() * 6, c = cs[i % cs.length], y = 0.012 + i * 3e-3;
20218
20366
  if (i % 3 === 0) {
20219
- K.box("fabric", x, y, z, 0.3, 0.012, 0.36, c, r);
20220
- for (const s of [-1, 1]) K.box("fabric", x + Math.cos(r) * s * 0.2, y, z - Math.sin(r) * s * 0.2, 0.2, 0.012, 0.09, shade(c, 0.9), r + s * 0.5);
20367
+ lay("fabric", x, y, z, 0.3, 0.012, 0.36, c, r);
20368
+ for (const s of [-1, 1]) lay("fabric", x + Math.cos(r) * s * 0.2, y, z - Math.sin(r) * s * 0.2, 0.2, 0.012, 0.09, shade(c, 0.9), r + s * 0.5);
20221
20369
  } else if (i % 3 === 1) {
20222
- for (const s of [-1, 1]) K.box("fabric", x + s * 0.06, y, z, 0.13, 0.014, 0.5, 3820138, r + s * 0.15);
20223
- } else K.box("fabric", x, y, z, 0.14, 0.01, 0.07, c, r);
20370
+ for (const s of [-1, 1]) lay("fabric", x + s * 0.06, y, z, 0.13, 0.014, 0.5, 3820138, r + s * 0.15);
20371
+ } else lay("fabric", x, y, z, 0.14, 0.01, 0.07, c, r);
20224
20372
  }
20225
20373
  const sx = (K.rnd() - 0.5) * (w - 0.4), sz = (K.rnd() - 0.5) * (d - 0.4);
20226
- K.box("plain", sx, 0.012, sz, 0.09, 0.07, 0.27, 2763306, 0.4);
20227
- K.box("plain", sx + 0.15, 0.012, sz + 0.05, 0.09, 0.07, 0.27, 2763306, 0.9);
20374
+ lay("plain", sx, 0.012, sz, 0.09, 0.07, 0.27, 2763306, 0.4);
20375
+ lay("plain", sx + 0.15, 0.012, sz + 0.05, 0.09, 0.07, 0.27, 2763306, 0.9);
20228
20376
  };
20229
20377
  B.fallen_chair = (M, a) => {
20230
20378
  const g = Math.PI / 2, dy = 0.23, api = { box: (Mm, mat, x, y, z, w, h, d, color2, ry, rx, rz) => {
@@ -20238,17 +20386,30 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20238
20386
  };
20239
20387
  B.blood_stains = (M, a) => {
20240
20388
  const K = kit(M, a), { w, d } = K.dim("blood_stains");
20241
- for (let k = 0; k < 7; k++) K.cyl("plain", (K.rnd() - 0.5) * w * 0.3, 0.012 + k * 4e-4, (K.rnd() - 0.5) * d * 0.3, 0.12 + K.rnd() * 0.18, 3e-3, k < 2 ? 3803142 : 5902348);
20389
+ let n = 0;
20390
+ const film = () => {
20391
+ const y0 = 0.011 - n * 11e-4, y1 = 0.0125 + n * 11e-4;
20392
+ n++;
20393
+ return { y: y0, h: y1 - y0 };
20394
+ };
20395
+ for (let k = 0; k < 7; k++) {
20396
+ const f = film();
20397
+ K.cyl("plain", (K.rnd() - 0.5) * w * 0.3 + n * 4e-3, f.y, (K.rnd() - 0.5) * d * 0.3, 0.12 + K.rnd() * 0.18 + n * 13e-4, f.h, k < 2 ? 3803142 : 5902348);
20398
+ }
20242
20399
  for (let k = 0; k < 8; k++) {
20243
- const an = K.rnd() * 6.28, r = 0.3 + K.rnd() * Math.min(w, d) * 0.4;
20244
- K.cyl("plain", Math.cos(an) * r, 0.013 + k * 2e-4, Math.sin(an) * r, 0.02 + K.rnd() * 0.05, 3e-3, 4852232);
20400
+ const an = K.rnd() * 6.28, r = 0.3 + K.rnd() * Math.min(w, d) * 0.4, f = film();
20401
+ K.cyl("plain", Math.cos(an) * r, f.y, Math.sin(an) * r, 0.02 + K.rnd() * 0.05 + n * 13e-4, f.h, 4852232);
20402
+ }
20403
+ if (M.drag !== false) for (let k = 1; k < 6; k++) {
20404
+ const f = film();
20405
+ K.box("plain", 0.3 + k * 0.1, f.y, 0.15 + k * 0.17, 0.16 - k * 0.015, f.h, 0.2, 4852746, 0.5);
20245
20406
  }
20246
- if (M.drag !== false) for (let k = 1; k < 6; k++) K.box("plain", 0.3 + k * 0.1, 0.012, 0.15 + k * 0.17, 0.16 - k * 0.015, 3e-3, 0.2, 4852746, 0.5);
20247
20407
  };
20248
20408
  B.open_door = (M, a) => {
20249
20409
  const K = kit(M, a), { w, d, h } = K.dim("open_door"), wood = K.wood(6965804), angle = M.angle != null ? M.angle : 1.2, L = w - 0.06, hx = -w / 2 + 0.03;
20250
- K.box("wood", -w / 2 - 0.03, 0, 0, 0.06, h + 0.06, d, shade(wood, 0.8));
20251
- K.box("wood", w / 2 + 0.03, 0, 0, 0.06, h + 0.06, d, shade(wood, 0.8));
20410
+ const jh = M.visorScene ? h + 0.06 : h;
20411
+ K.box("wood", -w / 2 - 0.03, 0, 0, 0.06, jh, d, shade(wood, 0.8));
20412
+ K.box("wood", w / 2 + 0.03, 0, 0, 0.06, jh, d, shade(wood, 0.8));
20252
20413
  K.box("wood", 0, h, 0, w + 0.12, 0.06, d, shade(wood, 0.8));
20253
20414
  K.box("wood", hx + Math.cos(angle) * L / 2, 0, Math.sin(angle) * L / 2, L, h - 0.02, 0.04, wood, -angle);
20254
20415
  K.cyl("metal", hx + Math.cos(angle) * (L - 0.08), 1, Math.sin(angle) * (L - 0.08) + 0.04, 0.025, 0.06, 13152368, Math.PI / 2, 0);
@@ -20368,9 +20529,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20368
20529
  for (const s of [-1, 1]) K.box("plain", s * (w / 2 + t / 2), 0, 0, t, 0.1, d, bo);
20369
20530
  cover(a, M, "pool_tile", { w, d, y: 0.035, size: 1 });
20370
20531
  K.plane("water", 0, 0.075, 0, w, d, 9426158, 0, -Math.PI / 2, 0);
20371
- for (let i = 0; i < 3; i++) K.box("plain", w / 2 - 0.35 + i * 0, 0.035 + i * 0.01, d / 2 - 0.2 - i * 0.28, 0.7 - i * 0.05, 0.03, 0.26, 14675698);
20532
+ for (let i = 0; i < 3; i++) K.box("plain", w / 2 - 0.35 + i * 0, 0.035 + i * 0.01 - (M.visorScene || i !== 1 ? 0 : 2e-3), d / 2 - 0.2 - i * 0.28, 0.7 - i * 0.05, 0.03, 0.26, 14675698);
20372
20533
  for (const s of [-1, 1]) {
20373
- K.box("metal", -w / 4 + s * 0.2, 0, d / 2 + t * 0.6, 0.03, 0.85, 0.03, 13159632);
20534
+ K.box("metal", -w / 4 + s * 0.2, M.visorScene ? 0 : 2e-3, d / 2 + t * 0.6, 0.03, M.visorScene ? 0.85 : 0.848, 0.03, 13159632);
20374
20535
  K.box("metal", -w / 4 + s * 0.2, 0.85, d / 2 + t * 0.6 - 0.1, 0.03, 0.03, 0.22, 13159632);
20375
20536
  K.box("metal", -w / 4 + s * 0.2, 0, d / 2 - 0.25, 0.03, 0.88, 0.03, 13159632, 0, 0);
20376
20537
  }
@@ -20380,20 +20541,22 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20380
20541
  const K = kit(M, a), { w, d } = K.dim("deck"), h = 0.2, wood = K.wood(6965808);
20381
20542
  K.box("wood", 0, 0, 0, w - 0.05, h, d - 0.05, shade(wood, 0.7));
20382
20543
  cover(a, M, "deck_floor", { w, d, y: h + 0.012, size: 1.2, color: M.color });
20383
- for (const [x, z, ww, dd] of [[0, -d / 2, w, 0.05], [0, d / 2, w, 0.05], [-w / 2, 0, 0.05, d], [w / 2, 0, 0.05, d]]) K.box("wood", x, 0, z, ww, h + 0.02, dd, wood);
20384
- K.box("wood", 0, 0, d / 2 + 0.17, 1.4, 0.1, 0.34, wood);
20385
- K.box("wood", 0, 0.1, d / 2 + 0.17, 1.4, 0.012, 0.34, shade(wood, 1.2));
20544
+ for (const [x, z, ww, dd] of [[0, -d / 2, w, 0.05], [0, d / 2, w, 0.05], [-w / 2, 0, 0.05, d], [w / 2, 0, 0.05, d]]) K.box("wood", x, 0, z, ww, h + 0.02, M.visorScene || dd !== d ? dd : d - 0.05, wood);
20545
+ const sz = M.visorScene ? d / 2 + 0.17 : d / 2 + 0.025 + 0.1575, sd = M.visorScene ? 0.34 : 0.315;
20546
+ K.box("wood", 0, 0, sz, 1.4, 0.1, sd, wood);
20547
+ K.box("wood", 0, 0.1, sz, 1.4, 0.012, sd, shade(wood, 1.2));
20386
20548
  };
20387
20549
  B.sun_lounger = (M, a) => {
20388
20550
  const K = kit(M, a), { w } = K.dim("sun_lounger"), fr = K.metal(15263972), al = 0.95, cu = K.fabric(3828378), stripe = K.accent(15789280);
20389
20551
  for (const s of [-1, 1]) {
20390
20552
  K.box("metal", s * (w / 2 - 0.03), 0.17, -0.3, 0.035, 0.035, 1.35, fr);
20391
- K.box("metal", s * (w / 2 - 0.03), 0, 0.95, 0.035, 0.2, 0.035, fr);
20392
- K.box("metal", s * (w / 2 - 0.03), 0, -0.3, 0.035, 0.2, 0.035, fr);
20553
+ const lw = M.visorScene ? 0.035 : 0.025;
20554
+ K.box("metal", s * (w / 2 - 0.03), 0, 0.95, lw, 0.2, 0.035, fr);
20555
+ K.box("metal", s * (w / 2 - 0.03), 0, -0.3, lw, 0.2, 0.035, fr);
20393
20556
  K.cyl("plain", s * (w / 2 - 0.03), 0.07, -0.3, 0.07, 0.03, 2763306, 0, Math.PI / 2);
20394
20557
  }
20395
20558
  K.box("fabric", 0, 0.21, 0.35, w - 0.1, 0.06, 1.3, cu);
20396
- K.ramp("fabric", 0, 0.2, -0.3, w - 0.1, 0.06, 0.8, cu, al);
20559
+ K.ramp("fabric", 0, 0.2, -0.3, M.visorScene ? w - 0.1 : w - 0.104, 0.06, 0.8, cu, al);
20397
20560
  for (let i = 0; i < 4; i++) {
20398
20561
  K.box("fabric", 0, M.visorScene ? 0.265 : 0.268, 0 + i * 0.3, M.visorScene ? w - 0.098 : w - 0.096, 4e-3, 0.08, stripe);
20399
20562
  }
@@ -20469,7 +20632,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20469
20632
  for (const s of [-1, 1]) {
20470
20633
  K.box("plain", s * 0.35, py + 0.05, pz, 0.04, 0.42, 0.74, az);
20471
20634
  }
20472
- K.box("plain", 0, py + 0.05, pz - 0.35, 0.74, 0.42, 0.04, az);
20635
+ K.box("plain", 0, py + 0.05, pz - 0.35, M.visorScene ? 0.74 : 0.66, 0.42, 0.04, az);
20473
20636
  const run = d / 2 - pz - 0.4, al = Math.atan2(py - 0.1, run);
20474
20637
  K.ramp("plain", 0, py, pz + 0.37, 0.5, 0.04, Math.hypot(run, py - 0.1) + 0.1, 14209216, -al + 0 + 0);
20475
20638
  for (const s of [-1, 1]) K.ramp("plain", s * 0.27, py + 0.03, pz + 0.37, 0.04, 0.12, Math.hypot(run, py - 0.1) + 0.1, az, -al);
@@ -20479,7 +20642,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20479
20642
  };
20480
20643
  B.swing = (M, a) => {
20481
20644
  const K = kit(M, a), { w, d, h } = K.dim("swing"), mt = K.color("metal", 3828400), L = Math.hypot(h, d / 2), an = Math.atan2(d / 2, h);
20482
- for (const sx of [-1, 1]) for (const sz of [-1, 1]) K.box("metal", sx * w / 2, h / 2 - L / 2 + 0, sz * d / 4, 0.07, L, 0.07, mt, 0, -sz * an, 0);
20645
+ for (const sx of [-1, 1]) for (const sz of [-1, 1]) K.box("metal", sx * w / 2, h / 2 - L / 2 + 0, sz * d / 4, M.visorScene || sz < 0 ? 0.07 : 0.066, L, 0.07, mt, 0, -sz * an, 0);
20483
20646
  K.box("metal", 0, h - 0.04, 0, w + 0.1, 0.1, 0.1, shade(mt, 0.85));
20484
20647
  const cs = [K.accent(13123642), 2763306];
20485
20648
  for (let i = 0; i < 2; i++) {
@@ -20491,11 +20654,11 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20491
20654
  B.bbq_simple = (M, a) => {
20492
20655
  const K = kit(M, a), { w, d } = K.dim("bbq_simple"), br = K.color("exterior_floor", 11688512), hb = 0.78;
20493
20656
  K.box("plain", 0, 0, 0, w, 0.45, d, br);
20494
- for (const [x, z, ww, dd] of [[0, -d / 2 + 0.06, w, 0.12], [0, d / 2 - 0.06, w, 0.12], [-w / 2 + 0.06, 0, 0.12, d - 0.2], [w / 2 - 0.06, 0, 0.12, d - 0.2]]) K.box("plain", x, 0.45, z, ww, hb - 0.45, dd, br);
20495
- K.box("plain", 0, 0.45, 0, w - 0.22, 0.04, d - 0.22, 2762276);
20657
+ for (const [x, z, ww, dd] of [[0, -d / 2 + 0.06, w, 0.12], [0, d / 2 - 0.06, w, 0.12], [-w / 2 + 0.06, 0, 0.12, d - 0.2], [w / 2 - 0.06, 0, 0.12, d - 0.2]]) K.box("plain", x, 0.45, z, ww, hb - 0.45, M.visorScene || dd !== d - 0.2 ? dd : d - 0.24, br);
20658
+ K.box("plain", 0, 0.45, 0, w - (M.visorScene ? 0.22 : 0.24), 0.04, d - (M.visorScene ? 0.22 : 0.24), 2762276);
20496
20659
  for (let i = 0; i < 10; i++) K.box("plain", (K.rnd() - 0.5) * (w - 0.3), M.visorScene ? 0.49 : 0.49 + i * 22e-4, (K.rnd() - 0.5) * (d - 0.3), 0.08, 0.02, 0.07, i % 3 ? 13126170 : 3811876, K.rnd() * 3);
20497
20660
  for (let i = 0; i < 7; i++) K.box("metal", -w / 2 + 0.16 + i * (w - 0.32) / 6, hb + 0.01, 0, 0.012, 0.012, d - 0.1, 5921374);
20498
- K.box("metal", 0, hb + 0.01, -d / 2 + 0.2, w - 0.1, 0.012, 0.02, 5921374);
20661
+ K.box("metal", 0, hb + (M.visorScene ? 0.01 : 8e-3), -d / 2 + 0.2, w - 0.1, M.visorScene ? 0.012 : 0.016, 0.02, 5921374);
20499
20662
  for (let i = 0; i < 3; i++) {
20500
20663
  const z = (i - 1) * 0.15;
20501
20664
  K.cyl("metal", 0, hb + 0.05, z, 6e-3, w + 0.12, 11580600, 0, Math.PI / 2);
@@ -20511,7 +20674,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20511
20674
  const cz = -0.35;
20512
20675
  for (const sx of [-1, 1]) for (const sz of [-1, 1]) K.box("plain", sx * (w / 2 - 0.1), 0.76, cz + sz * 0.8, 0.07, 0.5, 0.07, shade(c, 0.9));
20513
20676
  K.box("plain", 0, 1.26, cz, w - 0.1, 0.05, 1.75, shade(c, 1.04));
20514
- K.box("glass", 0, 0.76, cz, w - 0.06, 0.5, 1.6, 16777215);
20677
+ K.box("glass", 0, M.visorScene ? 0.76 : 0.762, cz, w - 0.06, M.visorScene ? 0.5 : 0.496, 1.6, 16777215);
20515
20678
  K.box("glass", 0, 0.76, cz + 0.8, w - 0.12, 0.5, 0.04, 16777215, 0, 0.5);
20516
20679
  for (const s of [-1, 1]) {
20517
20680
  K.box("plain", s * 0.4, 0.55, cz + 0.4, 0.4, 0.3, 0.4, 2763310);
@@ -20537,10 +20700,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20537
20700
  K.box("plain", xa, 0, zc, 1.6, 0.85, 0.7, br);
20538
20701
  for (let i = 1; i < 4; i++) K.box("plain", xa, i * 0.2, zc + 0.351, 1.6, 0.012, 4e-3, shade(br, 0.7));
20539
20702
  K.box("plain", xa, 0.12, zc + (M.visorScene ? 0.352 : 0.355), 0.7, 0.4, 4e-3, 1709586);
20540
- for (const [x, z, ww, dd] of [[xa, zc - 0.25, 1.6, 0.2], [xa, zc + 0.3, 1.6, 0.1], [xa - 0.75, zc, 0.1, 0.7], [xa + 0.75, zc, 0.1, 0.7]]) K.box("plain", x, 0.85, z, ww, 0.12, dd, br);
20541
- K.box("plain", xa, 0.85, zc + 0.02, 1.4, 0.025, 0.4, 2762276);
20542
- for (let i = 0; i < 8; i++) K.box("metal", xa - 0.62 + i * 0.18, 0.97, zc + 0.02, 0.012, 0.012, 0.4, 5921374);
20543
- for (let i = 0; i < 6; i++) K.box("plain", xa + (K.rnd() - 0.5) * 1.2, M.visorScene ? 0.88 : 0.88 + i * 22e-4, zc + (K.rnd() - 0.5) * 0.3, 0.1, 0.02, 0.08, i % 2 ? 13126170 : 3811876, K.rnd() * 3);
20703
+ const sd = M.visorScene ? 0.7 : 0.4, sz = M.visorScene ? zc : zc + 0.05;
20704
+ for (const [x, z, ww, dd] of [[xa, zc - 0.25, 1.6, 0.2], [xa, zc + 0.3, 1.6, 0.1], [xa - 0.75, sz, 0.1, sd], [xa + 0.75, sz, 0.1, sd]]) K.box("plain", x, 0.85, z, ww, 0.12, dd, br);
20705
+ K.box("plain", xa, M.visorScene ? 0.85 : 0.852, zc + 0.02, 1.4, 0.025, 0.4, 2762276);
20544
20706
  K.box("plain", xa, 1.5, zc - 0.07, 1.5, 0.4, 0.56, br);
20545
20707
  K.box("plain", xa, 1.5, zc + 0.215, 1.5, 0.4, 0.01, 1709586);
20546
20708
  K.box("plain", xa, 1.9, zc - 0.12, 0.62, 1, 0.46, br);
@@ -20548,9 +20710,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20548
20710
  K.box("plain", xa, 2.98, zc - 0.12, 0.5, 0.06, 0.4, shade(br, 0.75));
20549
20711
  K.box("plain", xb, 0, zc, 1.44, 0.85, 0.7, cab);
20550
20712
  for (let i = 0; i < 3; i++) K.box("wood", xb - 0.48 + i * 0.48, 0.08, zc + 0.355, 0.44, 0.7, 0.012, wood);
20551
- K.box("plain", (xb + xc) / 2, 0.85, zc, 0.72 * 2 + 0.65 + 0.04, 0.04, 0.74, gr);
20713
+ const ct0 = M.visorScene ? xb - 0.74 : xa + 0.802, ct1 = xc + 0.67;
20714
+ K.box("plain", M.visorScene ? (xb + xc) / 2 : (ct0 + ct1) / 2, 0.85, zc, M.visorScene ? 0.72 * 2 + 0.65 + 0.04 : ct1 - ct0, 0.04, 0.74, gr);
20552
20715
  K.box("metal", xb, 0.89, zc, 0.5, 0.01, 0.38, 11580600);
20553
- K.box("metal", xb, M.visorScene ? 0.895 : 0.891, zc, 0.44, 6e-3, 0.32, 7370362);
20716
+ K.box("metal", xb, M.visorScene ? 0.895 : 0.893, zc, 0.44, M.visorScene ? 6e-3 : 4e-3, 0.32, 7370362);
20554
20717
  K.box("plain", xc, 0, zc, 1.3, 0.85, 0.7, cab);
20555
20718
  for (let i = 0; i < 2; i++) K.box("wood", xc - 0.32 + i * 0.64, 0.08, zc + 0.355, 0.6, 0.7, 0.012, wood);
20556
20719
  K.cyl("plain", xc, 0.89, zc, 0.1, 0.05, 15790314);
@@ -20573,7 +20736,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20573
20736
  const K = kit(M, a), { w, d, h } = K.dim("sauna"), t = 0.08, wood = K.wood(12618324), shade1 = shade(wood, 0.88), dw = 0.7, dx = w / 2 - 0.55;
20574
20737
  K.box("wood", 0, 0, 0, w, 0.05, d, shade(wood, 0.75));
20575
20738
  K.box("wood", 0, 0.05, -d / 2 + t / 2, w, h - 0.11, t, wood);
20576
- for (const s of [-1, 1]) K.box("wood", s * (w / 2 - t / 2), 0.05, 0, t, h - 0.11, d - 2 * t * 0, wood);
20739
+ for (const s of [-1, 1]) K.box("wood", s * (w / 2 - t / 2), 0.05, 0, t, h - 0.11, M.visorScene ? d : d - 2 * t, wood);
20577
20740
  K.box("wood", 0, h - 0.06, 0, w + 0.12, 0.06, d + 0.12, shade(wood, 0.75));
20578
20741
  const lx0 = -w / 2, lx1 = dx - dw / 2;
20579
20742
  K.box("wood", (lx0 + lx1) / 2, 0.05, d / 2 - t / 2, lx1 - lx0, h - 0.11, t, wood);
@@ -20584,8 +20747,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20584
20747
  K.box("wood", x, 0.05, d / 2 + 3e-3, 0.012, h - 0.11, 5e-3, shade(wood, 0.6));
20585
20748
  }
20586
20749
  const jamb = M.visorScene ? 0.025 : 0;
20587
- K.box("wood", dx - dw / 2 - jamb, 0.05, d / 2 - 0.02, 0.05, 1.82, 0.06, shade1);
20588
- K.box("wood", dx + dw / 2 + jamb, 0.05, d / 2 - 0.02, 0.05, 1.82, 0.06, shade1);
20750
+ const jy = M.visorScene ? 0.05 : 0.048;
20751
+ K.box("wood", dx - dw / 2 - jamb, jy, d / 2 - 0.02, 0.05, 1.87 - jy, 0.06, shade1);
20752
+ K.box("wood", dx + dw / 2 + jamb, jy, d / 2 - 0.02, 0.05, 1.87 - jy, 0.06, shade1);
20589
20753
  K.box("glass", dx, 0.06, d / 2 - 0.02, dw, 1.75, 0.02, 16777215);
20590
20754
  K.box("metal", dx - dw / 2 + 0.08, 0.7, d / 2 + 0.03, 0.02, 0.5, 0.03, 13159632);
20591
20755
  K.box("wood", 0, 0.85, -d / 2 + t + 0.25, w - 2 * t, 0.05, 0.5, shade(wood, 1.1));
@@ -21010,7 +21174,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21010
21174
  box: (M, material, x, y, z, w, h, d, color2, ry, rx, rz) => void primitives.push({ kind: "box", M, material, x, y, z, w, h, d, color: color2, ry, rx, rz }),
21011
21175
  cylinder: (M, material, x, y, z, r, h, color2, rx, rz, shape) => void primitives.push({ kind: "cylinder", M, material, x, y, z, r, h, color: color2, rx, rz, shape }),
21012
21176
  leaf: (M, x, y, z, w, h, color2, ry, rx) => void primitives.push({ kind: "leaf", M, x, y, z, w, h, color: color2, ry, rx }),
21013
- plane: (M, material, x, y, z, w, h, color2, ry, rx, rz, uv) => void primitives.push({ kind: "plane", M, material, x, y, z, w, h, color: color2, ry, rx, rz, uv })
21177
+ plane: (M, material, x, y, z, w, h, color2, ry, rx, rz, uv) => void primitives.push({ kind: "plane", M, material, x, y, z, w, h, color: color2, ry, rx, rz, uv }),
21178
+ lathe: (M, material, x, y, z, points, color2) => void primitives.push({ kind: "lathe", M, material, x, y, z, points, color: color2 })
21014
21179
  };
21015
21180
  if (options.light !== false) {
21016
21181
  api.light = (M, x, y, z, color2, range3, lightKind) => void primitives.push({ kind: "light", M, x, y, z, color: color2, range: range3, lightKind });
@@ -21079,6 +21244,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21079
21244
  list2.push({ kind: "cylinder", radiusTop: 1, radiusBottom: 1, height: 1, radialSegments: cyl, ...place });
21080
21245
  }
21081
21246
  },
21247
+ lathe(M, material, x, y, z, points, color2) {
21248
+ into(M).push({ kind: "lathe", material, color: color2, position: [x, y, z], points: points.map(([r, py]) => [r, py]), segments: cyl });
21249
+ },
21082
21250
  leaf(M, x, y, z, w, h, color2, ry, rx) {
21083
21251
  into(M).push({ kind: "mesh", ...LEAF, material: "plant", color: color2, position: [x, y, z], rotation: [rx, ry, 0], rotationOrder: "YXZ", scale: [w, h, 1] });
21084
21252
  },
@@ -21331,9 +21499,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21331
21499
  /** `a + b * s` */
21332
21500
  madd: (a, b, s) => [a[0] + b[0] * s, a[1] + b[1] * s, a[2] + b[2] * s]
21333
21501
  };
21334
- var IDENTITY = [0, 0, 0, 1];
21502
+ var IDENTITY2 = [0, 0, 0, 1];
21335
21503
  var quat = {
21336
- identity: () => [IDENTITY[0], IDENTITY[1], IDENTITY[2], IDENTITY[3]],
21504
+ identity: () => [IDENTITY2[0], IDENTITY2[1], IDENTITY2[2], IDENTITY2[3]],
21337
21505
  /** Hamilton product `a * b` (apply `b` first, then `a`). */
21338
21506
  mul: (a, b) => [
21339
21507
  a[3] * b[0] + a[0] * b[3] + a[1] * b[2] - a[2] * b[1],
@@ -21380,7 +21548,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21380
21548
  return quat.normalize(q);
21381
21549
  }
21382
21550
  };
21383
- var quatFromEuler = (x, y, z) => {
21551
+ var quatFromEuler2 = (x, y, z) => {
21384
21552
  const c1 = Math.cos(x / 2), c2 = Math.cos(y / 2), c3 = Math.cos(z / 2);
21385
21553
  const s1 = Math.sin(x / 2), s2 = Math.sin(y / 2), s3 = Math.sin(z / 2);
21386
21554
  return [s1 * c2 * c3 + c1 * s2 * s3, c1 * s2 * c3 - s1 * c2 * s3, c1 * c2 * s3 + s1 * s2 * c3, c1 * c2 * c3 - s1 * s2 * s3];
@@ -21706,6 +21874,33 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21706
21874
  return out;
21707
21875
  };
21708
21876
  var granules = (inp, box5, count) => bsp(box5, count, [0, 1, 2], inp.rnd).map((b) => ({ center: b.c, size: b.s, q: quat.identity(), shape: "chunk", weight: b.s[0] * b.s[1] * b.s[2] }));
21877
+ var SLAB_MIN = 0.03;
21878
+ var splitAtHit = (root, hit, axes, count, rnd2) => {
21879
+ let pieces = [root];
21880
+ for (const ax of axes) {
21881
+ const half = root.s[ax] / 2;
21882
+ if (hit[ax] - -half < SLAB_MIN || half - hit[ax] < SLAB_MIN) continue;
21883
+ const next = [];
21884
+ for (const b of pieces) {
21885
+ const lo = b.c[ax] - b.s[ax] / 2;
21886
+ const hi = b.c[ax] + b.s[ax] / 2;
21887
+ for (const [from, to] of [[lo, hit[ax]], [hit[ax], hi]]) {
21888
+ const c = [b.c[0], b.c[1], b.c[2]];
21889
+ const s = [b.s[0], b.s[1], b.s[2]];
21890
+ c[ax] = (from + to) / 2;
21891
+ s[ax] = to - from;
21892
+ next.push({ c, s });
21893
+ }
21894
+ }
21895
+ pieces = next;
21896
+ }
21897
+ while (pieces.length < count) {
21898
+ pieces.sort((a, b) => b.s[axes[0]] * b.s[axes[1]] - a.s[axes[0]] * a.s[axes[1]]);
21899
+ const [big, ...rest2] = pieces;
21900
+ pieces = [...bsp(big, 2, axes, rnd2), ...rest2];
21901
+ }
21902
+ return pieces;
21903
+ };
21709
21904
  var CRUMBS = 6;
21710
21905
  var severAt = (inp, root, at4, gap) => {
21711
21906
  const dims = root.s;
@@ -21768,7 +21963,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21768
21963
  if (inp.cut) return severAt(inp, root, inp.cut.at, inp.cut.gap);
21769
21964
  if (inp.form === "plies") return plyBreak(inp, root, maxFragments);
21770
21965
  const n2 = Math.min(maxFragments, 2 + Math.floor(rnd2() * 3));
21771
- for (const b of bsp(root, n2, [0, 1, 2], rnd2)) out.push({ center: b.c, size: b.s, q: idq, shape: "slab", weight: b.s[0] * b.s[1] * b.s[2] });
21966
+ const slabs = inp.form === "granules" && dims[t] < Math.min(dims[u], dims[v]) / 4 ? splitAtHit(root, inp.hit, [u, v], n2, rnd2) : bsp(root, n2, [0, 1, 2], rnd2);
21967
+ for (const b of slabs) out.push({ center: b.c, size: b.s, q: idq, shape: "slab", weight: b.s[0] * b.s[1] * b.s[2] });
21772
21968
  if (inp.form !== "granules") return out;
21773
21969
  const crumbs = Math.min(CRUMBS, maxFragments - out.length);
21774
21970
  if (crumbs <= 0) return out;
@@ -22354,7 +22550,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
22354
22550
  var bendGeometry = (part) => {
22355
22551
  const dims = shapeDims(part.shape);
22356
22552
  const member = isMember(dims, part.structure?.role);
22357
- const q = quatFromEuler(...part.rotation ?? [0, 0, 0]);
22553
+ const q = quatFromEuler2(...part.rotation ?? [0, 0, 0]);
22358
22554
  const up = rotateVec(quat.conjugate(q), [0, 1, 0]);
22359
22555
  let spanAxes;
22360
22556
  let depthAxes;
@@ -24632,7 +24828,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24632
24828
  return Math.max(1e-4, Math.min(part.thickness ?? min2 * (part.fill ?? 1), min2));
24633
24829
  };
24634
24830
  var inferJoints = (parts2, tolerance = 0.01, materials = MATERIAL_MAP) => {
24635
- const boxes = parts2.map((p) => aabbOf(p.shape, p.position, quatFromEuler(...p.rotation ?? [0, 0, 0])));
24831
+ const boxes = parts2.map((p) => aabbOf(p.shape, p.position, quatFromEuler2(...p.rotation ?? [0, 0, 0])));
24636
24832
  const out = [];
24637
24833
  for (let i = 0; i < parts2.length; i++) {
24638
24834
  for (let j = i + 1; j < parts2.length; j++) {
@@ -24742,7 +24938,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24742
24938
  if (st && (GONE.has(st.status) || st.group !== 0)) continue;
24743
24939
  const ov = pose2.poses.get(ps.id);
24744
24940
  const center = toWorld(pose2.position, pose2.rotation, ov?.pos ?? ps.position);
24745
- const rotation2 = quat.mul(pose2.rotation, ov?.q ?? quatFromEuler(...ps.rotation ?? [0, 0, 0]));
24941
+ const rotation2 = quat.mul(pose2.rotation, ov?.q ?? quatFromEuler2(...ps.rotation ?? [0, 0, 0]));
24746
24942
  out.push({ center, half: halfOf(ps.shape), rotation: rotation2 });
24747
24943
  }
24748
24944
  return out;
@@ -25141,7 +25337,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
25141
25337
  const d = {
25142
25338
  mat,
25143
25339
  mass0: partMass(ps, mat),
25144
- q: quatFromEuler(...ps.rotation ?? [0, 0, 0]),
25340
+ q: quatFromEuler2(...ps.rotation ?? [0, 0, 0]),
25145
25341
  area: shapeArea(ps.shape),
25146
25342
  thickness: partThickness(ps),
25147
25343
  cutFactor: cutFactorOf(ps.shape),
@@ -26791,7 +26987,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26791
26987
  };
26792
26988
  const implPartBox = (im, ps) => {
26793
26989
  const ov = im.poses.get(ps.id);
26794
- return aabbOf(ps.shape, toWorld(im.position, im.rotation, ov?.pos ?? ps.position), quat.mul(im.rotation, ov?.q ?? quatFromEuler(...ps.rotation ?? [0, 0, 0])));
26990
+ return aabbOf(ps.shape, toWorld(im.position, im.rotation, ov?.pos ?? ps.position), quat.mul(im.rotation, ov?.q ?? quatFromEuler2(...ps.rotation ?? [0, 0, 0])));
26795
26991
  };
26796
26992
  const implBounds = /* @__PURE__ */ new WeakMap();
26797
26993
  const implBoundsOf = (im) => {
@@ -26994,7 +27190,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26994
27190
  counts.shapeTested.add(im.impl.id);
26995
27191
  }
26996
27192
  const ov = im.poses.get(ps.id);
26997
- const r = rayPartRaw(im.position, im.rotation, ps, ov?.q ?? quatFromEuler(...ps.rotation ?? [0, 0, 0]), origin, d, ov?.pos);
27193
+ const r = rayPartRaw(im.position, im.rotation, ps, ov?.q ?? quatFromEuler2(...ps.rotation ?? [0, 0, 0]), origin, d, ov?.pos);
26998
27194
  if (!r || r.t1 < 0 || r.t0 > maxDist) continue;
26999
27195
  if (r.t0 < 0) {
27000
27196
  if (precise && im.impl.surfaceRay) boxHit = boxHit ?? { object: im.impl.id, part: ps.id, point: origin, normal: r.n, distance: 0, pathLen: r.t1 };
@@ -27033,8 +27229,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27033
27229
  const parts2 = im.impl.describe().parts;
27034
27230
  const pa = parts2.find((p) => p.id === a), pb = parts2.find((p) => p.id === b);
27035
27231
  if (!pa || !pb) return null;
27036
- const A = aabbOf(pa.shape, pa.position, quatFromEuler(...pa.rotation ?? [0, 0, 0]));
27037
- const B = aabbOf(pb.shape, pb.position, quatFromEuler(...pb.rotation ?? [0, 0, 0]));
27232
+ const A = aabbOf(pa.shape, pa.position, quatFromEuler2(...pa.rotation ?? [0, 0, 0]));
27233
+ const B = aabbOf(pb.shape, pb.position, quatFromEuler2(...pb.rotation ?? [0, 0, 0]));
27038
27234
  const pos = [0, 0, 0];
27039
27235
  for (let k = 0; k < 3; k++) pos[k] = (Math.max(A.min[k], B.min[k]) + Math.min(A.max[k], B.max[k])) / 2;
27040
27236
  return toWorld(im.position, im.rotation, pos);
@@ -28685,13 +28881,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28685
28881
  }
28686
28882
  const implParts = (im) => im.impl.describe().parts.map((ps) => {
28687
28883
  const ov = im.poses.get(ps.id);
28688
- return { ps, c: toWorld(im.position, im.rotation, ov?.pos ?? ps.position), q: quat.mul(im.rotation, ov?.q ?? quatFromEuler(...ps.rotation ?? [0, 0, 0])) };
28884
+ return { ps, c: toWorld(im.position, im.rotation, ov?.pos ?? ps.position), q: quat.mul(im.rotation, ov?.q ?? quatFromEuler2(...ps.rotation ?? [0, 0, 0])) };
28689
28885
  });
28690
28886
  const implInRange = (im, point, radius) => {
28691
28887
  for (const ps of im.impl.describe().parts) {
28692
28888
  const ov = im.poses.get(ps.id);
28693
28889
  const c = toWorld(im.position, im.rotation, ov?.pos ?? ps.position);
28694
- const q = quat.mul(im.rotation, ov?.q ?? quatFromEuler(...ps.rotation ?? [0, 0, 0]));
28890
+ const q = quat.mul(im.rotation, ov?.q ?? quatFromEuler2(...ps.rotation ?? [0, 0, 0]));
28695
28891
  if (distanceToShape(ps.shape, toLocal(c, q, point)) < radius) return true;
28696
28892
  }
28697
28893
  return false;
@@ -29716,7 +29912,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29716
29912
  },
29717
29913
  setPartPose(objectId, partId, position, rotation2) {
29718
29914
  finishExplosions();
29719
- const q = quatFromEuler(...rotation2 ?? [0, 0, 0]);
29915
+ const q = quatFromEuler2(...rotation2 ?? [0, 0, 0]);
29720
29916
  const im = impls.get(objectId);
29721
29917
  if (im) {
29722
29918
  im.impl.setPartPose?.(partId, position, rotation2);
@@ -29835,7 +30031,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29835
30031
  const mat = materials.get(ps.material);
29836
30032
  if (!mat) continue;
29837
30033
  const ov = im.poses.get(ps.id);
29838
- const r = rayPartRaw(im.position, im.rotation, ps, ov?.q ?? quatFromEuler(...ps.rotation ?? [0, 0, 0]), point, d, ov?.pos);
30034
+ const r = rayPartRaw(im.position, im.rotation, ps, ov?.q ?? quatFromEuler2(...ps.rotation ?? [0, 0, 0]), point, d, ov?.pos);
29839
30035
  if (!r || r.t1 < 0 || r.t0 > L) continue;
29840
30036
  let path = Math.min(r.t1, L) - Math.max(r.t0, 0);
29841
30037
  if (ps.thickness !== void 0 && ps.thickness > 0) path = Math.min(path, 2 * ps.thickness);
@@ -30101,6 +30297,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30101
30297
  }).events;
30102
30298
  },
30103
30299
  state: (id) => objects.get(id)?.st ?? impls.get(id)?.impl.state() ?? null,
30300
+ anchoredParts: (id) => objects.get(id)?.parts.filter((p) => p.anchored && !isLost(p)).map((p) => p.spec.id) ?? [],
30301
+ fixedInPlace: (id) => {
30302
+ const o = objects.get(id);
30303
+ return !!o && o.spec.fixed === true && o.parts.some((p) => p.anchored && !isLost(p));
30304
+ },
30104
30305
  snapshot: (id) => {
30105
30306
  const st = objects.get(id)?.st ?? impls.get(id)?.impl.state();
30106
30307
  return st ? clone(st) : null;
@@ -32622,182 +32823,1007 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32622
32823
  return [[mast.u, mast.v, mast.y0], [mast.u, mast.v, mast.y1], ...arc];
32623
32824
  }
32624
32825
 
32625
- // ../game-items-goods/dist/index.js
32626
- var FLOORPLAN_POOL_KEYS = {
32627
- fridge: "geladeira",
32628
- display_fridge: "refrig_exp",
32629
- freezer: "freezer",
32630
- kitchen_cabinet: "pia",
32631
- overhead_cabinet: "aereo",
32632
- washbasin: "pia_b",
32633
- wardrobe: "guarda",
32634
- wardrobe_large: "guarda",
32635
- dresser: "comoda",
32636
- console_table: "comoda",
32637
- nightstand: "criado",
32638
- filing_cabinet: "gaveteiro",
32639
- pantry: "despensa",
32640
- tv_unit: "rack",
32641
- laundry_cabinet: "armario_lav",
32642
- laundry_shelf: "estante_lav",
32643
- workbench: "bancada",
32644
- tool_shelf: "estante_ferr",
32645
- mailbox: "correio",
32646
- trash_bin: "lixeira",
32647
- outdoor_bin: "lixeira",
32648
- china_cabinet: "cristaleira"
32649
- };
32650
- var FLOORPLAN_POOL_ALIASES = FLOORPLAN_POOL_KEYS;
32651
- var categories_default = [
32826
+ // ../game-items/dist/index.js
32827
+ var DEFAULT_RULES2 = {
32828
+ rarity: {
32829
+ weights: { common: 60, uncommon: 28, rare: 9, very_rare: 2.5, legendary: 0.5, unique: 0 },
32830
+ fixedOnly: ["legendary", "unique"]
32831
+ },
32832
+ freshness: { stale: 0.5, spoiled: 1, rotten: 1.5 },
32833
+ storage: {
32834
+ fridge: { multiplier: 0.33, needsPower: true },
32835
+ freezer: { multiplier: 0.1, needsPower: true },
32836
+ cooler: { multiplier: 0.5, limitDays: 2, afterLimit: 1 },
32837
+ delivery_bag: { multiplier: 0.8 },
32838
+ cellar: { multiplier: 0.66 },
32839
+ ambient: { multiplier: 1 },
32840
+ hot: { multiplier: 2 }
32841
+ },
32842
+ carry: { baseKg: 8, perStrengthKg: 2.5, factor: 1.2, encumbered: 1, overloaded: 1.5 },
32843
+ protection: { cap: 0.9, wear: { bite: 8, scratch: 3 }, tornShare: 0.25, repairMargin: 10 },
32844
+ aging: { thawShelfDays: { freezer: 2 } },
32845
+ inventory: {
32846
+ defaultSlots: 10,
32847
+ encumberedRunFactor: 0.75,
32848
+ defaultLitres: 12,
32849
+ defaultInside: [0.3, 0.25, 0.16],
32850
+ bagInside: {
32851
+ shopping_bag: [0.4, 0.35, 0.15],
32852
+ trash_bag: [0.6, 0.45, 0.12],
32853
+ fanny_pack: [0.22, 0.12, 0.1],
32854
+ crossbody_bag: [0.25, 0.2, 0.12],
32855
+ backpack: [0.5, 0.3, 0.2],
32856
+ delivery_bag: [0.45, 0.45, 0.25],
32857
+ hiking_backpack_40l: [0.6, 0.35, 0.19],
32858
+ military_backpack: [0.6, 0.35, 0.21],
32859
+ trekking_backpack_70l: [0.75, 0.38, 0.25],
32860
+ rolling_suitcase: [0.6, 0.4, 0.21],
32861
+ tactical_vest: [0.3, 0.2, 0.1],
32862
+ tool_belt: [0.4, 0.2, 0.1],
32863
+ cooler_box: [0.32, 0.25, 0.23],
32864
+ shopping_cart: [0.9, 0.55, 0.16],
32865
+ wheelbarrow: [1.2, 0.6, 0.15]
32866
+ },
32867
+ bagLitres: {
32868
+ shopping_bag: 20,
32869
+ trash_bag: 30,
32870
+ fanny_pack: 3,
32871
+ crossbody_bag: 6,
32872
+ backpack: 30,
32873
+ delivery_bag: 50,
32874
+ hiking_backpack_40l: 40,
32875
+ military_backpack: 45,
32876
+ trekking_backpack_70l: 70,
32877
+ rolling_suitcase: 50,
32878
+ tactical_vest: 6,
32879
+ tool_belt: 8,
32880
+ cooler_box: 18,
32881
+ shopping_cart: 80,
32882
+ wheelbarrow: 100
32883
+ }
32884
+ },
32885
+ use: {
32886
+ freshness: {
32887
+ stale: { satietyFactor: 0.7, poisonChance: 0.1, morale: 0, isEdible: true },
32888
+ spoiled: { satietyFactor: 0.7, poisonChance: 0.5, morale: -20, isEdible: true },
32889
+ rotten: { satietyFactor: 0, poisonChance: 0, morale: 0, isEdible: false }
32890
+ },
32891
+ cookedPoisonFactor: 0.25
32892
+ },
32893
+ spawn: {
32894
+ retailNew: true,
32895
+ retailPlaces: ["supermarket", "pharmacy", "mall", "gas_station", "gun_shop"],
32896
+ retailContainers: ["store_shelf", "stockroom"],
32897
+ condition: { common: [30, 90], uncommon: [40, 90], rare: [50, 100], very_rare: [50, 100], legendary: [50, 100], unique: [50, 100] },
32898
+ ageShare: [0, 0.6],
32899
+ charge: [0.2, 1],
32900
+ fillable: ["fuel_jerrycan"],
32901
+ fill: [0, 0.6]
32902
+ },
32903
+ finds: {
32904
+ fallbackContainer: "zombie_corpse",
32905
+ rollExcluded: ["ammo_7_62x39"],
32906
+ depletion: [
32907
+ { places: ["pharmacy", "gun_shop", "police_station"], perDay: 0.05, floor: 0.3 },
32908
+ { places: ["supermarket", "gas_station"], perDay: 0.04, floor: 0.35 },
32909
+ { places: ["mall", "hospital"], perDay: 0.025, floor: 0.5 },
32910
+ { places: ["house", "apartment"], perDay: 0.01, floor: 0.7 },
32911
+ { places: ["farm", "warehouse", "mine", "dam", "lodge", "church"], perDay: 5e-3, floor: 0.85 },
32912
+ { places: ["military_base"], perDay: 0, floor: 1 }
32913
+ ],
32914
+ regionMultiplier: {},
32915
+ states: { normal: "normal", fortified: "fortified", abandoned: "abandoned" },
32916
+ pool: {
32917
+ defaultFootprint: 0.5,
32918
+ offset: 1.5,
32919
+ perSquareMetre: 3,
32920
+ jitter: 1.5,
32921
+ min: 2,
32922
+ max: 5,
32923
+ fortifiedExtra: 2,
32924
+ supplyWeight: 2.5,
32925
+ supplyExtraQty: 1,
32926
+ abandonedEmptyChance: 0.4,
32927
+ abandonedKept: 1,
32928
+ junkChance: 0.5,
32929
+ junkItem: "food_packaging",
32930
+ spoiledFoodItem: "leftover_meal",
32931
+ coldContainers: ["geladeira", "refrig_exp", "freezer"]
32932
+ }
32933
+ }
32934
+ };
32935
+ var FRESH_NUTRITION = { satietyFactor: 1, poisonChance: 0, morale: 0, isEdible: true };
32936
+ var nutritionOf = (item, context, rules) => {
32937
+ const state = context.freshness ?? "fresh";
32938
+ const effect = state === "fresh" ? FRESH_NUTRITION : rules.use.freshness[state];
32939
+ const poisonShare = context.isCooked ? rules.use.cookedPoisonFactor : 1;
32940
+ return {
32941
+ satiety: (item.nutrition?.satiety ?? 0) * effect.satietyFactor,
32942
+ hydration: item.nutrition?.hydration ?? 0,
32943
+ morale: effect.morale,
32944
+ poisonChance: effect.poisonChance * poisonShare,
32945
+ isEdible: effect.isEdible
32946
+ };
32947
+ };
32948
+ var findEffect = (item, effects) => effects.find((entry2) => entry2.items?.includes(item.id)) ?? effects.find((entry2) => entry2.category?.includes(item.category));
32949
+ var resolveUse = (item, effects, context = {}, rules = DEFAULT_RULES2) => {
32950
+ const def = findEffect(item, effects);
32951
+ if (!def) return void 0;
32952
+ const base = { useId: def.id, effect: def.effect, params: def.params ?? {}, consumes: def.consumes };
32953
+ if (def.effect !== "consume_nutrition") return base;
32954
+ const nutrition = nutritionOf(item, context, rules);
32955
+ const blocked = item.seal && context.seal ? sealBlock(item.seal, context.seal) : void 0;
32956
+ if (blocked) return { ...base, consumes: false, nutrition: { ...nutrition, isEdible: false }, blocked };
32957
+ return { ...base, consumes: def.consumes && nutrition.isEdible, nutrition };
32958
+ };
32959
+ var MM = 1e-3;
32960
+ var BOX_WALL = 6 * MM;
32961
+
32962
+ // ../game-fluids/dist/index.js
32963
+ var liquids_default = [
32652
32964
  {
32653
- id: "food",
32654
- name: "Food"
32965
+ id: "water",
32966
+ color: 11064558,
32967
+ opacity: 0.35,
32968
+ stainColor: 7309206,
32969
+ viscosity: 1,
32970
+ density: 1e3,
32971
+ dryTime: 180,
32972
+ gloss: 0.9,
32973
+ drink: {
32974
+ thirst: 100,
32975
+ effects: []
32976
+ },
32977
+ tags: [
32978
+ "drink",
32979
+ "clear"
32980
+ ]
32655
32981
  },
32656
32982
  {
32657
- id: "drink",
32658
- name: "Drink"
32983
+ id: "coffee",
32984
+ color: 3875604,
32985
+ opacity: 0.95,
32986
+ stainColor: 2824202,
32987
+ viscosity: 1.5,
32988
+ density: 1005,
32989
+ dryTime: 900,
32990
+ gloss: 0.8,
32991
+ leavesMark: true,
32992
+ steamC: 60,
32993
+ drink: {
32994
+ thirst: 80,
32995
+ effects: [
32996
+ "caffeine"
32997
+ ]
32998
+ },
32999
+ tags: [
33000
+ "drink",
33001
+ "hot"
33002
+ ]
32659
33003
  },
32660
33004
  {
32661
- id: "medical",
32662
- name: "Medical"
33005
+ id: "tea",
33006
+ color: 9063188,
33007
+ opacity: 0.8,
33008
+ stainColor: 6961682,
33009
+ viscosity: 1.4,
33010
+ density: 1005,
33011
+ dryTime: 800,
33012
+ gloss: 0.8,
33013
+ leavesMark: true,
33014
+ steamC: 60,
33015
+ drink: {
33016
+ thirst: 90,
33017
+ effects: []
33018
+ },
33019
+ tags: [
33020
+ "drink",
33021
+ "hot"
33022
+ ]
32663
33023
  },
32664
33024
  {
32665
- id: "tools",
32666
- name: "Tools"
33025
+ id: "milk",
33026
+ color: 16052712,
33027
+ opacity: 0.98,
33028
+ stainColor: 14473160,
33029
+ viscosity: 2,
33030
+ density: 1030,
33031
+ dryTime: 900,
33032
+ gloss: 0.5,
33033
+ leavesMark: true,
33034
+ drink: {
33035
+ thirst: 70,
33036
+ effects: []
33037
+ },
33038
+ tags: [
33039
+ "drink"
33040
+ ]
32667
33041
  },
32668
33042
  {
32669
- id: "melee",
32670
- name: "Melee"
33043
+ id: "soda",
33044
+ color: 3808530,
33045
+ opacity: 0.85,
33046
+ stainColor: 2757901,
33047
+ viscosity: 1.3,
33048
+ density: 1040,
33049
+ dryTime: 1200,
33050
+ gloss: 0.85,
33051
+ leavesMark: true,
33052
+ drink: {
33053
+ thirst: 60,
33054
+ effects: []
33055
+ },
33056
+ tags: [
33057
+ "drink",
33058
+ "sticky"
33059
+ ]
32671
33060
  },
32672
33061
  {
32673
- id: "materials",
32674
- name: "Materials"
33062
+ id: "juice",
33063
+ color: 15239467,
33064
+ opacity: 0.9,
33065
+ stainColor: 12741916,
33066
+ viscosity: 2,
33067
+ density: 1045,
33068
+ dryTime: 1100,
33069
+ gloss: 0.8,
33070
+ leavesMark: true,
33071
+ drink: {
33072
+ thirst: 75,
33073
+ effects: []
33074
+ },
33075
+ tags: [
33076
+ "drink",
33077
+ "sticky"
33078
+ ]
32675
33079
  },
32676
33080
  {
32677
- id: "clothing",
32678
- name: "Clothing"
33081
+ id: "beer",
33082
+ color: 14259740,
33083
+ opacity: 0.8,
33084
+ stainColor: 11039764,
33085
+ viscosity: 1.4,
33086
+ density: 1010,
33087
+ dryTime: 900,
33088
+ gloss: 0.8,
33089
+ drink: {
33090
+ thirst: 50,
33091
+ effects: [
33092
+ "alcohol"
33093
+ ]
33094
+ },
33095
+ tags: [
33096
+ "drink",
33097
+ "alcohol"
33098
+ ]
32679
33099
  },
32680
33100
  {
32681
- id: "bags",
32682
- name: "Bags"
33101
+ id: "wine",
33102
+ color: 7016223,
33103
+ opacity: 0.9,
33104
+ stainColor: 5048854,
33105
+ viscosity: 1.6,
33106
+ density: 990,
33107
+ dryTime: 800,
33108
+ gloss: 0.85,
33109
+ leavesMark: true,
33110
+ drink: {
33111
+ thirst: 40,
33112
+ effects: [
33113
+ "alcohol"
33114
+ ]
33115
+ },
33116
+ tags: [
33117
+ "drink",
33118
+ "alcohol"
33119
+ ]
32683
33120
  },
32684
33121
  {
32685
- id: "electronics",
32686
- name: "Electronics"
33122
+ id: "spirits",
33123
+ color: 13214042,
33124
+ opacity: 0.6,
33125
+ stainColor: 10320959,
33126
+ viscosity: 1.8,
33127
+ density: 940,
33128
+ dryTime: 200,
33129
+ gloss: 0.85,
33130
+ flammable: true,
33131
+ drink: {
33132
+ thirst: 5,
33133
+ effects: [
33134
+ "alcohol"
33135
+ ]
33136
+ },
33137
+ tags: [
33138
+ "drink",
33139
+ "alcohol"
33140
+ ]
32687
33141
  },
32688
33142
  {
32689
33143
  id: "fuel",
32690
- name: "Fuel"
32691
- },
32692
- {
32693
- id: "outdoors",
32694
- name: "Outdoors"
33144
+ color: 14926682,
33145
+ opacity: 0.6,
33146
+ stainColor: 7232298,
33147
+ viscosity: 0.6,
33148
+ density: 740,
33149
+ dryTime: 60,
33150
+ gloss: 0.95,
33151
+ leavesMark: false,
33152
+ flammable: true,
33153
+ drink: {
33154
+ thirst: 0,
33155
+ effects: [
33156
+ "poison"
33157
+ ]
33158
+ },
33159
+ tags: [
33160
+ "fuel",
33161
+ "gasoline"
33162
+ ]
32695
33163
  },
32696
33164
  {
32697
- id: "books",
32698
- name: "Books"
33165
+ id: "diesel",
33166
+ color: 12098094,
33167
+ opacity: 0.8,
33168
+ stainColor: 5917208,
33169
+ viscosity: 3,
33170
+ density: 830,
33171
+ dryTime: 3600,
33172
+ gloss: 0.95,
33173
+ leavesMark: true,
33174
+ flammable: true,
33175
+ drink: {
33176
+ thirst: 0,
33177
+ effects: [
33178
+ "poison"
33179
+ ]
33180
+ },
33181
+ tags: [
33182
+ "fuel"
33183
+ ]
32699
33184
  },
32700
33185
  {
32701
- id: "collectibles",
32702
- name: "Collectibles"
33186
+ id: "motor_oil",
33187
+ color: 3877388,
33188
+ opacity: 0.95,
33189
+ stainColor: 1840134,
33190
+ viscosity: 100,
33191
+ density: 880,
33192
+ dryTime: 0,
33193
+ gloss: 1,
33194
+ leavesMark: true,
33195
+ flammable: true,
33196
+ drink: {
33197
+ thirst: 0,
33198
+ effects: [
33199
+ "poison"
33200
+ ]
33201
+ },
33202
+ tags: [
33203
+ "oil"
33204
+ ]
32703
33205
  },
32704
33206
  {
32705
- id: "keys",
32706
- name: "Keys"
33207
+ id: "cooking_oil",
33208
+ color: 14267708,
33209
+ opacity: 0.85,
33210
+ stainColor: 11110698,
33211
+ viscosity: 60,
33212
+ density: 920,
33213
+ dryTime: 0,
33214
+ gloss: 1,
33215
+ leavesMark: true,
33216
+ flammable: true,
33217
+ drink: {
33218
+ thirst: 0,
33219
+ effects: [
33220
+ "poison"
33221
+ ]
33222
+ },
33223
+ tags: [
33224
+ "oil",
33225
+ "food"
33226
+ ]
32707
33227
  },
32708
33228
  {
32709
- id: "ammo",
32710
- name: "Ammo"
33229
+ id: "blood",
33230
+ color: 7997964,
33231
+ opacity: 0.92,
33232
+ stainColor: 3874068,
33233
+ viscosity: 4,
33234
+ density: 1060,
33235
+ dryTime: 600,
33236
+ gloss: 0.75,
33237
+ leavesMark: true,
33238
+ drink: {
33239
+ thirst: 10,
33240
+ effects: [
33241
+ "disgust"
33242
+ ]
33243
+ },
33244
+ tags: [
33245
+ "organic"
33246
+ ]
32711
33247
  },
32712
33248
  {
32713
- id: "firearms",
32714
- name: "Firearms"
33249
+ id: "old_blood",
33250
+ color: 7085078,
33251
+ opacity: 0.92,
33252
+ stainColor: 2758158,
33253
+ viscosity: 4,
33254
+ density: 1060,
33255
+ dryTime: 360,
33256
+ gloss: 0.7,
33257
+ leavesMark: true,
33258
+ drink: {
33259
+ thirst: 10,
33260
+ effects: [
33261
+ "disgust"
33262
+ ]
33263
+ },
33264
+ tags: [
33265
+ "organic"
33266
+ ]
32715
33267
  },
32716
33268
  {
32717
- id: "throwables",
32718
- name: "Throwables"
32719
- }
32720
- ];
32721
- var containers_default = [
32722
- {
32723
- id: "fridge",
32724
- teamName: "Geladeira",
32725
- gameKey: "geladeira",
32726
- places: [
32727
- "house",
32728
- "apartment",
32729
- "supermarket",
32730
- "gas_station"
32731
- ],
32732
- count: [
32733
- 0,
32734
- 4
32735
- ],
32736
- teamCount: [
32737
- 0,
32738
- 4
32739
- ],
32740
- categories: {
32741
- food: 0.55,
32742
- drink: 0.45
33269
+ id: "bile",
33270
+ color: 9083434,
33271
+ opacity: 0.9,
33272
+ stainColor: 4080160,
33273
+ viscosity: 6,
33274
+ density: 1020,
33275
+ dryTime: 900,
33276
+ gloss: 0.75,
33277
+ leavesMark: true,
33278
+ drink: {
33279
+ thirst: 0,
33280
+ effects: [
33281
+ "disgust"
33282
+ ]
32743
33283
  },
32744
- teamCategories: "comida perec\xEDvel e bebida",
32745
- rule: "Sem energia, o perec\xEDvel de dentro come\xE7a a contar como fora da geladeira."
33284
+ tags: [
33285
+ "organic"
33286
+ ]
32746
33287
  },
32747
33288
  {
32748
- id: "kitchen_cabinet",
32749
- teamName: "Arm\xE1rio de cozinha",
32750
- gameKey: "cozinha",
32751
- places: [
32752
- "house",
32753
- "apartment",
32754
- "church",
32755
- "school"
32756
- ],
32757
- count: [
32758
- 1,
32759
- 4
32760
- ],
32761
- teamCount: [
32762
- 1,
32763
- 4
32764
- ],
32765
- categories: {
32766
- food: 0.7,
32767
- melee: 0.12,
32768
- electronics: 0.1,
32769
- tools: 0.08
33289
+ id: "sap",
33290
+ color: 13146940,
33291
+ opacity: 0.8,
33292
+ stainColor: 10122282,
33293
+ viscosity: 200,
33294
+ density: 1100,
33295
+ dryTime: 3600,
33296
+ gloss: 0.8,
33297
+ leavesMark: true,
33298
+ drink: {
33299
+ thirst: 20,
33300
+ effects: []
32770
33301
  },
32771
- teamCategories: "comida seca e enlatada, panela, abridor, isqueiro"
33302
+ tags: [
33303
+ "organic",
33304
+ "sticky"
33305
+ ]
32772
33306
  },
32773
33307
  {
32774
- id: "bathroom_cabinet",
32775
- teamName: "Arm\xE1rio do banheiro",
32776
- gameKey: "banheiro",
32777
- places: [
32778
- "house",
32779
- "apartment",
32780
- "school"
32781
- ],
32782
- count: [
32783
- 0,
32784
- 3
32785
- ],
32786
- teamCount: [
32787
- 0,
32788
- 3
32789
- ],
32790
- categories: {
32791
- medical: 1
33308
+ id: "acid",
33309
+ color: 10146378,
33310
+ opacity: 0.6,
33311
+ stainColor: 7313970,
33312
+ viscosity: 1.5,
33313
+ density: 1200,
33314
+ dryTime: 900,
33315
+ gloss: 0.9,
33316
+ leavesMark: true,
33317
+ drink: {
33318
+ thirst: 0,
33319
+ effects: [
33320
+ "poison"
33321
+ ]
32792
33322
  },
32793
- teamCategories: "analg\xE9sico, curativo, \xE1lcool, rem\xE9dio de uso cont\xEDnuo"
33323
+ tags: [
33324
+ "corrosive"
33325
+ ]
32794
33326
  },
32795
33327
  {
32796
- id: "wardrobe",
32797
- teamName: "Guarda-roupa",
32798
- gameKey: "guarda",
32799
- places: [
32800
- "house",
33328
+ id: "paint",
33329
+ color: 11740715,
33330
+ opacity: 0.98,
33331
+ stainColor: 9050655,
33332
+ viscosity: 300,
33333
+ density: 1300,
33334
+ dryTime: 1800,
33335
+ gloss: 0.6,
33336
+ leavesMark: true,
33337
+ drink: {
33338
+ thirst: 0,
33339
+ effects: [
33340
+ "poison"
33341
+ ]
33342
+ },
33343
+ tags: [
33344
+ "paint"
33345
+ ]
33346
+ },
33347
+ {
33348
+ id: "bleach",
33349
+ color: 15134688,
33350
+ opacity: 0.7,
33351
+ stainColor: 13621446,
33352
+ viscosity: 1.2,
33353
+ density: 1100,
33354
+ dryTime: 900,
33355
+ gloss: 0.85,
33356
+ leavesMark: true,
33357
+ drink: {
33358
+ thirst: 0,
33359
+ effects: [
33360
+ "poison"
33361
+ ]
33362
+ },
33363
+ tags: [
33364
+ "corrosive"
33365
+ ]
33366
+ },
33367
+ {
33368
+ id: "sewage",
33369
+ color: 5921582,
33370
+ opacity: 0.92,
33371
+ stainColor: 3093273,
33372
+ viscosity: 4,
33373
+ density: 1010,
33374
+ dryTime: 1800,
33375
+ gloss: 0.8,
33376
+ leavesMark: true,
33377
+ drink: {
33378
+ thirst: 0,
33379
+ effects: [
33380
+ "disgust",
33381
+ "poison"
33382
+ ]
33383
+ },
33384
+ tags: [
33385
+ "organic",
33386
+ "waste"
33387
+ ]
33388
+ },
33389
+ {
33390
+ id: "honey",
33391
+ color: 14193162,
33392
+ opacity: 0.9,
33393
+ stainColor: 12089350,
33394
+ viscosity: 3e3,
33395
+ density: 1420,
33396
+ dryTime: 14400,
33397
+ gloss: 0.95,
33398
+ leavesMark: true,
33399
+ drink: {
33400
+ thirst: 10,
33401
+ effects: []
33402
+ },
33403
+ tags: [
33404
+ "drink",
33405
+ "sticky"
33406
+ ]
33407
+ },
33408
+ {
33409
+ id: "mud",
33410
+ color: 4008988,
33411
+ opacity: 0.95,
33412
+ stainColor: 3811866,
33413
+ viscosity: 40,
33414
+ density: 1600,
33415
+ dryTime: 900,
33416
+ gloss: 0.4,
33417
+ tags: [
33418
+ "dirty"
33419
+ ]
33420
+ },
33421
+ {
33422
+ id: "coolant",
33423
+ color: 3455050,
33424
+ opacity: 0.7,
33425
+ stainColor: 2783796,
33426
+ viscosity: 4,
33427
+ density: 1070,
33428
+ dryTime: 1200,
33429
+ gloss: 0.85,
33430
+ leavesMark: true,
33431
+ drink: {
33432
+ thirst: 0,
33433
+ effects: [
33434
+ "poison"
33435
+ ]
33436
+ },
33437
+ tags: [
33438
+ "coolant"
33439
+ ]
33440
+ },
33441
+ {
33442
+ id: "brake_fluid",
33443
+ color: 13145646,
33444
+ opacity: 0.8,
33445
+ stainColor: 9069600,
33446
+ viscosity: 8,
33447
+ density: 1050,
33448
+ dryTime: 3600,
33449
+ gloss: 0.9,
33450
+ leavesMark: true,
33451
+ drink: {
33452
+ thirst: 0,
33453
+ effects: [
33454
+ "poison"
33455
+ ]
33456
+ },
33457
+ tags: [
33458
+ "brake_fluid"
33459
+ ]
33460
+ }
33461
+ ];
33462
+ var LIQUIDS = liquids_default;
33463
+ var SAMPLES = 16;
33464
+ var COS = [];
33465
+ var SIN = [];
33466
+ for (let i = 0; i < SAMPLES; i++) {
33467
+ COS.push(Math.cos(i / SAMPLES * Math.PI * 2));
33468
+ SIN.push(Math.sin(i / SAMPLES * Math.PI * 2));
33469
+ }
33470
+ var RUNOFF_TILT = 6 * Math.PI / 180;
33471
+ var RUNOFF_TILT_MAX = 60 * Math.PI / 180;
33472
+ function hashCell(x, y) {
33473
+ let value = x * 374761393 + y * 668265263 | 0;
33474
+ value = (value ^ value >>> 13) * 1274126177 | 0;
33475
+ return ((value ^ value >>> 16) >>> 0) / 4294967296;
33476
+ }
33477
+ function valueNoise(x, y) {
33478
+ const xi = Math.floor(x);
33479
+ const yi = Math.floor(y);
33480
+ const xf = x - xi;
33481
+ const yf = y - yi;
33482
+ const u = xf * xf * (3 - 2 * xf);
33483
+ const v = yf * yf * (3 - 2 * yf);
33484
+ const a = hashCell(xi, yi);
33485
+ const b = hashCell(xi + 1, yi);
33486
+ const c = hashCell(xi, yi + 1);
33487
+ const d = hashCell(xi + 1, yi + 1);
33488
+ return a + (b - a) * u + (c - a) * v + (a - b - c + d) * u * v;
33489
+ }
33490
+ var REGION_NAMES = ["wall", "sidewalk", "curb", "road"];
33491
+ var dot3 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
33492
+ function impactOf(region, position, velocity2, cellSize) {
33493
+ const local2 = [position[0] - region.origin[0], position[1] - region.origin[1], position[2] - region.origin[2]];
33494
+ return {
33495
+ row: region.firstRow + dot3(local2, region.rowAxis) / cellSize,
33496
+ column: dot3(local2, region.columnAxis) / cellSize,
33497
+ along: [dot3(velocity2, region.columnAxis), dot3(velocity2, region.rowAxis)],
33498
+ normalSpeed: -dot3(velocity2, region.normal)
33499
+ };
33500
+ }
33501
+ function cellToWorldOf(regions, cellSize, row, column) {
33502
+ let region = regions[regions.length - 1];
33503
+ for (const candidate of regions) {
33504
+ if (row < candidate.firstRow + candidate.rowCount) {
33505
+ region = candidate;
33506
+ break;
33507
+ }
33508
+ }
33509
+ const across2 = column * cellSize;
33510
+ const down2 = (row - region.firstRow) * cellSize;
33511
+ return [
33512
+ region.origin[0] + region.columnAxis[0] * across2 + region.rowAxis[0] * down2,
33513
+ region.origin[1] + region.columnAxis[1] * across2 + region.rowAxis[1] * down2,
33514
+ region.origin[2] + region.columnAxis[2] * across2 + region.rowAxis[2] * down2
33515
+ ];
33516
+ }
33517
+ function createFoldedLayout(params) {
33518
+ const { columns, cellSize, originX, wallRows, sidewalkRows, curbRows, roadRows, wallTopY, sidewalkY, roadY, wallZ, rules } = params;
33519
+ const curbStep = params.curbStep ?? (sidewalkY - roadY) / curbRows;
33520
+ const height = wallRows + sidewalkRows + curbRows + roadRows;
33521
+ const cellCount = columns * height;
33522
+ const bed = new Float32Array(cellCount);
33523
+ const pin = new Float32Array(cellCount);
33524
+ const vertical = new Float32Array(cellCount);
33525
+ const sidewalkEnd = wallRows + sidewalkRows;
33526
+ const curbEnd = sidewalkEnd + curbRows;
33527
+ const regionOfRow = (row) => row < wallRows ? 0 : row < sidewalkEnd ? 1 : row < curbEnd ? 2 : 3;
33528
+ for (let row = 0; row < height; row++) {
33529
+ for (let column = 0; column < columns; column++) {
33530
+ const index = row * columns + column;
33531
+ const region = regionOfRow(row);
33532
+ const x = originX + (column + 0.5) * cellSize;
33533
+ let bedHeight;
33534
+ let roughness = 0.2;
33535
+ if (region === 0) {
33536
+ bedHeight = (wallTopY - (row + 0.5) * cellSize) * 1e3;
33537
+ roughness = 0.3;
33538
+ } else if (region === 1) {
33539
+ const z = (row - wallRows + 0.5) * cellSize;
33540
+ bedHeight = sidewalkY * 1e3 - z * 6;
33541
+ const jointX = Math.abs(((x - originX) % 0.5 + 0.5) % 0.5 - 0.25);
33542
+ const jointZ = Math.abs((z % 0.5 + 0.5) % 0.5 - 0.25);
33543
+ if (jointX > 0.25 - cellSize * 0.6 || jointZ > 0.25 - cellSize * 0.6) bedHeight -= 0.9;
33544
+ roughness = 0.18;
33545
+ } else if (region === 2) {
33546
+ bedHeight = sidewalkY * 1e3 - (row - sidewalkEnd + 0.5) * curbStep * 1e3;
33547
+ } else {
33548
+ const z = (row - curbEnd + 0.5) * cellSize;
33549
+ bedHeight = roadY * 1e3 + z * 14 - (x - params.roadSlopeAnchorX) * 5;
33550
+ roughness = 0.55;
33551
+ }
33552
+ const noise3 = valueNoise(column * 0.35, row * 0.35) * 0.6 + valueNoise(column * 1.3, row * 1.3) * 0.4;
33553
+ bed[index] = bedHeight + (noise3 - 0.5) * roughness * 2;
33554
+ vertical[index] = region === 0 || region === 2 ? 0.95 : 1;
33555
+ pin[index] = 0.62 + 0.76 * (valueNoise(column * 0.21 + 40, row * 0.21) * 0.5 + hashCell(column, row) * 0.5) * (region === 3 ? 1.25 : 1);
33556
+ }
33557
+ }
33558
+ const curbZ = wallZ + sidewalkRows * cellSize;
33559
+ const roadEndZ = curbZ + roadRows * cellSize;
33560
+ const right = [1, 0, 0];
33561
+ const regions = [
33562
+ { id: REGION_NAMES[0], firstRow: 0, rowCount: wallRows, origin: [originX, wallTopY, wallZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
33563
+ { id: REGION_NAMES[1], firstRow: wallRows, rowCount: sidewalkRows, origin: [originX, sidewalkY, wallZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false },
33564
+ { id: REGION_NAMES[2], firstRow: sidewalkEnd, rowCount: curbRows, origin: [originX, sidewalkY, curbZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
33565
+ { id: REGION_NAMES[3], firstRow: curbEnd, rowCount: roadRows, origin: [originX, roadY, curbZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false }
33566
+ ];
33567
+ const maxX = originX + columns * cellSize;
33568
+ return {
33569
+ id: params.id,
33570
+ width: columns,
33571
+ height,
33572
+ cellSize,
33573
+ bed,
33574
+ pin,
33575
+ vertical,
33576
+ regions,
33577
+ rules,
33578
+ cellToWorld: (row, column) => cellToWorldOf(regions, cellSize, row, column),
33579
+ collide(previous, position) {
33580
+ if (position[2] <= wallZ && position[1] > sidewalkY) {
33581
+ position[2] = wallZ;
33582
+ return 0;
33583
+ }
33584
+ if (position[2] < curbZ && (!rules.guardBehindWall || position[2] >= wallZ) && position[1] <= sidewalkY) {
33585
+ position[1] = sidewalkY;
33586
+ return 1;
33587
+ }
33588
+ if (rules.curbCatch && position[2] >= curbZ && previous[2] < curbZ && position[1] < sidewalkY) {
33589
+ position[2] = curbZ;
33590
+ return 2;
33591
+ }
33592
+ if (position[2] >= curbZ && position[1] <= roadY) {
33593
+ position[1] = roadY;
33594
+ return 3;
33595
+ }
33596
+ return -1;
33597
+ },
33598
+ impact: (region, position, velocity2) => impactOf(regions[region], position, velocity2, cellSize),
33599
+ contains: (position) => position[0] > originX && position[0] < maxX && (!rules.clipRoadEnd || position[2] < roadEndZ),
33600
+ escaped(position) {
33601
+ if (position[1] < -1) return true;
33602
+ const box5 = rules.escapeBox;
33603
+ return box5 !== void 0 && (position[0] < box5.minX || position[0] > box5.maxX || position[2] > box5.maxZ);
33604
+ }
33605
+ };
33606
+ }
33607
+ var PADRAO_CELL = 0.0125;
33608
+ var PADRAO_WALL_Z = 0;
33609
+ var PADRAO_LAYOUT = createFoldedLayout({
33610
+ id: "padrao",
33611
+ columns: 256,
33612
+ cellSize: PADRAO_CELL,
33613
+ originX: -1.6,
33614
+ wallRows: 144,
33615
+ sidewalkRows: 128,
33616
+ curbRows: 12,
33617
+ roadRows: 112,
33618
+ wallTopY: 1.95,
33619
+ sidewalkY: 0.15,
33620
+ roadY: 0,
33621
+ wallZ: PADRAO_WALL_Z,
33622
+ curbStep: PADRAO_CELL,
33623
+ roadSlopeAnchorX: 0,
33624
+ rules: {
33625
+ dropCapacity: 600,
33626
+ curbCatch: true,
33627
+ guardBehindWall: true,
33628
+ clipRoadEnd: true,
33629
+ escapeBox: { minX: -3, maxX: 3, maxZ: PADRAO_WALL_Z + 128 * PADRAO_CELL + 112 * PADRAO_CELL + 1 },
33630
+ dripStyle: "padrao"
33631
+ }
33632
+ });
33633
+ var WORKSHOP_CELL = 0.0125;
33634
+ var WORKSHOP_LAYOUT = createFoldedLayout({
33635
+ id: "workshop",
33636
+ columns: 160,
33637
+ cellSize: WORKSHOP_CELL,
33638
+ originX: -2.2,
33639
+ wallRows: 160,
33640
+ sidewalkRows: 128,
33641
+ curbRows: 9,
33642
+ roadRows: 151,
33643
+ wallTopY: 2.12,
33644
+ sidewalkY: 0.1235,
33645
+ roadY: 9e-3,
33646
+ wallZ: -4.497,
33647
+ roadSlopeAnchorX: -1.2,
33648
+ rules: { dropCapacity: 400, curbCatch: false, guardBehindWall: false, clipRoadEnd: false, dripStyle: "workshop" }
33649
+ });
33650
+
33651
+ // ../game-items-goods/dist/index.js
33652
+ var FLOORPLAN_POOL_KEYS = {
33653
+ fridge: "geladeira",
33654
+ display_fridge: "refrig_exp",
33655
+ freezer: "freezer",
33656
+ kitchen_cabinet: "pia",
33657
+ overhead_cabinet: "aereo",
33658
+ washbasin: "pia_b",
33659
+ wardrobe: "guarda",
33660
+ wardrobe_large: "guarda",
33661
+ dresser: "comoda",
33662
+ console_table: "comoda",
33663
+ nightstand: "criado",
33664
+ filing_cabinet: "gaveteiro",
33665
+ pantry: "despensa",
33666
+ tv_unit: "rack",
33667
+ laundry_cabinet: "armario_lav",
33668
+ laundry_shelf: "estante_lav",
33669
+ workbench: "bancada",
33670
+ tool_shelf: "estante_ferr",
33671
+ mailbox: "correio",
33672
+ trash_bin: "lixeira",
33673
+ outdoor_bin: "lixeira",
33674
+ china_cabinet: "cristaleira"
33675
+ };
33676
+ var FLOORPLAN_POOL_ALIASES = FLOORPLAN_POOL_KEYS;
33677
+ var categories_default = [
33678
+ {
33679
+ id: "food",
33680
+ name: "Food"
33681
+ },
33682
+ {
33683
+ id: "drink",
33684
+ name: "Drink"
33685
+ },
33686
+ {
33687
+ id: "medical",
33688
+ name: "Medical"
33689
+ },
33690
+ {
33691
+ id: "tools",
33692
+ name: "Tools"
33693
+ },
33694
+ {
33695
+ id: "melee",
33696
+ name: "Melee"
33697
+ },
33698
+ {
33699
+ id: "materials",
33700
+ name: "Materials"
33701
+ },
33702
+ {
33703
+ id: "clothing",
33704
+ name: "Clothing"
33705
+ },
33706
+ {
33707
+ id: "bags",
33708
+ name: "Bags"
33709
+ },
33710
+ {
33711
+ id: "electronics",
33712
+ name: "Electronics"
33713
+ },
33714
+ {
33715
+ id: "fuel",
33716
+ name: "Fuel"
33717
+ },
33718
+ {
33719
+ id: "outdoors",
33720
+ name: "Outdoors"
33721
+ },
33722
+ {
33723
+ id: "books",
33724
+ name: "Books"
33725
+ },
33726
+ {
33727
+ id: "collectibles",
33728
+ name: "Collectibles"
33729
+ },
33730
+ {
33731
+ id: "keys",
33732
+ name: "Keys"
33733
+ },
33734
+ {
33735
+ id: "ammo",
33736
+ name: "Ammo"
33737
+ },
33738
+ {
33739
+ id: "firearms",
33740
+ name: "Firearms"
33741
+ },
33742
+ {
33743
+ id: "throwables",
33744
+ name: "Throwables"
33745
+ }
33746
+ ];
33747
+ var containers_default = [
33748
+ {
33749
+ id: "fridge",
33750
+ teamName: "Geladeira",
33751
+ gameKey: "geladeira",
33752
+ places: [
33753
+ "house",
33754
+ "apartment",
33755
+ "supermarket",
33756
+ "gas_station"
33757
+ ],
33758
+ count: [
33759
+ 0,
33760
+ 4
33761
+ ],
33762
+ teamCount: [
33763
+ 0,
33764
+ 4
33765
+ ],
33766
+ categories: {
33767
+ food: 0.55,
33768
+ drink: 0.45
33769
+ },
33770
+ teamCategories: "comida perec\xEDvel e bebida",
33771
+ rule: "Sem energia, o perec\xEDvel de dentro come\xE7a a contar como fora da geladeira."
33772
+ },
33773
+ {
33774
+ id: "kitchen_cabinet",
33775
+ teamName: "Arm\xE1rio de cozinha",
33776
+ gameKey: "cozinha",
33777
+ places: [
33778
+ "house",
33779
+ "apartment",
33780
+ "church",
33781
+ "school"
33782
+ ],
33783
+ count: [
33784
+ 1,
33785
+ 4
33786
+ ],
33787
+ teamCount: [
33788
+ 1,
33789
+ 4
33790
+ ],
33791
+ categories: {
33792
+ food: 0.7,
33793
+ melee: 0.12,
33794
+ electronics: 0.1,
33795
+ tools: 0.08
33796
+ },
33797
+ teamCategories: "comida seca e enlatada, panela, abridor, isqueiro"
33798
+ },
33799
+ {
33800
+ id: "bathroom_cabinet",
33801
+ teamName: "Arm\xE1rio do banheiro",
33802
+ gameKey: "banheiro",
33803
+ places: [
33804
+ "house",
33805
+ "apartment",
33806
+ "school"
33807
+ ],
33808
+ count: [
33809
+ 0,
33810
+ 3
33811
+ ],
33812
+ teamCount: [
33813
+ 0,
33814
+ 3
33815
+ ],
33816
+ categories: {
33817
+ medical: 1
33818
+ },
33819
+ teamCategories: "analg\xE9sico, curativo, \xE1lcool, rem\xE9dio de uso cont\xEDnuo"
33820
+ },
33821
+ {
33822
+ id: "wardrobe",
33823
+ teamName: "Guarda-roupa",
33824
+ gameKey: "guarda",
33825
+ places: [
33826
+ "house",
32801
33827
  "apartment"
32802
33828
  ],
32803
33829
  count: [
@@ -46238,6 +47264,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
46238
47264
  impact: {
46239
47265
  response: "dent",
46240
47266
  pushImpulse: true
47267
+ },
47268
+ use: {
47269
+ clip: "use_hygiene",
47270
+ sounds: [
47271
+ "scrub"
47272
+ ]
46241
47273
  }
46242
47274
  }
46243
47275
  }
@@ -49825,6 +50857,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
49825
50857
  items: [
49826
50858
  "alcohol_70",
49827
50859
  "povidone_iodine"
50860
+ ],
50861
+ params: {
50862
+ clip: "apply_dressing"
50863
+ }
50864
+ },
50865
+ {
50866
+ id: "wash",
50867
+ effect: "wash",
50868
+ consumes: false,
50869
+ items: [
50870
+ "soap",
50871
+ "shampoo",
50872
+ "toothpaste",
50873
+ "toothbrush",
50874
+ "deodorant",
50875
+ "towel"
49828
50876
  ]
49829
50877
  },
49830
50878
  {
@@ -51147,6 +52195,29 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51147
52195
  "kind.hygiene.description": "Sabonete, pasta de dente, papel higi\xEAnico e toalha."
51148
52196
  };
51149
52197
  var GOODS_STRINGS = { en: en_default2, "pt-BR": pt_BR_default2 };
52198
+ var drinkHydrationOf = (item, liquids = LIQUIDS) => {
52199
+ const fluid = item.fluid;
52200
+ const drink = fluid ? liquids.find((liquid) => liquid.id === fluid.liquid)?.drink : void 0;
52201
+ if (!fluid || !drink) return void 0;
52202
+ const doses = item.durability?.kind === "doses" ? Math.max(1, item.durability.amount ?? 1) : 1;
52203
+ return drink.thirst * fluid.liters / doses;
52204
+ };
52205
+ var createGoodsItemUse = (options = {}) => {
52206
+ const kinds = options.kinds ?? createGoodsKinds();
52207
+ const effects = options.effects ?? GOODS_USE_EFFECTS;
52208
+ const liquids = options.liquids ?? LIQUIDS;
52209
+ return (item) => {
52210
+ if (item.kind === void 0 || !kinds.has(item.kind)) return void 0;
52211
+ const result2 = resolveUse(item, effects);
52212
+ const { clip: effectClip, ...params } = result2?.params ?? {};
52213
+ const clip = typeof effectClip === "string" ? effectClip : resolveEntry(kinds, item).use?.clip;
52214
+ if (clip === void 0) return void 0;
52215
+ if (!result2) return { clip, consumes: false };
52216
+ const nutrition = result2.nutrition ? { satiety: result2.nutrition.satiety, hydration: drinkHydrationOf(item, liquids) ?? result2.nutrition.hydration } : {};
52217
+ return { clip, consumes: result2.consumes, effect: { id: result2.effect, ...Object.keys(params).length > 0 ? { params } : {}, ...nutrition } };
52218
+ };
52219
+ };
52220
+ var goodsItemUse = createGoodsItemUse();
51150
52221
 
51151
52222
  // ../game-interactables-household/dist/index.js
51152
52223
  var door = (material, joint2 = "hinge", piece2 = "door") => ({ material, joint: joint2, piece: piece2 });
@@ -51158,6 +52229,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51158
52229
  var fridgeLike = { body: { material: "steel", joint: "weld" }, parts: [[/^door/, door("steel")]] };
51159
52230
  var bin = { body: { material: "plastic", joint: "fused" }, parts: [["lid", door("plastic", "hinge", "lid")]] };
51160
52231
  var upholstery = { material: "fabric", joint: "glue" };
52232
+ var POLE_CAGE = { material: "steel", spacing: 0.1, diameter: 0.01 };
51161
52233
  var DESTRUCTION = {
51162
52234
  fridge: fridgeLike,
51163
52235
  fridge_compact: fridgeLike,
@@ -51183,7 +52255,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51183
52255
  },
51184
52256
  wall_socket: { body: { material: "plastic", joint: "screw" }, parts: [] },
51185
52257
  wall_switch: { body: { material: "plastic", joint: "screw" }, parts: [["rocker", { material: "plastic", joint: "clip", piece: "rocker" }]] },
51186
- service_entrance: { body: { material: "steel", joint: "bolt" }, parts: [["meter_door", door("steel")]] },
52258
+ // 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
52259
+ service_entrance: { body: { material: "concrete", joint: "rebar", reinforcement: POLE_CAGE }, parts: [["meter_door", door("steel")]] },
51187
52260
  conduit_run: { body: { material: "plastic", joint: "clip" }, parts: [] },
51188
52261
  service_mast: { body: { material: "steel", joint: "clip" }, parts: [] },
51189
52262
  electrical_panel: {
@@ -51847,7 +52920,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51847
52920
  h: 0.7,
51848
52921
  y: 1.4,
51849
52922
  solid: true,
51850
- massKg: 15
52923
+ massKg: 15,
52924
+ fixed: true
51851
52925
  },
51852
52926
  {
51853
52927
  id: "pantry",
@@ -51932,7 +53006,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51932
53006
  h: 1.2,
51933
53007
  y: 0,
51934
53008
  solid: true,
51935
- massKg: 40
53009
+ massKg: 40,
53010
+ fixed: true
51936
53011
  },
51937
53012
  {
51938
53013
  id: "sink_bathroom",
@@ -51942,7 +53017,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51942
53017
  h: 1.05,
51943
53018
  y: 0,
51944
53019
  solid: true,
51945
- massKg: 25
53020
+ massKg: 25,
53021
+ fixed: true
51946
53022
  },
51947
53023
  {
51948
53024
  id: "shower",
@@ -51952,7 +53028,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51952
53028
  h: 2.1,
51953
53029
  y: 0,
51954
53030
  solid: true,
51955
- massKg: 90
53031
+ massKg: 90,
53032
+ fixed: true
51956
53033
  },
51957
53034
  {
51958
53035
  id: "toilet",
@@ -51962,7 +53039,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51962
53039
  h: 0.8,
51963
53040
  y: 0,
51964
53041
  solid: true,
51965
- massKg: 30
53042
+ massKg: 30,
53043
+ fixed: true
51966
53044
  },
51967
53045
  {
51968
53046
  id: "utility_sink",
@@ -51972,7 +53050,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51972
53050
  h: 1.2,
51973
53051
  y: 0,
51974
53052
  solid: true,
51975
- massKg: 25
53053
+ massKg: 25,
53054
+ fixed: true
51976
53055
  },
51977
53056
  {
51978
53057
  id: "wall_socket",
@@ -52002,7 +53081,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52002
53081
  h: 6.5,
52003
53082
  y: 0,
52004
53083
  solid: true,
52005
- massKg: 60
53084
+ massKg: 320,
53085
+ fixed: true
52006
53086
  },
52007
53087
  {
52008
53088
  id: "service_mast",
@@ -54954,7 +56034,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
54954
56034
  }
54955
56035
  var residentialTower = residentialTowerTemplate();
54956
56036
 
54957
- // ../game-floorplan-three/dist/chunk-EYIWURKO.js
56037
+ // ../game-floorplan-three/dist/chunk-Z3IBCX7E.js
54958
56038
  var __defProp4 = Object.defineProperty;
54959
56039
  var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
54960
56040
  var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
@@ -62624,7 +63704,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
62624
63704
  w = Math.min(w, 0.5);
62625
63705
  d = Math.min(d, 0.5);
62626
63706
  }
62627
- inter().objs.push({ f: M.floor, cx: m.x, cz: m.z, c: Math.cos(M.ry), s: Math.sin(M.ry), hw: w / 2, hd: d / 2, type: m.type });
63707
+ inter().objs.push({ f: M.floor, cx: m.x, cz: m.z, c: Math.cos(M.ry), s: Math.sin(M.ry), hw: w / 2, hd: d / 2, h, type: m.type });
62628
63708
  }
62629
63709
  function objectDistance(o, x, z) {
62630
63710
  const dx = x - o.cx, dz = z - o.cz, lx = dx * o.c - dz * o.s, lz = dx * o.s + dz * o.c, ex = Math.abs(lx) - o.hw, ez = Math.abs(lz) - o.hd;
@@ -62665,8 +63745,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
62665
63745
  return drawer2 ? "drawer" : /^wardrobe/.test(type) ? "wardrobe" : /fridge|refrig|freezer/.test(type) ? "fridge" : /pantry/.test(type) ? "pantry" : "cabinet";
62666
63746
  }
62667
63747
  function recordApi(api) {
62668
- const calls = [], pr = { light: (MM, ...a) => api.light(MM, ...a) };
62669
- for (const n of ["box", "cylinder", "leaf", "plane"]) pr[n] = (MM, ...a) => {
63748
+ const calls = [], pr = { light: (MM2, ...a) => api.light(MM2, ...a) };
63749
+ for (const n of ["box", "cylinder", "leaf", "plane"]) pr[n] = (MM2, ...a) => {
62670
63750
  calls.push([n, a]);
62671
63751
  };
62672
63752
  return { pr, calls };
@@ -65416,11 +66496,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65416
66496
  drop(partId) {
65417
66497
  const hosts = [...new Set([views.get(partId), ...[...views.values()].filter((view) => view.parts.includes(partId))].filter((v) => !!v))];
65418
66498
  if (!hosts.length && lod === 0 && riders(partId).length > 0) {
65419
- const made = newView(partId);
65420
- if (made) {
65421
- cut(made);
65422
- views.set(partId, made);
65423
- hosts.push(made);
66499
+ const made2 = newView(partId);
66500
+ if (made2) {
66501
+ cut(made2);
66502
+ views.set(partId, made2);
66503
+ hosts.push(made2);
65424
66504
  }
65425
66505
  }
65426
66506
  for (const host of hosts) {
@@ -66582,11 +67662,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66582
67662
  let batcher = null;
66583
67663
  let changedAt = Number.NEGATIVE_INFINITY;
66584
67664
  const make3 = () => {
66585
- const made = createStaticBatcher(THREE, root, { shadowOnly: true, queue, budgetMs: HOUSE_SHADOW_BUDGET_MS, maxVertices: HOUSE_SHADOW_BATCH_VERTICES, include: (mesh3) => mesh3.userData.noShadowBatch !== true });
66586
- made.group.name = "house-shadow-batches";
66587
- made.group.userData.noSurfaceRay = true;
66588
- markKitOrigin(made.group, { owner: "game-floorplan-three", kind: "structure", id: root.name || "house" });
66589
- return made;
67665
+ const made2 = createStaticBatcher(THREE, root, { shadowOnly: true, queue, budgetMs: HOUSE_SHADOW_BUDGET_MS, maxVertices: HOUSE_SHADOW_BATCH_VERTICES, include: (mesh3) => mesh3.userData.noShadowBatch !== true });
67666
+ made2.group.name = "house-shadow-batches";
67667
+ made2.group.userData.noSurfaceRay = true;
67668
+ markKitOrigin(made2.group, { owner: "game-floorplan-three", kind: "structure", id: root.name || "house" });
67669
+ return made2;
66590
67670
  };
66591
67671
  return {
66592
67672
  update() {
@@ -66850,7 +67930,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66850
67930
  c.aabb = [c.x0, c.z0, c.x1, c.z1];
66851
67931
  if (c.type === "wall") c.damageable = tagDamage("masonry");
66852
67932
  }
66853
- const colliders = shared3.ctx.colliders.concat(shared3.inter.objs.map((o) => ({ type: "furniture", f: o.f, obb: { cx: o.cx, cz: o.cz, hw: o.hw, hd: o.hd, c: o.c, s: o.s }, item: o.type, off: false })));
67933
+ const colliders = shared3.ctx.colliders.concat(shared3.inter.objs.map((o) => ({ type: "furniture", f: o.f, obb: { cx: o.cx, cz: o.cz, hw: o.hw, hd: o.hd, c: o.c, s: o.s }, item: o.type, off: false, ...o.h !== void 0 ? { h: o.h } : {} })));
66854
67934
  const parts2 = {}, setOpen = (def, t) => {
66855
67935
  def.target = t;
66856
67936
  def.t = t;
@@ -67403,8 +68483,51 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67403
68483
  installBuildBuild(K, shared3);
67404
68484
  return buildApi(K, shared3);
67405
68485
  }
68486
+ var STRUCTURE_SKIN = {
68487
+ wood_hard: 0.018,
68488
+ wood_soft: 0.018,
68489
+ plywood: 0.015,
68490
+ mdf: 0.018,
68491
+ plastic: 4e-3,
68492
+ rubber: 5e-3,
68493
+ steel: 12e-4,
68494
+ aluminium: 2e-3,
68495
+ cast_iron: 6e-3,
68496
+ copper: 1e-3,
68497
+ glass: 5e-3,
68498
+ tempered_glass: 6e-3,
68499
+ ceramic: 8e-3
68500
+ };
68501
+ var FOAM_DENSITY = 30;
68502
+ var FABRIC_DENSITY = 400;
68503
+ var UPHOLSTERY_COVER = 3e-3;
68504
+ var shellFraction = (shape, skin) => {
68505
+ if (shape.kind === "box") {
68506
+ const [a, b, c] = shape.size;
68507
+ const inner = Math.max(0, a - 2 * skin) * Math.max(0, b - 2 * skin) * Math.max(0, c - 2 * skin);
68508
+ return 1 - inner / (a * b * c);
68509
+ }
68510
+ if (shape.kind === "cylinder") {
68511
+ const { radius: r, height: h } = shape;
68512
+ const inner = Math.max(0, r - skin) ** 2 * Math.max(0, h - 2 * skin);
68513
+ return 1 - inner / (r * r * h);
68514
+ }
68515
+ return 1 - (Math.max(0, shape.radius - skin) / shape.radius) ** 3;
68516
+ };
68517
+ var thinnest = (shape) => shape.kind === "box" ? Math.min(...shape.size) : shape.kind === "cylinder" ? Math.min(shape.radius * 2, shape.height) : shape.radius * 2;
68518
+ function structureFill(material, shape) {
68519
+ if (material === "fabric") {
68520
+ if (thinnest(shape) <= 4 * UPHOLSTERY_COVER) return 1;
68521
+ const cover = shellFraction(shape, UPHOLSTERY_COVER);
68522
+ return cover + (1 - cover) * (FOAM_DENSITY / FABRIC_DENSITY);
68523
+ }
68524
+ const skin = STRUCTURE_SKIN[material];
68525
+ if (skin === void 0 || thinnest(shape) <= 3 * skin) return 1;
68526
+ return shellFraction(shape, skin);
68527
+ }
67406
68528
  var HOLD_REACH2 = 0.05;
67407
68529
  var BACK_TOUCH = 0.02;
68530
+ var AGAINST_WALL = 0.1;
67408
68531
  var SOFT = /* @__PURE__ */ new Set(["fabric", "paper", "foliage"]);
67409
68532
  var gapOf = (a, b) => Math.max(0, ...[0, 1, 2].map((k) => Math.max(a.min[k] - b.max[k], b.min[k] - a.max[k])));
67410
68533
  function groupsOf(parts2, joints) {
@@ -67423,11 +68546,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67423
68546
  }
67424
68547
  return [...groups.values()];
67425
68548
  }
67426
- function nearestJoint(loose, held, boxOf3, reach2) {
68549
+ function nearestJoint(loose, held, boxOf4, reach2) {
67427
68550
  let best = null;
67428
68551
  for (const a of loose) {
67429
68552
  for (const b of held) {
67430
- const gap = gapOf(boxOf3(a.id), boxOf3(b.id));
68553
+ const gap = gapOf(boxOf4(a.id), boxOf4(b.id));
67431
68554
  if (gap <= reach2 && (!best || gap < best.gap)) best = { gap, a, b };
67432
68555
  }
67433
68556
  }
@@ -67437,21 +68560,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67437
68560
  }
67438
68561
  var FLOOR_TOUCH = 5e-3;
67439
68562
  var STANDS_ALONE = 0.3;
67440
- function standsAlone(group, boxOf3) {
67441
- const feet = group.map((part) => boxOf3(part.id)).filter((box5) => box5.min[1] <= FLOOR_TOUCH);
68563
+ function standsAlone(group, boxOf4) {
68564
+ const feet = group.map((part) => boxOf4(part.id)).filter((box5) => box5.min[1] <= FLOOR_TOUCH);
67442
68565
  if (feet.length === 0) return false;
67443
- const height = Math.max(...group.map((part) => boxOf3(part.id).max[1]));
68566
+ const height = Math.max(...group.map((part) => boxOf4(part.id).max[1]));
67444
68567
  const across2 = (k) => Math.max(...feet.map((box5) => box5.max[k])) - Math.min(...feet.map((box5) => box5.min[k]));
67445
68568
  return Math.min(across2(0), across2(2)) >= STANDS_ALONE * height;
67446
68569
  }
67447
- function joinBodies({ parts: parts2, joints, boxOf: boxOf3 }, byId) {
68570
+ function joinBodies({ parts: parts2, joints, boxOf: boxOf4 }, byId) {
67448
68571
  const groups = groupsOf(parts2, joints).map((ids) => ids.map((id) => byId.get(id))).sort((a, b) => b.length - a.length);
67449
68572
  const [main, ...rest2] = groups;
67450
68573
  if (!main) return;
68574
+ const mainHeld = main.some((part) => part.anchored);
67451
68575
  for (const group of rest2) {
67452
- if (standsAlone(group, boxOf3)) continue;
67453
- const joint2 = nearestJoint(group, main, boxOf3, Infinity);
67454
- if (joint2) joints.push(joint2);
68576
+ if (standsAlone(group, boxOf4)) continue;
68577
+ const joint2 = nearestJoint(group, main, boxOf4, Infinity);
68578
+ if (joint2) joints.push(mainHeld && group.some((part) => part.anchored) ? { ...joint2, tears: true } : joint2);
67455
68579
  }
67456
68580
  }
67457
68581
  function holdLooseGroups(params) {
@@ -67459,8 +68583,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67459
68583
  holdHanging(params, byId);
67460
68584
  joinBodies(params, byId);
67461
68585
  }
67462
- function holdHanging({ parts: parts2, joints, boxOf: boxOf3 }, byId) {
67463
- const back = Math.min(...parts2.map((part) => boxOf3(part.id).min[2]));
68586
+ function holdHanging({ parts: parts2, joints, boxOf: boxOf4 }, byId) {
68587
+ const back = Math.min(...parts2.map((part) => boxOf4(part.id).min[2]));
67464
68588
  for (let pass = 0; pass < parts2.length; pass++) {
67465
68589
  const groups = groupsOf(parts2, joints).map((ids) => ids.map((id) => byId.get(id)));
67466
68590
  const held = groups.filter((group) => group.some((part) => part.anchored)).flat();
@@ -67468,20 +68592,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67468
68592
  if (loose.length === 0) return;
67469
68593
  let changed = false;
67470
68594
  for (const group of loose) {
67471
- const joint2 = nearestJoint(group, held, boxOf3, HOLD_REACH2);
68595
+ const joint2 = nearestJoint(group, held, boxOf4, HOLD_REACH2);
67472
68596
  if (joint2) {
67473
68597
  joints.push(joint2);
67474
68598
  changed = true;
67475
68599
  continue;
67476
68600
  }
67477
- const onWall = group.filter((part) => !SOFT.has(part.material) && boxOf3(part.id).min[2] <= back + BACK_TOUCH);
68601
+ const againstWall = held.length === 0 || held.some((part) => boxOf4(part.id).min[2] <= back + AGAINST_WALL);
68602
+ const onWall = againstWall ? group.filter((part) => !SOFT.has(part.material) && boxOf4(part.id).min[2] <= back + BACK_TOUCH) : [];
67478
68603
  if (onWall.length === 0) continue;
67479
68604
  for (const part of onWall) part.anchored = true;
67480
68605
  changed = true;
67481
68606
  }
67482
68607
  if (changed) continue;
67483
68608
  for (const group of loose) {
67484
- const joint2 = nearestJoint(group, held, boxOf3, Infinity);
68609
+ const joint2 = nearestJoint(group, held, boxOf4, Infinity);
67485
68610
  if (joint2) joints.push(joint2);
67486
68611
  }
67487
68612
  return;
@@ -67514,7 +68639,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67514
68639
  if (carcassed) return tops;
67515
68640
  for (let i = drawn.length - 1; i >= 0; i--) {
67516
68641
  const p = drawn[i];
67517
- if (p.key !== "wood" || materialOf2.wood !== "wood_hard" || p.shape.kind !== "box" || p.rotation) continue;
68642
+ if (p.material || p.key !== "wood" || materialOf2.wood !== "wood_hard" || p.shape.kind !== "box" || p.rotation) continue;
67518
68643
  const [sx, sy, sz] = p.shape.size;
67519
68644
  const across2 = sx < sz ? 0 : 2;
67520
68645
  const width = Math.min(sx, sz);
@@ -67537,14 +68662,106 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67537
68662
  }
67538
68663
  return tops;
67539
68664
  }
67540
- function shadeBoard(color2, board) {
67541
- const k = [1, 0.94, 1.05, 0.97, 1.03][board % 5];
68665
+ var CASES = /^(tv_unit|tv_unit_small|tv_unit_large|sideboard|china_cabinet|pantry|laundry_cabinet|wardrobe|wardrobe_small|wardrobe_large|closet_wardrobe|kitchen_cabinet|kitchen_cabinet_large|kitchen_cabinet_small|display_stand|dresser|nightstand|console_table|vanity_table)$/;
68666
+ var DRAWER_CASES = /^(dresser|nightstand|console_table|vanity_table)$/;
68667
+ var CASE_BODY_MIN = 0.2;
68668
+ var FRONT_THICK = 0.03;
68669
+ var FRONT_REACH = 0.03;
68670
+ var CASE_BOARD = 0.018;
68671
+ var CASE_BACK = 6e-3;
68672
+ var DRAWER_SIDE = 0.012;
68673
+ var DRAWER_BOTTOM = 6e-3;
68674
+ var SHELF_PITCH = 0.45;
68675
+ var WARDROBES = /wardrobe/;
68676
+ var HANGING_SHELF_DROP = 0.35;
68677
+ function board(body, suffix, material, min2, max2, color2 = body.color) {
68678
+ const size = [max2[0] - min2[0], max2[1] - min2[1], max2[2] - min2[2]];
68679
+ const position = [(min2[0] + max2[0]) / 2, (min2[1] + max2[1]) / 2, (min2[2] + max2[2]) / 2];
68680
+ return { id: `${body.id}_${suffix}`, key: body.key, material, shape: { kind: "box", size }, position, rotation: null, color: color2, min: min2, max: max2 };
68681
+ }
68682
+ function hollowCases(drawn, type) {
68683
+ const made2 = /* @__PURE__ */ new Set();
68684
+ if (!CASES.test(type)) return made2;
68685
+ const drawers = DRAWER_CASES.test(type);
68686
+ for (let i = drawn.length - 1; i >= 0; i--) {
68687
+ const body = drawn[i];
68688
+ if (body.key !== "wood" && body.key !== "plain" || body.shape.kind !== "box" || body.rotation) continue;
68689
+ const [sx, sy, sz] = body.shape.size;
68690
+ if (Math.min(sx, sy, sz) < CASE_BODY_MIN) continue;
68691
+ const fronts = drawn.filter((p) => {
68692
+ if (p === body || p.shape.kind !== "box" || p.rotation || p.key !== "wood" && p.key !== "plain") return false;
68693
+ const thick = p.max[2] - p.min[2];
68694
+ if (thick > FRONT_THICK || thick >= p.max[0] - p.min[0] || thick >= p.max[1] - p.min[1]) return false;
68695
+ const cx = (p.min[0] + p.max[0]) / 2;
68696
+ const cy = (p.min[1] + p.max[1]) / 2;
68697
+ return Math.abs(p.min[2] - body.max[2]) <= FRONT_REACH && cx > body.min[0] && cx < body.max[0] && cy > body.min[1] && cy < body.max[1];
68698
+ });
68699
+ if (fronts.length === 0) continue;
68700
+ const [x0, y0, z0] = body.min;
68701
+ const [x1, y1, z1] = body.max;
68702
+ const T2 = CASE_BOARD;
68703
+ const zi = z0 + CASE_BACK;
68704
+ const inner = 0.92;
68705
+ const tone = (k) => {
68706
+ const c = (s) => Math.min(255, Math.round((body.color >> s & 255) * k)) << s;
68707
+ return c(16) | c(8) | c(0);
68708
+ };
68709
+ const boards = [
68710
+ board(body, "back", "plywood", [x0, y0, z0], [x1, y1, zi], tone(0.8)),
68711
+ board(body, "side_l", "mdf", [x0, y0, zi], [x0 + T2, y1, z1]),
68712
+ board(body, "side_r", "mdf", [x1 - T2, y0, zi], [x1, y1, z1]),
68713
+ board(body, "top", "mdf", [x0 + T2, y1 - T2, zi], [x1 - T2, y1, z1]),
68714
+ board(body, "bottom", "mdf", [x0 + T2, y0, zi], [x1 - T2, y0 + T2, z1], tone(inner))
68715
+ ];
68716
+ const ix0 = x0 + T2;
68717
+ const ix1 = x1 - T2;
68718
+ const iy0 = y0 + T2;
68719
+ const iy1 = y1 - T2;
68720
+ if (drawers) {
68721
+ const stack = [...fronts].sort((a, b) => a.min[1] - b.min[1]);
68722
+ stack.forEach((front, k) => {
68723
+ const dy0 = Math.max(front.min[1] + 0.01, iy0 + 2e-3);
68724
+ const dy1 = Math.min(front.max[1] - 0.02, iy1 - 2e-3);
68725
+ const dz0 = zi + 0.01;
68726
+ const dz1 = front.min[2];
68727
+ if (dy1 - dy0 < 0.04 || dz1 - dz0 < 0.1) return;
68728
+ const a = ix0 + 2e-3;
68729
+ const b = ix1 - 2e-3;
68730
+ boards.push(
68731
+ board(body, `drawer${k}_side_l`, "mdf", [a, dy0, dz0], [a + DRAWER_SIDE, dy1, dz1], tone(inner)),
68732
+ board(body, `drawer${k}_side_r`, "mdf", [b - DRAWER_SIDE, dy0, dz0], [b, dy1, dz1], tone(inner)),
68733
+ board(body, `drawer${k}_back`, "mdf", [a + DRAWER_SIDE, dy0, dz0], [b - DRAWER_SIDE, dy1, dz0 + DRAWER_SIDE], tone(inner)),
68734
+ board(body, `drawer${k}_bottom`, "mdf", [a + DRAWER_SIDE, dy0, dz0 + DRAWER_SIDE], [b - DRAWER_SIDE, dy0 + DRAWER_BOTTOM, dz1], tone(inner))
68735
+ );
68736
+ const above2 = stack[k + 1];
68737
+ if (!above2) return;
68738
+ const mid = (front.max[1] + above2.min[1]) / 2;
68739
+ if (above2.min[1] - front.max[1] < T2 || mid - T2 / 2 < dy1 || mid + T2 / 2 > iy1) return;
68740
+ boards.push(board(body, `rail${k}`, "mdf", [ix0, mid - T2 / 2, zi], [ix1, mid + T2 / 2, z1], tone(inner)));
68741
+ });
68742
+ } else {
68743
+ const height = iy1 - iy0;
68744
+ const count = Math.max(0, Math.round(height / SHELF_PITCH) - 1);
68745
+ const levels = WARDROBES.test(type) ? [iy1 - HANGING_SHELF_DROP] : Array.from({ length: count }, (_, k) => iy0 + (k + 1) * height / (count + 1));
68746
+ levels.forEach((y, k) => boards.push(board(body, `shelf${k}`, "mdf", [ix0, y - T2 / 2, zi], [ix1, y + T2 / 2, z1 - 0.02], tone(inner))));
68747
+ }
68748
+ for (const front of fronts) front.material = "mdf";
68749
+ drawn.splice(i, 1, ...boards);
68750
+ for (const b of boards) made2.add(b.id);
68751
+ }
68752
+ return made2;
68753
+ }
68754
+ function shadeBoard(color2, board2) {
68755
+ const k = [1, 0.94, 1.05, 0.97, 1.03][board2 % 5];
67542
68756
  const channel = (shift) => Math.min(255, Math.round((color2 >> shift & 255) * k)) << shift;
67543
68757
  return channel(16) | channel(8) | channel(0);
67544
68758
  }
67545
68759
  var FLOOR_TOUCH2 = 5e-3;
67546
68760
  var LOOSE = /* @__PURE__ */ new Set(["paper"]);
67547
- var PLANTED = /* @__PURE__ */ new Set(["mailbox", "correio", "clothesline", "tree_small", "bbq_simple"]);
68761
+ var PLANTED = /* @__PURE__ */ new Set(["mailbox", "correio", "clothesline", "tree_small", "fruit_tree", "bbq_simple"]);
68762
+ var INSTALLED = /* @__PURE__ */ new Set(["toilet", "washbasin", "pedestal_basin", "shower", "shower_large", "laundry_tub"]);
68763
+ var WEIGHTED_FOOT = /* @__PURE__ */ new Set(["floor_lamp"]);
68764
+ var FOOT_MATERIAL = "cast_iron";
67548
68765
  var BASE_MATERIAL = {
67549
68766
  wood: "wood_hard",
67550
68767
  metal: "steel",
@@ -67620,13 +68837,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67620
68837
  };
67621
68838
  run(A);
67622
68839
  if (!drawn.length) throw new Error(`game-floorplan-three: the builder of "${name}" drew no box or cylinder`);
68840
+ hollowCases(drawn, name);
67623
68841
  const boardsOf = splitTopsIntoBoards(drawn, materialOf2, Boolean(opts.carcass));
67624
68842
  const parts2 = drawn.map((p) => {
67625
68843
  const thin = Math.min(...p.shape.kind === "box" ? p.shape.size : p.shape.kind === "cylinder" ? [p.shape.radius * 2, p.shape.height] : [p.shape.radius * 2]);
67626
- let material = materialOf2[p.key] ?? "plastic";
67627
- if (p.key === "wood" && material === "wood_hard" && opts.carcass && !opts.materials?.wood) material = "mdf";
68844
+ let material = p.material ?? materialOf2[p.key] ?? "plastic";
68845
+ if (p.material) {
68846
+ } else if (p.key === "wood" && material === "wood_hard" && opts.carcass && !opts.materials?.wood) material = "mdf";
67628
68847
  else if (p.key === "wood" && material === "wood_hard" && thin < WOOD_THIN) material = "wood_soft";
68848
+ if (WEIGHTED_FOOT.has(name) && p.key === "metal" && p.min[1] <= FLOOR_TOUCH2) material = FOOT_MATERIAL;
67629
68849
  const part = { id: p.id, material, shape: p.shape, position: p.position };
68850
+ const fill22 = structureFill(material, p.shape);
68851
+ if (fill22 < 1) part.fill = Math.round(fill22 * 1e4) / 1e4;
67630
68852
  if (p.rotation) part.rotation = p.rotation;
67631
68853
  if (!LOOSE.has(material) && p.min[1] <= FLOOR_TOUCH2) part.anchored = true;
67632
68854
  if (opts.carcass && LOOSE.has(material)) {
@@ -67656,7 +68878,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67656
68878
  const wallMounted = parts2.some((part) => part.anchored && low(part) > FLOOR_TOUCH2);
67657
68879
  const sunk = parts2.some((part) => low(part) < -FLOOR_TOUCH2);
67658
68880
  const rooted = parts2.some((part) => part.material === "foliage") && parts2.some((part) => part.material.startsWith("wood") && low(part) <= FLOOR_TOUCH2);
67659
- const fixed2 = wallMounted || sunk || rooted || PLANTED.has(name);
68881
+ const fixed2 = wallMounted || sunk || rooted || PLANTED.has(name) || INSTALLED.has(name);
67660
68882
  const all = drawn.reduce(
67661
68883
  (m, p) => ({ x0: Math.min(m.x0, p.min[0]), x1: Math.max(m.x1, p.max[0]), z0: Math.min(m.z0, p.min[2]), z1: Math.max(m.z1, p.max[2]) }),
67662
68884
  { x0: Infinity, x1: -Infinity, z0: Infinity, z1: -Infinity }
@@ -67725,7 +68947,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67725
68947
  const root = { x: seed, z: 0, ry: 0, w, d, h, y: 0, base: 0, palette: o.palette, seed: `furniture_${type}_${seed}` };
67726
68948
  const { K, shared: shared3 } = renderer.internals;
67727
68949
  const before = K.PARTS.length;
67728
- const made = recordSpec(
68950
+ const made2 = recordSpec(
67729
68951
  THREE,
67730
68952
  type,
67731
68953
  root,
@@ -67744,7 +68966,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67744
68966
  );
67745
68967
  const spouts = K.PARTS.slice(before).filter((p) => p.type === "water_tap").map((p) => [p.pos[0] - root.x, p.pos[1], p.pos[2] - root.z]);
67746
68968
  K.PARTS.length = before;
67747
- return { spec: made.spec, build: made.build, top: made.top, size: { w, d, h }, spouts, fixed: made.fixed };
68969
+ return { spec: made2.spec, build: made2.build, top: made2.top, size: { w, d, h }, spouts, fixed: made2.fixed };
67748
68970
  }
67749
68971
 
67750
68972
  // ../game-physics/dist/index.js
@@ -67859,6 +69081,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67859
69081
  if (result2?.reason === "busy") return;
67860
69082
  }
67861
69083
  };
69084
+ const hasKind = (kind) => (host.tool().attachments ?? []).some((candidate) => arsenal.attachments.get(candidate.id)?.kind === kind);
69085
+ const hasLauncher = () => (host.tool().attachments ?? []).some((part) => arsenal.attachments.get(part.id)?.launcher !== void 0);
67862
69086
  const toggleKind = (kind) => {
67863
69087
  const part = (host.tool().attachments ?? []).find((candidate) => arsenal.attachments.get(candidate.id)?.kind === kind);
67864
69088
  if (!part) host.log(kind === "light" ? text.noLight : text.noLaser);
@@ -67873,8 +69097,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67873
69097
  };
67874
69098
  const switchUnderbarrel = () => {
67875
69099
  const tool2 = host.tool();
67876
- const hasLauncher = (tool2.attachments ?? []).some((part) => arsenal.attachments.get(part.id)?.launcher !== void 0);
67877
- if (!hasLauncher) host.log(text.noLauncher);
69100
+ if (!hasLauncher()) host.log(text.noLauncher);
67878
69101
  else host.command?.({ type: "underbarrel", on: tool2.underbarrelActive !== true });
67879
69102
  };
67880
69103
  const act = (id) => {
@@ -67911,7 +69134,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67911
69134
  const onKeyDown = (event) => {
67912
69135
  if (host.playerHeld?.()) return;
67913
69136
  if (event.repeat || event.ctrlKey || event.metaKey || event.altKey || TEXT_FIELDS.has(event.target?.tagName ?? "")) return;
67914
- const handled2 = event.code === ACCESSORY_KEYS.light ? act(ACTION_IDS.light) : event.code === ACCESSORY_KEYS.laser ? act(ACTION_IDS.laser) : event.code === ACCESSORY_KEYS.underbarrel ? act(ACTION_IDS.underbarrel) : event.code === ACCESSORY_KEYS.stock && toggleStock();
69137
+ const handled2 = event.code === ACCESSORY_KEYS.light ? hasKind("light") && act(ACTION_IDS.light) : event.code === ACCESSORY_KEYS.laser ? hasKind("laser") && act(ACTION_IDS.laser) : event.code === ACCESSORY_KEYS.underbarrel ? hasLauncher() && act(ACTION_IDS.underbarrel) : event.code === ACCESSORY_KEYS.stock && toggleStock();
67915
69138
  if (!handled2) return;
67916
69139
  event.preventDefault();
67917
69140
  event.stopImmediatePropagation();
@@ -81599,8 +82822,45 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
81599
82822
  { at: 1, ...HOLD }
81600
82823
  ]
81601
82824
  };
81602
- var TOOL_MOTIONS = /* @__PURE__ */ new Map([
81603
- ["shovel", /* @__PURE__ */ new Map([["dig", SHOVEL_DIG], ["fill", SHOVEL_FILL], ["swing", SHOVEL_SWING]])]
82825
+ var KNIFE_SLASH = {
82826
+ keys: [
82827
+ { at: 0, ...HOLD },
82828
+ { at: 0.3, offset: [0.06, 0.3, 0.04], turn: [0.35, 0, -0.5] },
82829
+ { at: 0.43, offset: [-0.1, 0.2, -0.2], turn: [-0.6, 0, 0.5] },
82830
+ { at: 0.62, offset: [-0.24, 0.04, -0.12], turn: [-1, 0, 0.9] },
82831
+ { at: 1, ...HOLD }
82832
+ ]
82833
+ };
82834
+ var KNIFE_STAB = {
82835
+ keys: [
82836
+ { at: 0, ...HOLD },
82837
+ { at: 0.28, offset: [0.02, 0.06, 0.08], turn: [0.15, 0, 0] },
82838
+ { at: 0.43, offset: [-0.04, 0.12, -0.22], turn: [-0.5, 0, 0] },
82839
+ { at: 0.6, offset: [-0.04, 0.11, -0.2], turn: [-0.45, 0, 0] },
82840
+ { at: 1, ...HOLD }
82841
+ ]
82842
+ };
82843
+ var ONE_HAND_CHOP = {
82844
+ keys: [
82845
+ { at: 0, ...HOLD },
82846
+ { at: 0.3, offset: [0.04, 0.4, 0.04], turn: [0.5, 0, -0.2] },
82847
+ { at: 0.43, offset: [-0.03, 0.18, -0.22], turn: [-0.6, 0, 0.1] },
82848
+ { at: 0.62, offset: [-0.05, -0.03, -0.18], turn: [-1.1, 0, 0.2] },
82849
+ { at: 1, ...HOLD }
82850
+ ]
82851
+ };
82852
+ var FAMILY_MOTIONS = /* @__PURE__ */ new Map([
82853
+ ["short_blade", /* @__PURE__ */ new Map([["slash", KNIFE_SLASH], ["stab", KNIFE_STAB]])],
82854
+ ["one_hand_swing", /* @__PURE__ */ new Map([["chop", ONE_HAND_CHOP]])],
82855
+ // a bat, a pipe or an axe swung with both hands goes as the shovel's swing
82856
+ ["two_hand_swing", /* @__PURE__ */ new Map([["swing", SHOVEL_SWING]])]
82857
+ ]);
82858
+ var TOOL_MOTIONS = new Map([
82859
+ ["shovel", /* @__PURE__ */ new Map([["dig", SHOVEL_DIG], ["fill", SHOVEL_FILL], ["swing", SHOVEL_SWING]])],
82860
+ ...MELEE_FAMILIES.flatMap((family) => {
82861
+ const motions = FAMILY_MOTIONS.get(family.id);
82862
+ return motions ? family.weapons.map((weapon2) => [weapon2, motions]) : [];
82863
+ })
81604
82864
  ]);
81605
82865
  var ease2 = (s) => s * s * (3 - 2 * s);
81606
82866
  function sampleToolMotion(motion, at4) {
@@ -81683,696 +82943,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
81683
82943
  return group;
81684
82944
  }
81685
82945
 
81686
- // ../game-fluids/dist/index.js
81687
- var liquids_default = [
81688
- {
81689
- id: "water",
81690
- color: 11064558,
81691
- opacity: 0.35,
81692
- stainColor: 7309206,
81693
- viscosity: 1,
81694
- density: 1e3,
81695
- dryTime: 180,
81696
- gloss: 0.9,
81697
- drink: {
81698
- thirst: 100,
81699
- effects: []
81700
- },
81701
- tags: [
81702
- "drink",
81703
- "clear"
81704
- ]
81705
- },
81706
- {
81707
- id: "coffee",
81708
- color: 3875604,
81709
- opacity: 0.95,
81710
- stainColor: 2824202,
81711
- viscosity: 1.5,
81712
- density: 1005,
81713
- dryTime: 900,
81714
- gloss: 0.8,
81715
- leavesMark: true,
81716
- steamC: 60,
81717
- drink: {
81718
- thirst: 80,
81719
- effects: [
81720
- "caffeine"
81721
- ]
81722
- },
81723
- tags: [
81724
- "drink",
81725
- "hot"
81726
- ]
81727
- },
81728
- {
81729
- id: "tea",
81730
- color: 9063188,
81731
- opacity: 0.8,
81732
- stainColor: 6961682,
81733
- viscosity: 1.4,
81734
- density: 1005,
81735
- dryTime: 800,
81736
- gloss: 0.8,
81737
- leavesMark: true,
81738
- steamC: 60,
81739
- drink: {
81740
- thirst: 90,
81741
- effects: []
81742
- },
81743
- tags: [
81744
- "drink",
81745
- "hot"
81746
- ]
81747
- },
81748
- {
81749
- id: "milk",
81750
- color: 16052712,
81751
- opacity: 0.98,
81752
- stainColor: 14473160,
81753
- viscosity: 2,
81754
- density: 1030,
81755
- dryTime: 900,
81756
- gloss: 0.5,
81757
- leavesMark: true,
81758
- drink: {
81759
- thirst: 70,
81760
- effects: []
81761
- },
81762
- tags: [
81763
- "drink"
81764
- ]
81765
- },
81766
- {
81767
- id: "soda",
81768
- color: 3808530,
81769
- opacity: 0.85,
81770
- stainColor: 2757901,
81771
- viscosity: 1.3,
81772
- density: 1040,
81773
- dryTime: 1200,
81774
- gloss: 0.85,
81775
- leavesMark: true,
81776
- drink: {
81777
- thirst: 60,
81778
- effects: []
81779
- },
81780
- tags: [
81781
- "drink",
81782
- "sticky"
81783
- ]
81784
- },
81785
- {
81786
- id: "juice",
81787
- color: 15239467,
81788
- opacity: 0.9,
81789
- stainColor: 12741916,
81790
- viscosity: 2,
81791
- density: 1045,
81792
- dryTime: 1100,
81793
- gloss: 0.8,
81794
- leavesMark: true,
81795
- drink: {
81796
- thirst: 75,
81797
- effects: []
81798
- },
81799
- tags: [
81800
- "drink",
81801
- "sticky"
81802
- ]
81803
- },
81804
- {
81805
- id: "beer",
81806
- color: 14259740,
81807
- opacity: 0.8,
81808
- stainColor: 11039764,
81809
- viscosity: 1.4,
81810
- density: 1010,
81811
- dryTime: 900,
81812
- gloss: 0.8,
81813
- drink: {
81814
- thirst: 50,
81815
- effects: [
81816
- "alcohol"
81817
- ]
81818
- },
81819
- tags: [
81820
- "drink",
81821
- "alcohol"
81822
- ]
81823
- },
81824
- {
81825
- id: "wine",
81826
- color: 7016223,
81827
- opacity: 0.9,
81828
- stainColor: 5048854,
81829
- viscosity: 1.6,
81830
- density: 990,
81831
- dryTime: 800,
81832
- gloss: 0.85,
81833
- leavesMark: true,
81834
- drink: {
81835
- thirst: 40,
81836
- effects: [
81837
- "alcohol"
81838
- ]
81839
- },
81840
- tags: [
81841
- "drink",
81842
- "alcohol"
81843
- ]
81844
- },
81845
- {
81846
- id: "spirits",
81847
- color: 13214042,
81848
- opacity: 0.6,
81849
- stainColor: 10320959,
81850
- viscosity: 1.8,
81851
- density: 940,
81852
- dryTime: 200,
81853
- gloss: 0.85,
81854
- flammable: true,
81855
- drink: {
81856
- thirst: 5,
81857
- effects: [
81858
- "alcohol"
81859
- ]
81860
- },
81861
- tags: [
81862
- "drink",
81863
- "alcohol"
81864
- ]
81865
- },
81866
- {
81867
- id: "fuel",
81868
- color: 14926682,
81869
- opacity: 0.6,
81870
- stainColor: 7232298,
81871
- viscosity: 0.6,
81872
- density: 740,
81873
- dryTime: 60,
81874
- gloss: 0.95,
81875
- leavesMark: false,
81876
- flammable: true,
81877
- drink: {
81878
- thirst: 0,
81879
- effects: [
81880
- "poison"
81881
- ]
81882
- },
81883
- tags: [
81884
- "fuel",
81885
- "gasoline"
81886
- ]
81887
- },
81888
- {
81889
- id: "diesel",
81890
- color: 12098094,
81891
- opacity: 0.8,
81892
- stainColor: 5917208,
81893
- viscosity: 3,
81894
- density: 830,
81895
- dryTime: 3600,
81896
- gloss: 0.95,
81897
- leavesMark: true,
81898
- flammable: true,
81899
- drink: {
81900
- thirst: 0,
81901
- effects: [
81902
- "poison"
81903
- ]
81904
- },
81905
- tags: [
81906
- "fuel"
81907
- ]
81908
- },
81909
- {
81910
- id: "motor_oil",
81911
- color: 3877388,
81912
- opacity: 0.95,
81913
- stainColor: 1840134,
81914
- viscosity: 100,
81915
- density: 880,
81916
- dryTime: 0,
81917
- gloss: 1,
81918
- leavesMark: true,
81919
- flammable: true,
81920
- drink: {
81921
- thirst: 0,
81922
- effects: [
81923
- "poison"
81924
- ]
81925
- },
81926
- tags: [
81927
- "oil"
81928
- ]
81929
- },
81930
- {
81931
- id: "cooking_oil",
81932
- color: 14267708,
81933
- opacity: 0.85,
81934
- stainColor: 11110698,
81935
- viscosity: 60,
81936
- density: 920,
81937
- dryTime: 0,
81938
- gloss: 1,
81939
- leavesMark: true,
81940
- flammable: true,
81941
- drink: {
81942
- thirst: 0,
81943
- effects: [
81944
- "poison"
81945
- ]
81946
- },
81947
- tags: [
81948
- "oil",
81949
- "food"
81950
- ]
81951
- },
81952
- {
81953
- id: "blood",
81954
- color: 7997964,
81955
- opacity: 0.92,
81956
- stainColor: 3874068,
81957
- viscosity: 4,
81958
- density: 1060,
81959
- dryTime: 600,
81960
- gloss: 0.75,
81961
- leavesMark: true,
81962
- drink: {
81963
- thirst: 10,
81964
- effects: [
81965
- "disgust"
81966
- ]
81967
- },
81968
- tags: [
81969
- "organic"
81970
- ]
81971
- },
81972
- {
81973
- id: "old_blood",
81974
- color: 7085078,
81975
- opacity: 0.92,
81976
- stainColor: 2758158,
81977
- viscosity: 4,
81978
- density: 1060,
81979
- dryTime: 360,
81980
- gloss: 0.7,
81981
- leavesMark: true,
81982
- drink: {
81983
- thirst: 10,
81984
- effects: [
81985
- "disgust"
81986
- ]
81987
- },
81988
- tags: [
81989
- "organic"
81990
- ]
81991
- },
81992
- {
81993
- id: "bile",
81994
- color: 9083434,
81995
- opacity: 0.9,
81996
- stainColor: 4080160,
81997
- viscosity: 6,
81998
- density: 1020,
81999
- dryTime: 900,
82000
- gloss: 0.75,
82001
- leavesMark: true,
82002
- drink: {
82003
- thirst: 0,
82004
- effects: [
82005
- "disgust"
82006
- ]
82007
- },
82008
- tags: [
82009
- "organic"
82010
- ]
82011
- },
82012
- {
82013
- id: "sap",
82014
- color: 13146940,
82015
- opacity: 0.8,
82016
- stainColor: 10122282,
82017
- viscosity: 200,
82018
- density: 1100,
82019
- dryTime: 3600,
82020
- gloss: 0.8,
82021
- leavesMark: true,
82022
- drink: {
82023
- thirst: 20,
82024
- effects: []
82025
- },
82026
- tags: [
82027
- "organic",
82028
- "sticky"
82029
- ]
82030
- },
82031
- {
82032
- id: "acid",
82033
- color: 10146378,
82034
- opacity: 0.6,
82035
- stainColor: 7313970,
82036
- viscosity: 1.5,
82037
- density: 1200,
82038
- dryTime: 900,
82039
- gloss: 0.9,
82040
- leavesMark: true,
82041
- drink: {
82042
- thirst: 0,
82043
- effects: [
82044
- "poison"
82045
- ]
82046
- },
82047
- tags: [
82048
- "corrosive"
82049
- ]
82050
- },
82051
- {
82052
- id: "paint",
82053
- color: 11740715,
82054
- opacity: 0.98,
82055
- stainColor: 9050655,
82056
- viscosity: 300,
82057
- density: 1300,
82058
- dryTime: 1800,
82059
- gloss: 0.6,
82060
- leavesMark: true,
82061
- drink: {
82062
- thirst: 0,
82063
- effects: [
82064
- "poison"
82065
- ]
82066
- },
82067
- tags: [
82068
- "paint"
82069
- ]
82070
- },
82071
- {
82072
- id: "bleach",
82073
- color: 15134688,
82074
- opacity: 0.7,
82075
- stainColor: 13621446,
82076
- viscosity: 1.2,
82077
- density: 1100,
82078
- dryTime: 900,
82079
- gloss: 0.85,
82080
- leavesMark: true,
82081
- drink: {
82082
- thirst: 0,
82083
- effects: [
82084
- "poison"
82085
- ]
82086
- },
82087
- tags: [
82088
- "corrosive"
82089
- ]
82090
- },
82091
- {
82092
- id: "sewage",
82093
- color: 5921582,
82094
- opacity: 0.92,
82095
- stainColor: 3093273,
82096
- viscosity: 4,
82097
- density: 1010,
82098
- dryTime: 1800,
82099
- gloss: 0.8,
82100
- leavesMark: true,
82101
- drink: {
82102
- thirst: 0,
82103
- effects: [
82104
- "disgust",
82105
- "poison"
82106
- ]
82107
- },
82108
- tags: [
82109
- "organic",
82110
- "waste"
82111
- ]
82112
- },
82113
- {
82114
- id: "honey",
82115
- color: 14193162,
82116
- opacity: 0.9,
82117
- stainColor: 12089350,
82118
- viscosity: 3e3,
82119
- density: 1420,
82120
- dryTime: 14400,
82121
- gloss: 0.95,
82122
- leavesMark: true,
82123
- drink: {
82124
- thirst: 10,
82125
- effects: []
82126
- },
82127
- tags: [
82128
- "drink",
82129
- "sticky"
82130
- ]
82131
- },
82132
- {
82133
- id: "mud",
82134
- color: 4008988,
82135
- opacity: 0.95,
82136
- stainColor: 3811866,
82137
- viscosity: 40,
82138
- density: 1600,
82139
- dryTime: 900,
82140
- gloss: 0.4,
82141
- tags: [
82142
- "dirty"
82143
- ]
82144
- },
82145
- {
82146
- id: "coolant",
82147
- color: 3455050,
82148
- opacity: 0.7,
82149
- stainColor: 2783796,
82150
- viscosity: 4,
82151
- density: 1070,
82152
- dryTime: 1200,
82153
- gloss: 0.85,
82154
- leavesMark: true,
82155
- drink: {
82156
- thirst: 0,
82157
- effects: [
82158
- "poison"
82159
- ]
82160
- },
82161
- tags: [
82162
- "coolant"
82163
- ]
82164
- },
82165
- {
82166
- id: "brake_fluid",
82167
- color: 13145646,
82168
- opacity: 0.8,
82169
- stainColor: 9069600,
82170
- viscosity: 8,
82171
- density: 1050,
82172
- dryTime: 3600,
82173
- gloss: 0.9,
82174
- leavesMark: true,
82175
- drink: {
82176
- thirst: 0,
82177
- effects: [
82178
- "poison"
82179
- ]
82180
- },
82181
- tags: [
82182
- "brake_fluid"
82183
- ]
82184
- }
82185
- ];
82186
- var LIQUIDS = liquids_default;
82187
- var SAMPLES = 16;
82188
- var COS = [];
82189
- var SIN = [];
82190
- for (let i = 0; i < SAMPLES; i++) {
82191
- COS.push(Math.cos(i / SAMPLES * Math.PI * 2));
82192
- SIN.push(Math.sin(i / SAMPLES * Math.PI * 2));
82193
- }
82194
- var RUNOFF_TILT = 6 * Math.PI / 180;
82195
- var RUNOFF_TILT_MAX = 60 * Math.PI / 180;
82196
- function hashCell(x, y) {
82197
- let value = x * 374761393 + y * 668265263 | 0;
82198
- value = (value ^ value >>> 13) * 1274126177 | 0;
82199
- return ((value ^ value >>> 16) >>> 0) / 4294967296;
82200
- }
82201
- function valueNoise(x, y) {
82202
- const xi = Math.floor(x);
82203
- const yi = Math.floor(y);
82204
- const xf = x - xi;
82205
- const yf = y - yi;
82206
- const u = xf * xf * (3 - 2 * xf);
82207
- const v = yf * yf * (3 - 2 * yf);
82208
- const a = hashCell(xi, yi);
82209
- const b = hashCell(xi + 1, yi);
82210
- const c = hashCell(xi, yi + 1);
82211
- const d = hashCell(xi + 1, yi + 1);
82212
- return a + (b - a) * u + (c - a) * v + (a - b - c + d) * u * v;
82213
- }
82214
- var REGION_NAMES = ["wall", "sidewalk", "curb", "road"];
82215
- var dot3 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
82216
- function impactOf(region, position, velocity2, cellSize) {
82217
- const local2 = [position[0] - region.origin[0], position[1] - region.origin[1], position[2] - region.origin[2]];
82218
- return {
82219
- row: region.firstRow + dot3(local2, region.rowAxis) / cellSize,
82220
- column: dot3(local2, region.columnAxis) / cellSize,
82221
- along: [dot3(velocity2, region.columnAxis), dot3(velocity2, region.rowAxis)],
82222
- normalSpeed: -dot3(velocity2, region.normal)
82223
- };
82224
- }
82225
- function cellToWorldOf(regions, cellSize, row, column) {
82226
- let region = regions[regions.length - 1];
82227
- for (const candidate of regions) {
82228
- if (row < candidate.firstRow + candidate.rowCount) {
82229
- region = candidate;
82230
- break;
82231
- }
82232
- }
82233
- const across2 = column * cellSize;
82234
- const down2 = (row - region.firstRow) * cellSize;
82235
- return [
82236
- region.origin[0] + region.columnAxis[0] * across2 + region.rowAxis[0] * down2,
82237
- region.origin[1] + region.columnAxis[1] * across2 + region.rowAxis[1] * down2,
82238
- region.origin[2] + region.columnAxis[2] * across2 + region.rowAxis[2] * down2
82239
- ];
82240
- }
82241
- function createFoldedLayout(params) {
82242
- const { columns, cellSize, originX, wallRows, sidewalkRows, curbRows, roadRows, wallTopY, sidewalkY, roadY, wallZ, rules } = params;
82243
- const curbStep = params.curbStep ?? (sidewalkY - roadY) / curbRows;
82244
- const height = wallRows + sidewalkRows + curbRows + roadRows;
82245
- const cellCount = columns * height;
82246
- const bed = new Float32Array(cellCount);
82247
- const pin = new Float32Array(cellCount);
82248
- const vertical = new Float32Array(cellCount);
82249
- const sidewalkEnd = wallRows + sidewalkRows;
82250
- const curbEnd = sidewalkEnd + curbRows;
82251
- const regionOfRow = (row) => row < wallRows ? 0 : row < sidewalkEnd ? 1 : row < curbEnd ? 2 : 3;
82252
- for (let row = 0; row < height; row++) {
82253
- for (let column = 0; column < columns; column++) {
82254
- const index = row * columns + column;
82255
- const region = regionOfRow(row);
82256
- const x = originX + (column + 0.5) * cellSize;
82257
- let bedHeight;
82258
- let roughness = 0.2;
82259
- if (region === 0) {
82260
- bedHeight = (wallTopY - (row + 0.5) * cellSize) * 1e3;
82261
- roughness = 0.3;
82262
- } else if (region === 1) {
82263
- const z = (row - wallRows + 0.5) * cellSize;
82264
- bedHeight = sidewalkY * 1e3 - z * 6;
82265
- const jointX = Math.abs(((x - originX) % 0.5 + 0.5) % 0.5 - 0.25);
82266
- const jointZ = Math.abs((z % 0.5 + 0.5) % 0.5 - 0.25);
82267
- if (jointX > 0.25 - cellSize * 0.6 || jointZ > 0.25 - cellSize * 0.6) bedHeight -= 0.9;
82268
- roughness = 0.18;
82269
- } else if (region === 2) {
82270
- bedHeight = sidewalkY * 1e3 - (row - sidewalkEnd + 0.5) * curbStep * 1e3;
82271
- } else {
82272
- const z = (row - curbEnd + 0.5) * cellSize;
82273
- bedHeight = roadY * 1e3 + z * 14 - (x - params.roadSlopeAnchorX) * 5;
82274
- roughness = 0.55;
82275
- }
82276
- const noise3 = valueNoise(column * 0.35, row * 0.35) * 0.6 + valueNoise(column * 1.3, row * 1.3) * 0.4;
82277
- bed[index] = bedHeight + (noise3 - 0.5) * roughness * 2;
82278
- vertical[index] = region === 0 || region === 2 ? 0.95 : 1;
82279
- pin[index] = 0.62 + 0.76 * (valueNoise(column * 0.21 + 40, row * 0.21) * 0.5 + hashCell(column, row) * 0.5) * (region === 3 ? 1.25 : 1);
82280
- }
82281
- }
82282
- const curbZ = wallZ + sidewalkRows * cellSize;
82283
- const roadEndZ = curbZ + roadRows * cellSize;
82284
- const right = [1, 0, 0];
82285
- const regions = [
82286
- { id: REGION_NAMES[0], firstRow: 0, rowCount: wallRows, origin: [originX, wallTopY, wallZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
82287
- { id: REGION_NAMES[1], firstRow: wallRows, rowCount: sidewalkRows, origin: [originX, sidewalkY, wallZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false },
82288
- { id: REGION_NAMES[2], firstRow: sidewalkEnd, rowCount: curbRows, origin: [originX, sidewalkY, curbZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
82289
- { id: REGION_NAMES[3], firstRow: curbEnd, rowCount: roadRows, origin: [originX, roadY, curbZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false }
82290
- ];
82291
- const maxX = originX + columns * cellSize;
82292
- return {
82293
- id: params.id,
82294
- width: columns,
82295
- height,
82296
- cellSize,
82297
- bed,
82298
- pin,
82299
- vertical,
82300
- regions,
82301
- rules,
82302
- cellToWorld: (row, column) => cellToWorldOf(regions, cellSize, row, column),
82303
- collide(previous, position) {
82304
- if (position[2] <= wallZ && position[1] > sidewalkY) {
82305
- position[2] = wallZ;
82306
- return 0;
82307
- }
82308
- if (position[2] < curbZ && (!rules.guardBehindWall || position[2] >= wallZ) && position[1] <= sidewalkY) {
82309
- position[1] = sidewalkY;
82310
- return 1;
82311
- }
82312
- if (rules.curbCatch && position[2] >= curbZ && previous[2] < curbZ && position[1] < sidewalkY) {
82313
- position[2] = curbZ;
82314
- return 2;
82315
- }
82316
- if (position[2] >= curbZ && position[1] <= roadY) {
82317
- position[1] = roadY;
82318
- return 3;
82319
- }
82320
- return -1;
82321
- },
82322
- impact: (region, position, velocity2) => impactOf(regions[region], position, velocity2, cellSize),
82323
- contains: (position) => position[0] > originX && position[0] < maxX && (!rules.clipRoadEnd || position[2] < roadEndZ),
82324
- escaped(position) {
82325
- if (position[1] < -1) return true;
82326
- const box5 = rules.escapeBox;
82327
- return box5 !== void 0 && (position[0] < box5.minX || position[0] > box5.maxX || position[2] > box5.maxZ);
82328
- }
82329
- };
82330
- }
82331
- var PADRAO_CELL = 0.0125;
82332
- var PADRAO_WALL_Z = 0;
82333
- var PADRAO_LAYOUT = createFoldedLayout({
82334
- id: "padrao",
82335
- columns: 256,
82336
- cellSize: PADRAO_CELL,
82337
- originX: -1.6,
82338
- wallRows: 144,
82339
- sidewalkRows: 128,
82340
- curbRows: 12,
82341
- roadRows: 112,
82342
- wallTopY: 1.95,
82343
- sidewalkY: 0.15,
82344
- roadY: 0,
82345
- wallZ: PADRAO_WALL_Z,
82346
- curbStep: PADRAO_CELL,
82347
- roadSlopeAnchorX: 0,
82348
- rules: {
82349
- dropCapacity: 600,
82350
- curbCatch: true,
82351
- guardBehindWall: true,
82352
- clipRoadEnd: true,
82353
- escapeBox: { minX: -3, maxX: 3, maxZ: PADRAO_WALL_Z + 128 * PADRAO_CELL + 112 * PADRAO_CELL + 1 },
82354
- dripStyle: "padrao"
82355
- }
82356
- });
82357
- var WORKSHOP_CELL = 0.0125;
82358
- var WORKSHOP_LAYOUT = createFoldedLayout({
82359
- id: "workshop",
82360
- columns: 160,
82361
- cellSize: WORKSHOP_CELL,
82362
- originX: -2.2,
82363
- wallRows: 160,
82364
- sidewalkRows: 128,
82365
- curbRows: 9,
82366
- roadRows: 151,
82367
- wallTopY: 2.12,
82368
- sidewalkY: 0.1235,
82369
- roadY: 9e-3,
82370
- wallZ: -4.497,
82371
- roadSlopeAnchorX: -1.2,
82372
- rules: { dropCapacity: 400, curbCatch: false, guardBehindWall: false, clipRoadEnd: false, dripStyle: "workshop" }
82373
- });
82374
-
82375
- // ../game-items-three/dist/chunk-S4UUQQOL.js
82946
+ // ../game-items-three/dist/chunk-64JEKMFT.js
82376
82947
  var destruction_default = {
82377
82948
  families: {
82378
82949
  drink_can: {
@@ -86840,13 +87411,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
86840
87411
  const hole = metal2(1842463);
86841
87412
  const corners = [[2.5, 1.8], [-2.5, 1.8], [2.5, -1.8], [-2.5, -1.8]];
86842
87413
  return G(
86843
- mesh3(bx(6, 0.02, 4.5), zinc, [0, -5e-3, 0]),
86844
- mesh3(bx(6, 0.01, 0.16), edge, [0, 0.01, 2.17]),
86845
- mesh3(bx(6, 0.01, 0.16), edge, [0, 0.01, -2.17]),
86846
- mesh3(bx(0.16, 0.01, 4.18), edge, [2.92, 0.01, 0]),
86847
- mesh3(bx(0.16, 0.01, 4.18), edge, [-2.92, 0.01, 0]),
86848
- mesh3(bx(1.2, 0.01, 0.8), metal2(8014380), [-0.8, 0.01, -0.4]),
86849
- ...corners.map(([x, z]) => mesh3(cyl(0.12, 0.12, 0.01, 8), hole, [x, 0.01, z]))
87414
+ mesh3(bx(5.68, 6e-3, 4.18), zinc, [0, 0, 0]),
87415
+ mesh3(bx(6, 0.03, 0.16), edge, [0, 0, 2.17]),
87416
+ mesh3(bx(6, 0.03, 0.16), edge, [0, 0, -2.17]),
87417
+ mesh3(bx(0.16, 0.03, 4.18), edge, [2.92, 0, 0]),
87418
+ mesh3(bx(0.16, 0.03, 4.18), edge, [-2.92, 0, 0]),
87419
+ mesh3(bx(1.2, 0.03, 0.8), metal2(8014380), [-0.8, 0, -0.4]),
87420
+ ...corners.map(([x, z]) => mesh3(cyl(0.12, 0.12, 0.03, 8), hole, [x, 0, z]))
86850
87421
  );
86851
87422
  };
86852
87423
  var cementBag = ({ mesh: mesh3, bx, G, paper: paper2, cloth: cloth2 }) => {
@@ -87714,7 +88285,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
87714
88285
  };
87715
88286
  var laptop = ({ mesh: mesh3, cyl, bx, G, metal: metal2, plastic }) => G(
87716
88287
  mesh3(bx(0.36, 0.012, 0.25), metal2(9277588), [0, 6e-3, 0]),
87717
- mesh3(bx(0.358, 0.012, 0.248), metal2(2895667), [0, 0.017, 0]),
88288
+ mesh3(bx(0.356, 0.012, 0.246), metal2(2895667), [0, 0.017, 0]),
88289
+ // the lid 2 mm inside the base's sides (CLAUDE.md §13)
87718
88290
  mesh3(cyl(6e-3, 6e-3, 0.2, 8), plastic(1842204), [0, 0.0125, -0.12], [0, 0, Math.PI / 2]),
87719
88291
  mesh3(bx(0.05, 42e-4, 0.03), metal2(11843514), [0, 0.0231, 0])
87720
88292
  );
@@ -89164,7 +89736,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
89164
89736
  const q2 = new THREE.Quaternion();
89165
89737
  const pointForward = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI / 2);
89166
89738
  const frontOf = new THREE.Vector3();
89167
- const restBox = new THREE.Box3();
89739
+ const restBox2 = new THREE.Box3();
89168
89740
  const noMotion = new THREE.Vector3();
89169
89741
  let inLens = false;
89170
89742
  const setLens = (on) => {
@@ -89180,7 +89752,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
89180
89752
  def = arsenal.weapons.get(weapon2) ?? null;
89181
89753
  if (!def || BODY_ACTIONS.has(def.id)) return;
89182
89754
  model = buildWeaponModel(THREE, def, options.items);
89183
- restBox.setFromObject(model);
89755
+ restBox2.setFromObject(model);
89184
89756
  inLens = false;
89185
89757
  const length2 = new THREE.Box3().setFromObject(model).getSize(v).x;
89186
89758
  rear = new THREE.Box3().setFromObject(model).min.x;
@@ -89350,7 +89922,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
89350
89922
  setLens(true);
89351
89923
  const held = heldHold();
89352
89924
  const kind = isOneHand() && def?.action.kind === "firearm" ? "dual" : "tool";
89353
- placeInView({ THREE, hand, holder: model, camera: camera2, right: heldAnchor(held), box: restBox, kind, aim: 0, offset: noMotion, ...side === "L" ? { mirror: true } : {} });
89925
+ placeInView({ THREE, hand, holder: model, camera: camera2, right: heldAnchor(held), box: restBox2, kind, aim: 0, offset: noMotion, ...side === "L" ? { mirror: true } : {} });
89354
89926
  hand.position.add(v.set(0, -0.12 * dip, 0.05 * kick).applyQuaternion(camera2.quaternion));
89355
89927
  applyMotion(camera2.quaternion);
89356
89928
  hand.updateMatrixWorld(true);
@@ -97297,7 +97869,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
97297
97869
  return [carrier.origin[0] + turned[0], carrier.origin[1] + turned[1], carrier.origin[2] + turned[2]];
97298
97870
  }
97299
97871
  var CAPACITY3 = 400;
97300
- var IDENTITY2 = [0, 0, 0, 1];
97872
+ var IDENTITY3 = [0, 0, 0, 1];
97301
97873
  function multiply2(a, b) {
97302
97874
  const [ax, ay, az, aw] = a;
97303
97875
  const [bx, by, bz, bw] = b;
@@ -97313,7 +97885,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
97313
97885
  get count() {
97314
97886
  return this.particles.length;
97315
97887
  }
97316
- spawn(options, frame2 = IDENTITY2, carried) {
97888
+ spawn(options, frame2 = IDENTITY3, carried) {
97317
97889
  const velocity2 = options.v ?? [0, 0, 0];
97318
97890
  const world = options.wv ?? [0, 0, 0];
97319
97891
  const particle = {
@@ -98303,7 +98875,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
98303
98875
  }
98304
98876
  var DEGREES = 180 / Math.PI;
98305
98877
 
98306
- // ../game-vfx-three/dist/chunk-EE6XER4D.js
98878
+ // ../game-vfx-three/dist/chunk-ACY6ZQC5.js
98307
98879
  var GLOW_VERTEX = `attribute vec4 aP;attribute vec4 aC;varying vec2 vU;varying vec4 vC;
98308
98880
  void main(){vec3 R=vec3(viewMatrix[0][0],viewMatrix[1][0],viewMatrix[2][0]);vec3 Up=vec3(viewMatrix[0][1],viewMatrix[1][1],viewMatrix[2][1]);
98309
98881
  vec3 wp=aP.xyz+(R*position.x+Up*position.y)*aP.w;vU=position.xy;vC=aC;gl_Position=projectionMatrix*viewMatrix*vec4(wp,1.);}`;
@@ -99351,8 +99923,48 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
99351
99923
  }
99352
99924
  };
99353
99925
  }
99354
- var REST_LAYER = 2e-3;
99355
- var REST_LAYERS = 4;
99926
+ var REST_STEP = 15e-4;
99927
+ var REST_TRIES = 8;
99928
+ var SAME_NORMAL = 0.9995;
99929
+ var restBox = () => ({ c: new Float64Array(3), axes: new Float64Array(9), half: new Float64Array(3), ext: new Float64Array(3) });
99930
+ function boxOf3(piece2, out) {
99931
+ const cx = Math.cos(piece2.rx), sx = Math.sin(piece2.rx), cy = Math.cos(piece2.ry), sy = Math.sin(piece2.ry), cz = Math.cos(piece2.rz), sz = Math.sin(piece2.rz);
99932
+ const a = out.axes;
99933
+ a[0] = cy * cz;
99934
+ a[1] = sx * sy * cz + cx * sz;
99935
+ a[2] = sx * sz - cx * sy * cz;
99936
+ a[3] = -cy * sz;
99937
+ a[4] = cx * cz - sx * sy * sz;
99938
+ a[5] = cx * sy * sz + sx * cz;
99939
+ a[6] = sy;
99940
+ a[7] = -sx * cy;
99941
+ a[8] = cx * cy;
99942
+ out.half[0] = piece2.sx / 2;
99943
+ out.half[1] = piece2.sy / 2;
99944
+ out.half[2] = piece2.sz / 2;
99945
+ out.c[0] = piece2.x;
99946
+ out.c[1] = piece2.y;
99947
+ out.c[2] = piece2.z;
99948
+ for (let w = 0; w < 3; w++) out.ext[w] = Math.abs(a[w]) * out.half[0] + Math.abs(a[3 + w]) * out.half[1] + Math.abs(a[6 + w]) * out.half[2];
99949
+ }
99950
+ function sharedPlane(a, b, push) {
99951
+ for (let w = 0; w < 3; w++) if (Math.abs(a.c[w] - b.c[w]) >= a.ext[w] + b.ext[w] + REST_STEP) return false;
99952
+ for (let i = 0; i < 3; i++) for (let j = 0; j < 3; j++) {
99953
+ const ax = a.axes[3 * i], ay = a.axes[3 * i + 1], az = a.axes[3 * i + 2];
99954
+ const dot2 = ax * b.axes[3 * j] + ay * b.axes[3 * j + 1] + az * b.axes[3 * j + 2];
99955
+ if (Math.abs(dot2) < SAME_NORMAL) continue;
99956
+ const ca = ax * a.c[0] + ay * a.c[1] + az * a.c[2];
99957
+ const cb = ax * b.c[0] + ay * b.c[1] + az * b.c[2];
99958
+ for (let side = -1; side <= 1; side += 2) {
99959
+ if (Math.abs(ca + side * a.half[i] - (cb + side * b.half[j])) >= REST_STEP * 0.75) continue;
99960
+ push[0] = ax * side;
99961
+ push[1] = ay * side;
99962
+ push[2] = az * side;
99963
+ return true;
99964
+ }
99965
+ }
99966
+ return false;
99967
+ }
99356
99968
  function debrisLayer(THREE, pool) {
99357
99969
  const geometry = new THREE.BoxGeometry(1, 1, 1);
99358
99970
  const material = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.45, metalness: 0.25, flatShading: true });
@@ -99367,6 +99979,36 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
99367
99979
  const matrix = new THREE.Matrix4();
99368
99980
  const colour = new THREE.Color();
99369
99981
  const hidden = new THREE.Matrix4().makeScale(0, 0, 0);
99982
+ const offset = new Float64Array(DEBRIS_CAPACITY * 3);
99983
+ const settled = new Uint8Array(DEBRIS_CAPACITY);
99984
+ const boxes = Array.from({ length: DEBRIS_CAPACITY }, restBox);
99985
+ const push = new Float64Array(3);
99986
+ const settle = (index) => {
99987
+ const box5 = boxes[index];
99988
+ boxOf3(pool.pieces[index], box5);
99989
+ let dx = 0, dy = 0, dz = 0;
99990
+ for (let tries = 0; tries < REST_TRIES; tries++) {
99991
+ let clash = false;
99992
+ for (let other = 0; other < DEBRIS_CAPACITY && !clash; other++) {
99993
+ if (other === index || !settled[other]) continue;
99994
+ if (!sharedPlane(box5, boxes[other], push)) continue;
99995
+ clash = true;
99996
+ const up = Math.abs(push[1]) > 0.7;
99997
+ const ux = up ? 0 : push[0], uy = up ? 1 : push[1], uz = up ? 0 : push[2];
99998
+ dx += ux * REST_STEP;
99999
+ dy += uy * REST_STEP;
100000
+ dz += uz * REST_STEP;
100001
+ box5.c[0] = box5.c[0] + ux * REST_STEP;
100002
+ box5.c[1] = box5.c[1] + uy * REST_STEP;
100003
+ box5.c[2] = box5.c[2] + uz * REST_STEP;
100004
+ }
100005
+ if (!clash) break;
100006
+ }
100007
+ offset[3 * index] = dx;
100008
+ offset[3 * index + 1] = dy;
100009
+ offset[3 * index + 2] = dz;
100010
+ settled[index] = 1;
100011
+ };
99370
100012
  for (let index = 0; index < DEBRIS_CAPACITY; index++) mesh3.setMatrixAt(index, hidden);
99371
100013
  mesh3.setColorAt(0, colour.setHex(16777215));
99372
100014
  return {
@@ -99375,16 +100017,18 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
99375
100017
  let drawn = false;
99376
100018
  for (let index = 0; index < DEBRIS_CAPACITY; index++) {
99377
100019
  const piece2 = pool.pieces[index];
100020
+ if (!piece2.on || !piece2.rest) settled[index] = 0;
99378
100021
  if (!piece2.on) {
99379
100022
  mesh3.setMatrixAt(index, hidden);
99380
100023
  continue;
99381
100024
  }
100025
+ if (piece2.rest && !settled[index]) settle(index);
99382
100026
  drawn = true;
99383
100027
  const shrink = Math.min(1, piece2.life / FADE_SECONDS2);
99384
100028
  euler.set(piece2.rx, piece2.ry, piece2.rz);
99385
100029
  quaternion2.setFromEuler(euler);
99386
- const lift = piece2.rest ? index % REST_LAYERS * REST_LAYER : 0;
99387
- matrix.compose(position.set(piece2.x, piece2.y + lift, piece2.z), quaternion2, scale.set(piece2.sx * shrink, piece2.sy * shrink, piece2.sz * shrink));
100030
+ const off = piece2.rest ? 3 * index : -1;
100031
+ matrix.compose(position.set(piece2.x + (off >= 0 ? offset[off] : 0), piece2.y + (off >= 0 ? offset[off + 1] : 0), piece2.z + (off >= 0 ? offset[off + 2] : 0)), quaternion2, scale.set(piece2.sx * shrink, piece2.sy * shrink, piece2.sz * shrink));
99388
100032
  mesh3.setMatrixAt(index, matrix);
99389
100033
  mesh3.setColorAt(index, colour.setHex(piece2.color));
99390
100034
  }
@@ -101106,7 +101750,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
101106
101750
  const modelBox = new THREE.Box3().setFromObject(model.root);
101107
101751
  const length2 = modelBox.getSize(new THREE.Vector3()).x;
101108
101752
  modelRear = modelBox.min.x;
101109
- restBox.copy(modelBox);
101753
+ restBox2.copy(modelBox);
101110
101754
  lens2 = null;
101111
101755
  lensLayer = -1;
101112
101756
  holder.add(model.root);
@@ -101176,7 +101820,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
101176
101820
  let reach2 = 0;
101177
101821
  let pull = 0;
101178
101822
  let lift = 0;
101179
- const restBox = new THREE.Box3();
101823
+ const restBox2 = new THREE.Box3();
101180
101824
  let lens2 = null;
101181
101825
  let lensLayer = -1;
101182
101826
  const lensPoint = new THREE.Vector3();
@@ -101275,7 +101919,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
101275
101919
  if (options.firstPerson?.()) {
101276
101920
  const kind = oneHand ? "dual" : session.model.parts.carry === "hip" ? "hip" : family === "pistol" || family === "revolver" ? "handgun" : family === "rocket" ? "launcher" : "long";
101277
101921
  const aim = oneHand || kind === "hip" ? 0 : options.aim?.() ?? 0;
101278
- placeInView({ THREE, hand, holder, camera: camera2, right: heldAnchor(held), box: restBox, kind, aim, offset: viewMotion(dt, aim), ...side === "L" ? { mirror: true } : {} });
101922
+ placeInView({ THREE, hand, holder, camera: camera2, right: heldAnchor(held), box: restBox2, kind, aim, offset: viewMotion(dt, aim), ...side === "L" ? { mirror: true } : {} });
101279
101923
  setLens(kind);
101280
101924
  lift = 0;
101281
101925
  pull = 0;