@adatechnology/game-weapons-three 0.27.6 → 0.29.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,90 @@ ${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: "bat_swing",
17269
+ note: "a club in both hands (bat, pipe, crowbar, sledgehammer): drawn back behind the right shoulder, swung level through the chest with the hips and shoulders turning, and carried round over the left shoulder (follow-through)",
17270
+ weapons: [
17271
+ "baseball_bat",
17272
+ "nail_bat",
17273
+ "iron_pipe",
17274
+ "crowbar",
17275
+ "sledgehammer"
17276
+ ],
17277
+ blows: [
17278
+ {
17279
+ clip: "bat_swing",
17280
+ motion: "bat_swing",
17281
+ seconds: 0.7
17282
+ }
17283
+ ],
17284
+ reset: 1.2
17285
+ },
17286
+ {
17287
+ id: "two_hand_swing",
17288
+ note: "a long weapon in both hands with its weight at the head or an edge (axe, pickaxe, katana): swung flat and low from the right shoulder across the body, the hips leading, as the shovel's swing",
17289
+ weapons: [
17290
+ "axe",
17291
+ "pickaxe",
17292
+ "katana"
17293
+ ],
17294
+ blows: [
17295
+ {
17296
+ clip: "shovel_swing",
17297
+ motion: "swing",
17298
+ seconds: 0.6
17299
+ }
17300
+ ],
17301
+ reset: 1.2
17302
+ }
17303
+ ]
17304
+ };
17305
+ var MELEE_FAMILIES = melee_families_default.families;
17167
17306
 
17168
17307
  // ../game-render-three/dist/index.js
17169
17308
  var DEFAULT_ANGLE = Math.PI / 3;
@@ -17555,7 +17694,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
17555
17694
  shade: () => shade
17556
17695
  });
17557
17696
 
17558
- // ../game-shapes/dist/chunk-E3X7UDDV.js
17697
+ // ../game-shapes/dist/chunk-QETSTM6M.js
17559
17698
  function canonicalJson(value) {
17560
17699
  if (value === null) return "null";
17561
17700
  if (typeof value === "number") return Object.is(value, -0) ? "-0" : Number.isFinite(value) ? String(value) : JSON.stringify(String(value));
@@ -19877,7 +20016,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19877
20016
  K.cyl("metal", 0, y - 0.06, 0, 0.14, 0.015, gold);
19878
20017
  for (let i = 0; i < 6; i++) {
19879
20018
  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);
20019
+ 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
20020
  K.cyl("plain", cx * 0.28, y - 0.06, cz * 0.28, 0.02, 0.09, 15787720);
19882
20021
  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
20022
  K.box("glass", cx * 0.3, y - 0.2, cz * 0.3, 0.025, 0.14, 0.025, 16777215, -an);
@@ -19940,10 +20079,17 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19940
20079
  B.sofa_l = (M, a) => {
19941
20080
  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
20081
  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);
20082
+ if (M.visorScene) {
20083
+ K.box("fabric", -(cw / 2), 0.08, zb + pf / 2, w - cw, 0.26, pf, cd);
20084
+ K.box("fabric", w / 2 - cw / 2, 0.08, 0, cw, 0.26, d, cd);
20085
+ } else {
20086
+ const zf = zb + 0.22, xs = -w / 2 + 0.18;
20087
+ K.box("fabric", (xs + w / 2 - cw) / 2, 0.08, (zf + zb + pf) / 2, w / 2 - cw - xs, 0.26, zb + pf - zf, cd);
20088
+ K.box("fabric", w / 2 - cw / 2, 0.08, (zf + d / 2) / 2, cw, 0.26, d / 2 - zf, cd);
20089
+ }
19945
20090
  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);
20091
+ if (M.visorScene) K.box("fabric", -w / 2 + 0.09, 0.08, zb + pf / 2, 0.18, 0.55, pf, cd);
20092
+ 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
20093
  const nm = 2, mw = (w - cw - 0.18) / nm;
19948
20094
  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
20095
  K.box("fabric", w / 2 - cw / 2, 0.34, 0.035, cw - 0.04, 0.16, d - 0.2, c);
@@ -19962,7 +20108,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19962
20108
  K.box("fabric", 0, 0.55, -d / 2 + 0.5, 0.4, 0.16, 0.12, accent, 0, 0.5);
19963
20109
  const hw = w + 0.5, n = Math.round(hw / 0.11);
19964
20110
  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));
20111
+ 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
20112
  for (const s of [-1, 1]) {
19967
20113
  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
20114
  K.cyl("plain", s * (w / 2 + 0.3), 0.51, -d / 2 + 0.2, 0.06, 0.03, 15262940);
@@ -19974,8 +20120,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19974
20120
  const K = kit(M, a), { w, d } = K.dim("home_office"), wood = K.wood(13808780), zb = -d / 2;
19975
20121
  K.box("wood", 0, 0.72, 0, w, 0.035, d, wood);
19976
20122
  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);
20123
+ 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);
20124
+ K.box("plain", w / 2 - 0.25, 0.28, 0, 0.4, M.visorScene ? 0.44 : 0.436, d - 0.08, 15262940);
19979
20125
  for (let i = 0; i < 2; i++) {
19980
20126
  K.box("plain", w / 2 - 0.25, 0.3 + i * 0.2, d / 2 - 0.04, 0.37, 0.18, 0.01, 15920870);
19981
20127
  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 +20140,11 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19994
20140
  const zc = d / 2 + 0.3, cc = K.fabric(2763310);
19995
20141
  K.box("plain", 0, 0.44, zc, 0.48, 0.07, 0.46, cc);
19996
20142
  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);
20143
+ K.cyl("metal", 0, M.visorScene ? 0.06 : 0.07, zc, 0.025, M.visorScene ? 0.38 : 0.37, 2763306);
19998
20144
  for (let i = 0; i < 5; i++) {
19999
20145
  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);
20146
+ const lo = M.visorScene ? 0 : i * 15e-4;
20147
+ 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
20148
  K.cyl("plain", x, 0, z, 0.03, 0.05, 1710618);
20002
20149
  }
20003
20150
  };
@@ -20007,9 +20154,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20007
20154
  K.box("plain", 0, 0, -d / 2 + 0.01, inner, M.visorScene ? h : h - 0.03, 0.02, shade(wood, 0.95));
20008
20155
  for (const s of [-1, 1]) K.box("plain", s * (w / 2 - 0.015), 0, 0, 0.03, h, d, wood);
20009
20156
  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);
20157
+ 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);
20158
+ K.box("plain", 0, 0, 0, M.visorScene ? w - 0.04 : w - 0.06, 0.06, d - 0.06, 2763306);
20159
+ if (M.visorScene) K.box("plain", dv, 0.06, 0, 0.025, h - 0.09, d - 0.02, wood);
20160
+ else K.box("plain", dv, 0.08, 0.01, 0.025, h - 0.11, d - 0.04, wood);
20013
20161
  const rod = h * 0.76;
20014
20162
  K.cyl("metal", (-w / 2 + dv) / 2, rod, 0, 0.012, dv + w / 2 - 0.06, 11580600, 0, Math.PI / 2);
20015
20163
  K.box("plain", (-w / 2 + dv) / 2, rod + 0.05, 0, dv + w / 2 - 0.05, 0.02, d - 0.04, wood);
@@ -20036,7 +20184,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20036
20184
  };
20037
20185
  B.vanity = (M, a) => {
20038
20186
  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);
20187
+ K.cyl("plain", 0, M.visorScene ? 0 : 0.03, zb + 0.12, 0.08, M.visorScene ? 0.7 : 0.67, br);
20040
20188
  K.cyl("plain", 0, 0, zb + 0.12, 0.1, 0.03, br);
20041
20189
  K.box("plain", 0, 0.74, 0, w, 0.12, d, br);
20042
20190
  K.box("plain", 0, 0.865, 0.02, w - 0.1, 0.012, d - 0.1, 13949146);
@@ -20047,8 +20195,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20047
20195
  K.box("plain", 0, 1.1, zb + 0.012, 0.52, 0.72, 0.024, K.color("metal", 14999768));
20048
20196
  K.plane("atlas_picture", 0, 1.46, zb + 0.026, 0.46, 0.66, 16777215, 0, 0, 0, atlas("picture").mirror());
20049
20197
  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));
20198
+ K.box("metal", -w / 2 - 0.02, M.visorScene ? 0.95 : 0.958, zb + 0.06, 0.28, 0.014, 0.014, 11580600);
20199
+ 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
20200
  };
20053
20201
  B.tv_stand = (M, a) => {
20054
20202
  const K = kit(M, a), { w, d } = K.dim("tv_stand"), wood = K.wood(13148272), br = K.color("fabric_main", 15789542);
@@ -20092,7 +20240,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20092
20240
  K.box("plain", w * 0.38, 0, z0 + 0.35, 0.5, 0.4, 0.4, 12098154, 0.2);
20093
20241
  K.box("plain", w * 0.4, 0.4, z0 + 0.33, 0.45, 0.35, 0.38, 11044954, -0.3);
20094
20242
  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));
20243
+ 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
20244
  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
20245
  }
20098
20246
  K.box("wood", -w * 0.4, 0, z0 + 0.9, 0.4, 0.04, 0.4, wood, 0.3, 0, 0.4);
@@ -20151,10 +20299,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20151
20299
  const K = kit(M, a), y = M.y || 0, cs = [13148208, 11549226, 4880954, 14209200, 9058858], rw = [4, 3, 2];
20152
20300
  rw.forEach((n, r) => {
20153
20301
  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);
20302
+ const x = (i - (n - 1) / 2) * 0.072, c = cs[(i + r * 2) % cs.length], ry = y + r * (M.visorScene ? 0.1 : 0.104);
20303
+ K.cyl("plain", x, ry, 0, 0.033, 0.1, c);
20304
+ K.cyl("plain", x, ry + 0.02, 0, 0.0345, 0.055, 15262936);
20305
+ K.cyl("metal", x, ry + 0.1, 0, 0.031, 4e-3, 12106944);
20158
20306
  }
20159
20307
  });
20160
20308
  K.cyl("plain", 0.3, y + 0.033, 0.1, 0.033, 0.1, 13148208, 0, Math.PI / 2);
@@ -20173,10 +20321,11 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20173
20321
  const K = kit(M, a), { w, d } = K.dim("floor_mattress"), h = 0.17, c = K.fabric(13156528), ac = K.accent(6965818);
20174
20322
  K.box("fabric", 0, 0, 0, w, h, d, c);
20175
20323
  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);
20324
+ const v = M.visorScene ? 0 : 1;
20325
+ 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);
20326
+ 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);
20327
+ 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);
20328
+ 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
20329
  };
20181
20330
  B.lantern = (M, a) => {
20182
20331
  const K = kit(M, a), y = M.y || 0;
@@ -20195,7 +20344,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20195
20344
  K.cyl("plain", x, y + 0.012, z, 0.017, h, 15787720);
20196
20345
  K.cyl("emissive", x, y + 0.012 + h, z, 8e-3, 0.03, i % 2 ? 16760928 : 16767120, 0, 0, "sphere");
20197
20346
  });
20198
- K.cyl("plain", 0.02, y + 0.012, 0, 0.05, 8e-3, 15787720);
20347
+ K.cyl("plain", 0.02, y + (M.visorScene ? 0.012 : 0.01), 0, 0.05, M.visorScene ? 8e-3 : 0.01, 15787720);
20199
20348
  if (M.lit !== false) K.light(0, y + 0.22, 0, 16756832, 5, "candles");
20200
20349
  };
20201
20350
  B.open_suitcases = (M, a) => {
@@ -20204,7 +20353,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20204
20353
  const lx = x, hz2 = z - dd / 2;
20205
20354
  K.box("plain", lx, 0, z, ww, 0.16, dd, c, ry);
20206
20355
  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);
20356
+ 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
20357
  K.ramp("plain", lx, 0.16, hz2, ww, 0.07, dd, c, al);
20209
20358
  K.box("metal", lx + ww * 0.3, 0.1, z + dd / 2, 0.04, 0.03, 0.01, 12632256);
20210
20359
  };
@@ -20213,18 +20362,31 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20213
20362
  };
20214
20363
  B.clothes_on_floor = (M, a) => {
20215
20364
  const K = kit(M, a), { w, d } = K.dim("clothes_on_floor"), cs = [13156520, 4876938, 11028538, 14736592, 6982234, 2763312, K.accent(13146698)];
20365
+ let k = 0;
20366
+ const tops = [];
20367
+ const lay = (m, x, y, z, bw, h, bd, c, r) => {
20368
+ if (M.visorScene) {
20369
+ K.box(m, x, y, z, bw, h, bd, c, r);
20370
+ return;
20371
+ }
20372
+ const y0 = 4e-3 + k++ * 15e-4;
20373
+ let top = y0 + h;
20374
+ while (tops.some((t) => Math.abs(t - top) < 13e-4)) top += 13e-4;
20375
+ tops.push(top);
20376
+ K.box(m, x, y0, z, bw, top - y0, bd, c, r);
20377
+ };
20216
20378
  for (let i = 0; i < 9; i++) {
20217
20379
  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
20380
  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);
20381
+ lay("fabric", x, y, z, 0.3, 0.012, 0.36, c, r);
20382
+ 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
20383
  } 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);
20384
+ 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);
20385
+ } else lay("fabric", x, y, z, 0.14, 0.01, 0.07, c, r);
20224
20386
  }
20225
20387
  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);
20388
+ lay("plain", sx, 0.012, sz, 0.09, 0.07, 0.27, 2763306, 0.4);
20389
+ lay("plain", sx + 0.15, 0.012, sz + 0.05, 0.09, 0.07, 0.27, 2763306, 0.9);
20228
20390
  };
20229
20391
  B.fallen_chair = (M, a) => {
20230
20392
  const g = Math.PI / 2, dy = 0.23, api = { box: (Mm, mat, x, y, z, w, h, d, color2, ry, rx, rz) => {
@@ -20238,17 +20400,30 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20238
20400
  };
20239
20401
  B.blood_stains = (M, a) => {
20240
20402
  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);
20403
+ let n = 0;
20404
+ const film = () => {
20405
+ const y0 = 0.011 - n * 11e-4, y1 = 0.0125 + n * 11e-4;
20406
+ n++;
20407
+ return { y: y0, h: y1 - y0 };
20408
+ };
20409
+ for (let k = 0; k < 7; k++) {
20410
+ const f = film();
20411
+ 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);
20412
+ }
20242
20413
  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);
20414
+ const an = K.rnd() * 6.28, r = 0.3 + K.rnd() * Math.min(w, d) * 0.4, f = film();
20415
+ 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);
20416
+ }
20417
+ if (M.drag !== false) for (let k = 1; k < 6; k++) {
20418
+ const f = film();
20419
+ 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
20420
  }
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
20421
  };
20248
20422
  B.open_door = (M, a) => {
20249
20423
  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));
20424
+ const jh = M.visorScene ? h + 0.06 : h;
20425
+ K.box("wood", -w / 2 - 0.03, 0, 0, 0.06, jh, d, shade(wood, 0.8));
20426
+ K.box("wood", w / 2 + 0.03, 0, 0, 0.06, jh, d, shade(wood, 0.8));
20252
20427
  K.box("wood", 0, h, 0, w + 0.12, 0.06, d, shade(wood, 0.8));
20253
20428
  K.box("wood", hx + Math.cos(angle) * L / 2, 0, Math.sin(angle) * L / 2, L, h - 0.02, 0.04, wood, -angle);
20254
20429
  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 +20543,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20368
20543
  for (const s of [-1, 1]) K.box("plain", s * (w / 2 + t / 2), 0, 0, t, 0.1, d, bo);
20369
20544
  cover(a, M, "pool_tile", { w, d, y: 0.035, size: 1 });
20370
20545
  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);
20546
+ 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
20547
  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);
20548
+ 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
20549
  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
20550
  K.box("metal", -w / 4 + s * 0.2, 0, d / 2 - 0.25, 0.03, 0.88, 0.03, 13159632, 0, 0);
20376
20551
  }
@@ -20380,20 +20555,22 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20380
20555
  const K = kit(M, a), { w, d } = K.dim("deck"), h = 0.2, wood = K.wood(6965808);
20381
20556
  K.box("wood", 0, 0, 0, w - 0.05, h, d - 0.05, shade(wood, 0.7));
20382
20557
  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));
20558
+ 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);
20559
+ const sz = M.visorScene ? d / 2 + 0.17 : d / 2 + 0.025 + 0.1575, sd = M.visorScene ? 0.34 : 0.315;
20560
+ K.box("wood", 0, 0, sz, 1.4, 0.1, sd, wood);
20561
+ K.box("wood", 0, 0.1, sz, 1.4, 0.012, sd, shade(wood, 1.2));
20386
20562
  };
20387
20563
  B.sun_lounger = (M, a) => {
20388
20564
  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
20565
  for (const s of [-1, 1]) {
20390
20566
  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);
20567
+ const lw = M.visorScene ? 0.035 : 0.025;
20568
+ K.box("metal", s * (w / 2 - 0.03), 0, 0.95, lw, 0.2, 0.035, fr);
20569
+ K.box("metal", s * (w / 2 - 0.03), 0, -0.3, lw, 0.2, 0.035, fr);
20393
20570
  K.cyl("plain", s * (w / 2 - 0.03), 0.07, -0.3, 0.07, 0.03, 2763306, 0, Math.PI / 2);
20394
20571
  }
20395
20572
  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);
20573
+ K.ramp("fabric", 0, 0.2, -0.3, M.visorScene ? w - 0.1 : w - 0.104, 0.06, 0.8, cu, al);
20397
20574
  for (let i = 0; i < 4; i++) {
20398
20575
  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
20576
  }
@@ -20469,7 +20646,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20469
20646
  for (const s of [-1, 1]) {
20470
20647
  K.box("plain", s * 0.35, py + 0.05, pz, 0.04, 0.42, 0.74, az);
20471
20648
  }
20472
- K.box("plain", 0, py + 0.05, pz - 0.35, 0.74, 0.42, 0.04, az);
20649
+ K.box("plain", 0, py + 0.05, pz - 0.35, M.visorScene ? 0.74 : 0.66, 0.42, 0.04, az);
20473
20650
  const run = d / 2 - pz - 0.4, al = Math.atan2(py - 0.1, run);
20474
20651
  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
20652
  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 +20656,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20479
20656
  };
20480
20657
  B.swing = (M, a) => {
20481
20658
  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);
20659
+ 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
20660
  K.box("metal", 0, h - 0.04, 0, w + 0.1, 0.1, 0.1, shade(mt, 0.85));
20484
20661
  const cs = [K.accent(13123642), 2763306];
20485
20662
  for (let i = 0; i < 2; i++) {
@@ -20491,11 +20668,11 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20491
20668
  B.bbq_simple = (M, a) => {
20492
20669
  const K = kit(M, a), { w, d } = K.dim("bbq_simple"), br = K.color("exterior_floor", 11688512), hb = 0.78;
20493
20670
  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);
20671
+ 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);
20672
+ 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
20673
  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
20674
  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);
20675
+ 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
20676
  for (let i = 0; i < 3; i++) {
20500
20677
  const z = (i - 1) * 0.15;
20501
20678
  K.cyl("metal", 0, hb + 0.05, z, 6e-3, w + 0.12, 11580600, 0, Math.PI / 2);
@@ -20511,7 +20688,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20511
20688
  const cz = -0.35;
20512
20689
  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
20690
  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);
20691
+ K.box("glass", 0, M.visorScene ? 0.76 : 0.762, cz, w - 0.06, M.visorScene ? 0.5 : 0.496, 1.6, 16777215);
20515
20692
  K.box("glass", 0, 0.76, cz + 0.8, w - 0.12, 0.5, 0.04, 16777215, 0, 0.5);
20516
20693
  for (const s of [-1, 1]) {
20517
20694
  K.box("plain", s * 0.4, 0.55, cz + 0.4, 0.4, 0.3, 0.4, 2763310);
@@ -20537,10 +20714,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20537
20714
  K.box("plain", xa, 0, zc, 1.6, 0.85, 0.7, br);
20538
20715
  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
20716
  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);
20717
+ const sd = M.visorScene ? 0.7 : 0.4, sz = M.visorScene ? zc : zc + 0.05;
20718
+ 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);
20719
+ K.box("plain", xa, M.visorScene ? 0.85 : 0.852, zc + 0.02, 1.4, 0.025, 0.4, 2762276);
20544
20720
  K.box("plain", xa, 1.5, zc - 0.07, 1.5, 0.4, 0.56, br);
20545
20721
  K.box("plain", xa, 1.5, zc + 0.215, 1.5, 0.4, 0.01, 1709586);
20546
20722
  K.box("plain", xa, 1.9, zc - 0.12, 0.62, 1, 0.46, br);
@@ -20548,9 +20724,10 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20548
20724
  K.box("plain", xa, 2.98, zc - 0.12, 0.5, 0.06, 0.4, shade(br, 0.75));
20549
20725
  K.box("plain", xb, 0, zc, 1.44, 0.85, 0.7, cab);
20550
20726
  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);
20727
+ const ct0 = M.visorScene ? xb - 0.74 : xa + 0.802, ct1 = xc + 0.67;
20728
+ 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
20729
  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);
20730
+ K.box("metal", xb, M.visorScene ? 0.895 : 0.893, zc, 0.44, M.visorScene ? 6e-3 : 4e-3, 0.32, 7370362);
20554
20731
  K.box("plain", xc, 0, zc, 1.3, 0.85, 0.7, cab);
20555
20732
  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
20733
  K.cyl("plain", xc, 0.89, zc, 0.1, 0.05, 15790314);
@@ -20573,7 +20750,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20573
20750
  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
20751
  K.box("wood", 0, 0, 0, w, 0.05, d, shade(wood, 0.75));
20575
20752
  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);
20753
+ 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
20754
  K.box("wood", 0, h - 0.06, 0, w + 0.12, 0.06, d + 0.12, shade(wood, 0.75));
20578
20755
  const lx0 = -w / 2, lx1 = dx - dw / 2;
20579
20756
  K.box("wood", (lx0 + lx1) / 2, 0.05, d / 2 - t / 2, lx1 - lx0, h - 0.11, t, wood);
@@ -20584,8 +20761,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
20584
20761
  K.box("wood", x, 0.05, d / 2 + 3e-3, 0.012, h - 0.11, 5e-3, shade(wood, 0.6));
20585
20762
  }
20586
20763
  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);
20764
+ const jy = M.visorScene ? 0.05 : 0.048;
20765
+ K.box("wood", dx - dw / 2 - jamb, jy, d / 2 - 0.02, 0.05, 1.87 - jy, 0.06, shade1);
20766
+ K.box("wood", dx + dw / 2 + jamb, jy, d / 2 - 0.02, 0.05, 1.87 - jy, 0.06, shade1);
20589
20767
  K.box("glass", dx, 0.06, d / 2 - 0.02, dw, 1.75, 0.02, 16777215);
20590
20768
  K.box("metal", dx - dw / 2 + 0.08, 0.7, d / 2 + 0.03, 0.02, 0.5, 0.03, 13159632);
20591
20769
  K.box("wood", 0, 0.85, -d / 2 + t + 0.25, w - 2 * t, 0.05, 0.5, shade(wood, 1.1));
@@ -21010,7 +21188,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21010
21188
  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
21189
  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
21190
  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 })
21191
+ 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 }),
21192
+ lathe: (M, material, x, y, z, points, color2) => void primitives.push({ kind: "lathe", M, material, x, y, z, points, color: color2 })
21014
21193
  };
21015
21194
  if (options.light !== false) {
21016
21195
  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 +21258,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21079
21258
  list2.push({ kind: "cylinder", radiusTop: 1, radiusBottom: 1, height: 1, radialSegments: cyl, ...place });
21080
21259
  }
21081
21260
  },
21261
+ lathe(M, material, x, y, z, points, color2) {
21262
+ into(M).push({ kind: "lathe", material, color: color2, position: [x, y, z], points: points.map(([r, py]) => [r, py]), segments: cyl });
21263
+ },
21082
21264
  leaf(M, x, y, z, w, h, color2, ry, rx) {
21083
21265
  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
21266
  },
@@ -21331,9 +21513,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21331
21513
  /** `a + b * s` */
21332
21514
  madd: (a, b, s) => [a[0] + b[0] * s, a[1] + b[1] * s, a[2] + b[2] * s]
21333
21515
  };
21334
- var IDENTITY = [0, 0, 0, 1];
21516
+ var IDENTITY2 = [0, 0, 0, 1];
21335
21517
  var quat = {
21336
- identity: () => [IDENTITY[0], IDENTITY[1], IDENTITY[2], IDENTITY[3]],
21518
+ identity: () => [IDENTITY2[0], IDENTITY2[1], IDENTITY2[2], IDENTITY2[3]],
21337
21519
  /** Hamilton product `a * b` (apply `b` first, then `a`). */
21338
21520
  mul: (a, b) => [
21339
21521
  a[3] * b[0] + a[0] * b[3] + a[1] * b[2] - a[2] * b[1],
@@ -21380,7 +21562,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21380
21562
  return quat.normalize(q);
21381
21563
  }
21382
21564
  };
21383
- var quatFromEuler = (x, y, z) => {
21565
+ var quatFromEuler2 = (x, y, z) => {
21384
21566
  const c1 = Math.cos(x / 2), c2 = Math.cos(y / 2), c3 = Math.cos(z / 2);
21385
21567
  const s1 = Math.sin(x / 2), s2 = Math.sin(y / 2), s3 = Math.sin(z / 2);
21386
21568
  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 +21888,33 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21706
21888
  return out;
21707
21889
  };
21708
21890
  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] }));
21891
+ var SLAB_MIN = 0.03;
21892
+ var splitAtHit = (root, hit, axes, count, rnd2) => {
21893
+ let pieces = [root];
21894
+ for (const ax of axes) {
21895
+ const half = root.s[ax] / 2;
21896
+ if (hit[ax] - -half < SLAB_MIN || half - hit[ax] < SLAB_MIN) continue;
21897
+ const next = [];
21898
+ for (const b of pieces) {
21899
+ const lo = b.c[ax] - b.s[ax] / 2;
21900
+ const hi = b.c[ax] + b.s[ax] / 2;
21901
+ for (const [from, to] of [[lo, hit[ax]], [hit[ax], hi]]) {
21902
+ const c = [b.c[0], b.c[1], b.c[2]];
21903
+ const s = [b.s[0], b.s[1], b.s[2]];
21904
+ c[ax] = (from + to) / 2;
21905
+ s[ax] = to - from;
21906
+ next.push({ c, s });
21907
+ }
21908
+ }
21909
+ pieces = next;
21910
+ }
21911
+ while (pieces.length < count) {
21912
+ pieces.sort((a, b) => b.s[axes[0]] * b.s[axes[1]] - a.s[axes[0]] * a.s[axes[1]]);
21913
+ const [big, ...rest2] = pieces;
21914
+ pieces = [...bsp(big, 2, axes, rnd2), ...rest2];
21915
+ }
21916
+ return pieces;
21917
+ };
21709
21918
  var CRUMBS = 6;
21710
21919
  var severAt = (inp, root, at4, gap) => {
21711
21920
  const dims = root.s;
@@ -21768,7 +21977,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21768
21977
  if (inp.cut) return severAt(inp, root, inp.cut.at, inp.cut.gap);
21769
21978
  if (inp.form === "plies") return plyBreak(inp, root, maxFragments);
21770
21979
  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] });
21980
+ 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);
21981
+ 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
21982
  if (inp.form !== "granules") return out;
21773
21983
  const crumbs = Math.min(CRUMBS, maxFragments - out.length);
21774
21984
  if (crumbs <= 0) return out;
@@ -22354,7 +22564,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
22354
22564
  var bendGeometry = (part) => {
22355
22565
  const dims = shapeDims(part.shape);
22356
22566
  const member = isMember(dims, part.structure?.role);
22357
- const q = quatFromEuler(...part.rotation ?? [0, 0, 0]);
22567
+ const q = quatFromEuler2(...part.rotation ?? [0, 0, 0]);
22358
22568
  const up = rotateVec(quat.conjugate(q), [0, 1, 0]);
22359
22569
  let spanAxes;
22360
22570
  let depthAxes;
@@ -24632,7 +24842,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24632
24842
  return Math.max(1e-4, Math.min(part.thickness ?? min2 * (part.fill ?? 1), min2));
24633
24843
  };
24634
24844
  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])));
24845
+ const boxes = parts2.map((p) => aabbOf(p.shape, p.position, quatFromEuler2(...p.rotation ?? [0, 0, 0])));
24636
24846
  const out = [];
24637
24847
  for (let i = 0; i < parts2.length; i++) {
24638
24848
  for (let j = i + 1; j < parts2.length; j++) {
@@ -24742,7 +24952,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24742
24952
  if (st && (GONE.has(st.status) || st.group !== 0)) continue;
24743
24953
  const ov = pose2.poses.get(ps.id);
24744
24954
  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]));
24955
+ const rotation2 = quat.mul(pose2.rotation, ov?.q ?? quatFromEuler2(...ps.rotation ?? [0, 0, 0]));
24746
24956
  out.push({ center, half: halfOf(ps.shape), rotation: rotation2 });
24747
24957
  }
24748
24958
  return out;
@@ -25141,7 +25351,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
25141
25351
  const d = {
25142
25352
  mat,
25143
25353
  mass0: partMass(ps, mat),
25144
- q: quatFromEuler(...ps.rotation ?? [0, 0, 0]),
25354
+ q: quatFromEuler2(...ps.rotation ?? [0, 0, 0]),
25145
25355
  area: shapeArea(ps.shape),
25146
25356
  thickness: partThickness(ps),
25147
25357
  cutFactor: cutFactorOf(ps.shape),
@@ -26791,7 +27001,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26791
27001
  };
26792
27002
  const implPartBox = (im, ps) => {
26793
27003
  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])));
27004
+ 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
27005
  };
26796
27006
  const implBounds = /* @__PURE__ */ new WeakMap();
26797
27007
  const implBoundsOf = (im) => {
@@ -26994,7 +27204,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26994
27204
  counts.shapeTested.add(im.impl.id);
26995
27205
  }
26996
27206
  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);
27207
+ const r = rayPartRaw(im.position, im.rotation, ps, ov?.q ?? quatFromEuler2(...ps.rotation ?? [0, 0, 0]), origin, d, ov?.pos);
26998
27208
  if (!r || r.t1 < 0 || r.t0 > maxDist) continue;
26999
27209
  if (r.t0 < 0) {
27000
27210
  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 +27243,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27033
27243
  const parts2 = im.impl.describe().parts;
27034
27244
  const pa = parts2.find((p) => p.id === a), pb = parts2.find((p) => p.id === b);
27035
27245
  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]));
27246
+ const A = aabbOf(pa.shape, pa.position, quatFromEuler2(...pa.rotation ?? [0, 0, 0]));
27247
+ const B = aabbOf(pb.shape, pb.position, quatFromEuler2(...pb.rotation ?? [0, 0, 0]));
27038
27248
  const pos = [0, 0, 0];
27039
27249
  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
27250
  return toWorld(im.position, im.rotation, pos);
@@ -28685,13 +28895,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28685
28895
  }
28686
28896
  const implParts = (im) => im.impl.describe().parts.map((ps) => {
28687
28897
  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])) };
28898
+ 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
28899
  });
28690
28900
  const implInRange = (im, point, radius) => {
28691
28901
  for (const ps of im.impl.describe().parts) {
28692
28902
  const ov = im.poses.get(ps.id);
28693
28903
  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]));
28904
+ const q = quat.mul(im.rotation, ov?.q ?? quatFromEuler2(...ps.rotation ?? [0, 0, 0]));
28695
28905
  if (distanceToShape(ps.shape, toLocal(c, q, point)) < radius) return true;
28696
28906
  }
28697
28907
  return false;
@@ -29716,7 +29926,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29716
29926
  },
29717
29927
  setPartPose(objectId, partId, position, rotation2) {
29718
29928
  finishExplosions();
29719
- const q = quatFromEuler(...rotation2 ?? [0, 0, 0]);
29929
+ const q = quatFromEuler2(...rotation2 ?? [0, 0, 0]);
29720
29930
  const im = impls.get(objectId);
29721
29931
  if (im) {
29722
29932
  im.impl.setPartPose?.(partId, position, rotation2);
@@ -29835,7 +30045,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29835
30045
  const mat = materials.get(ps.material);
29836
30046
  if (!mat) continue;
29837
30047
  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);
30048
+ const r = rayPartRaw(im.position, im.rotation, ps, ov?.q ?? quatFromEuler2(...ps.rotation ?? [0, 0, 0]), point, d, ov?.pos);
29839
30049
  if (!r || r.t1 < 0 || r.t0 > L) continue;
29840
30050
  let path = Math.min(r.t1, L) - Math.max(r.t0, 0);
29841
30051
  if (ps.thickness !== void 0 && ps.thickness > 0) path = Math.min(path, 2 * ps.thickness);
@@ -30101,6 +30311,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30101
30311
  }).events;
30102
30312
  },
30103
30313
  state: (id) => objects.get(id)?.st ?? impls.get(id)?.impl.state() ?? null,
30314
+ anchoredParts: (id) => objects.get(id)?.parts.filter((p) => p.anchored && !isLost(p)).map((p) => p.spec.id) ?? [],
30315
+ fixedInPlace: (id) => {
30316
+ const o = objects.get(id);
30317
+ return !!o && o.spec.fixed === true && o.parts.some((p) => p.anchored && !isLost(p));
30318
+ },
30104
30319
  snapshot: (id) => {
30105
30320
  const st = objects.get(id)?.st ?? impls.get(id)?.impl.state();
30106
30321
  return st ? clone(st) : null;
@@ -32622,156 +32837,981 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32622
32837
  return [[mast.u, mast.v, mast.y0], [mast.u, mast.v, mast.y1], ...arc];
32623
32838
  }
32624
32839
 
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 = [
32840
+ // ../game-items/dist/index.js
32841
+ var DEFAULT_RULES2 = {
32842
+ rarity: {
32843
+ weights: { common: 60, uncommon: 28, rare: 9, very_rare: 2.5, legendary: 0.5, unique: 0 },
32844
+ fixedOnly: ["legendary", "unique"]
32845
+ },
32846
+ freshness: { stale: 0.5, spoiled: 1, rotten: 1.5 },
32847
+ storage: {
32848
+ fridge: { multiplier: 0.33, needsPower: true },
32849
+ freezer: { multiplier: 0.1, needsPower: true },
32850
+ cooler: { multiplier: 0.5, limitDays: 2, afterLimit: 1 },
32851
+ delivery_bag: { multiplier: 0.8 },
32852
+ cellar: { multiplier: 0.66 },
32853
+ ambient: { multiplier: 1 },
32854
+ hot: { multiplier: 2 }
32855
+ },
32856
+ carry: { baseKg: 8, perStrengthKg: 2.5, factor: 1.2, encumbered: 1, overloaded: 1.5 },
32857
+ protection: { cap: 0.9, wear: { bite: 8, scratch: 3 }, tornShare: 0.25, repairMargin: 10 },
32858
+ aging: { thawShelfDays: { freezer: 2 } },
32859
+ inventory: {
32860
+ defaultSlots: 10,
32861
+ encumberedRunFactor: 0.75,
32862
+ defaultLitres: 12,
32863
+ defaultInside: [0.3, 0.25, 0.16],
32864
+ bagInside: {
32865
+ shopping_bag: [0.4, 0.35, 0.15],
32866
+ trash_bag: [0.6, 0.45, 0.12],
32867
+ fanny_pack: [0.22, 0.12, 0.1],
32868
+ crossbody_bag: [0.25, 0.2, 0.12],
32869
+ backpack: [0.5, 0.3, 0.2],
32870
+ delivery_bag: [0.45, 0.45, 0.25],
32871
+ hiking_backpack_40l: [0.6, 0.35, 0.19],
32872
+ military_backpack: [0.6, 0.35, 0.21],
32873
+ trekking_backpack_70l: [0.75, 0.38, 0.25],
32874
+ rolling_suitcase: [0.6, 0.4, 0.21],
32875
+ tactical_vest: [0.3, 0.2, 0.1],
32876
+ tool_belt: [0.4, 0.2, 0.1],
32877
+ cooler_box: [0.32, 0.25, 0.23],
32878
+ shopping_cart: [0.9, 0.55, 0.16],
32879
+ wheelbarrow: [1.2, 0.6, 0.15]
32880
+ },
32881
+ bagLitres: {
32882
+ shopping_bag: 20,
32883
+ trash_bag: 30,
32884
+ fanny_pack: 3,
32885
+ crossbody_bag: 6,
32886
+ backpack: 30,
32887
+ delivery_bag: 50,
32888
+ hiking_backpack_40l: 40,
32889
+ military_backpack: 45,
32890
+ trekking_backpack_70l: 70,
32891
+ rolling_suitcase: 50,
32892
+ tactical_vest: 6,
32893
+ tool_belt: 8,
32894
+ cooler_box: 18,
32895
+ shopping_cart: 80,
32896
+ wheelbarrow: 100
32897
+ }
32898
+ },
32899
+ use: {
32900
+ freshness: {
32901
+ stale: { satietyFactor: 0.7, poisonChance: 0.1, morale: 0, isEdible: true },
32902
+ spoiled: { satietyFactor: 0.7, poisonChance: 0.5, morale: -20, isEdible: true },
32903
+ rotten: { satietyFactor: 0, poisonChance: 0, morale: 0, isEdible: false }
32904
+ },
32905
+ cookedPoisonFactor: 0.25
32906
+ },
32907
+ spawn: {
32908
+ retailNew: true,
32909
+ retailPlaces: ["supermarket", "pharmacy", "mall", "gas_station", "gun_shop"],
32910
+ retailContainers: ["store_shelf", "stockroom"],
32911
+ condition: { common: [30, 90], uncommon: [40, 90], rare: [50, 100], very_rare: [50, 100], legendary: [50, 100], unique: [50, 100] },
32912
+ ageShare: [0, 0.6],
32913
+ charge: [0.2, 1],
32914
+ fillable: ["fuel_jerrycan"],
32915
+ fill: [0, 0.6]
32916
+ },
32917
+ finds: {
32918
+ fallbackContainer: "zombie_corpse",
32919
+ rollExcluded: ["ammo_7_62x39"],
32920
+ depletion: [
32921
+ { places: ["pharmacy", "gun_shop", "police_station"], perDay: 0.05, floor: 0.3 },
32922
+ { places: ["supermarket", "gas_station"], perDay: 0.04, floor: 0.35 },
32923
+ { places: ["mall", "hospital"], perDay: 0.025, floor: 0.5 },
32924
+ { places: ["house", "apartment"], perDay: 0.01, floor: 0.7 },
32925
+ { places: ["farm", "warehouse", "mine", "dam", "lodge", "church"], perDay: 5e-3, floor: 0.85 },
32926
+ { places: ["military_base"], perDay: 0, floor: 1 }
32927
+ ],
32928
+ regionMultiplier: {},
32929
+ states: { normal: "normal", fortified: "fortified", abandoned: "abandoned" },
32930
+ pool: {
32931
+ defaultFootprint: 0.5,
32932
+ offset: 1.5,
32933
+ perSquareMetre: 3,
32934
+ jitter: 1.5,
32935
+ min: 2,
32936
+ max: 5,
32937
+ fortifiedExtra: 2,
32938
+ supplyWeight: 2.5,
32939
+ supplyExtraQty: 1,
32940
+ abandonedEmptyChance: 0.4,
32941
+ abandonedKept: 1,
32942
+ junkChance: 0.5,
32943
+ junkItem: "food_packaging",
32944
+ spoiledFoodItem: "leftover_meal",
32945
+ coldContainers: ["geladeira", "refrig_exp", "freezer"]
32946
+ }
32947
+ }
32948
+ };
32949
+ var FRESH_NUTRITION = { satietyFactor: 1, poisonChance: 0, morale: 0, isEdible: true };
32950
+ var nutritionOf = (item, context, rules) => {
32951
+ const state = context.freshness ?? "fresh";
32952
+ const effect = state === "fresh" ? FRESH_NUTRITION : rules.use.freshness[state];
32953
+ const poisonShare = context.isCooked ? rules.use.cookedPoisonFactor : 1;
32954
+ return {
32955
+ satiety: (item.nutrition?.satiety ?? 0) * effect.satietyFactor,
32956
+ hydration: item.nutrition?.hydration ?? 0,
32957
+ morale: effect.morale,
32958
+ poisonChance: effect.poisonChance * poisonShare,
32959
+ isEdible: effect.isEdible
32960
+ };
32961
+ };
32962
+ var findEffect = (item, effects) => effects.find((entry2) => entry2.items?.includes(item.id)) ?? effects.find((entry2) => entry2.category?.includes(item.category));
32963
+ var resolveUse = (item, effects, context = {}, rules = DEFAULT_RULES2) => {
32964
+ const def = findEffect(item, effects);
32965
+ if (!def) return void 0;
32966
+ const base = { useId: def.id, effect: def.effect, params: def.params ?? {}, consumes: def.consumes };
32967
+ if (def.effect !== "consume_nutrition") return base;
32968
+ const nutrition = nutritionOf(item, context, rules);
32969
+ const blocked = item.seal && context.seal ? sealBlock(item.seal, context.seal) : void 0;
32970
+ if (blocked) return { ...base, consumes: false, nutrition: { ...nutrition, isEdible: false }, blocked };
32971
+ return { ...base, consumes: def.consumes && nutrition.isEdible, nutrition };
32972
+ };
32973
+ var MM = 1e-3;
32974
+ var BOX_WALL = 6 * MM;
32975
+
32976
+ // ../game-fluids/dist/index.js
32977
+ var liquids_default = [
32652
32978
  {
32653
- id: "food",
32654
- name: "Food"
32979
+ id: "water",
32980
+ color: 11064558,
32981
+ opacity: 0.35,
32982
+ stainColor: 7309206,
32983
+ viscosity: 1,
32984
+ density: 1e3,
32985
+ dryTime: 180,
32986
+ gloss: 0.9,
32987
+ drink: {
32988
+ thirst: 100,
32989
+ effects: []
32990
+ },
32991
+ tags: [
32992
+ "drink",
32993
+ "clear"
32994
+ ]
32655
32995
  },
32656
32996
  {
32657
- id: "drink",
32658
- name: "Drink"
32997
+ id: "coffee",
32998
+ color: 3875604,
32999
+ opacity: 0.95,
33000
+ stainColor: 2824202,
33001
+ viscosity: 1.5,
33002
+ density: 1005,
33003
+ dryTime: 900,
33004
+ gloss: 0.8,
33005
+ leavesMark: true,
33006
+ steamC: 60,
33007
+ drink: {
33008
+ thirst: 80,
33009
+ effects: [
33010
+ "caffeine"
33011
+ ]
33012
+ },
33013
+ tags: [
33014
+ "drink",
33015
+ "hot"
33016
+ ]
32659
33017
  },
32660
33018
  {
32661
- id: "medical",
32662
- name: "Medical"
33019
+ id: "tea",
33020
+ color: 9063188,
33021
+ opacity: 0.8,
33022
+ stainColor: 6961682,
33023
+ viscosity: 1.4,
33024
+ density: 1005,
33025
+ dryTime: 800,
33026
+ gloss: 0.8,
33027
+ leavesMark: true,
33028
+ steamC: 60,
33029
+ drink: {
33030
+ thirst: 90,
33031
+ effects: []
33032
+ },
33033
+ tags: [
33034
+ "drink",
33035
+ "hot"
33036
+ ]
32663
33037
  },
32664
33038
  {
32665
- id: "tools",
32666
- name: "Tools"
33039
+ id: "milk",
33040
+ color: 16052712,
33041
+ opacity: 0.98,
33042
+ stainColor: 14473160,
33043
+ viscosity: 2,
33044
+ density: 1030,
33045
+ dryTime: 900,
33046
+ gloss: 0.5,
33047
+ leavesMark: true,
33048
+ drink: {
33049
+ thirst: 70,
33050
+ effects: []
33051
+ },
33052
+ tags: [
33053
+ "drink"
33054
+ ]
32667
33055
  },
32668
33056
  {
32669
- id: "melee",
32670
- name: "Melee"
33057
+ id: "soda",
33058
+ color: 3808530,
33059
+ opacity: 0.85,
33060
+ stainColor: 2757901,
33061
+ viscosity: 1.3,
33062
+ density: 1040,
33063
+ dryTime: 1200,
33064
+ gloss: 0.85,
33065
+ leavesMark: true,
33066
+ drink: {
33067
+ thirst: 60,
33068
+ effects: []
33069
+ },
33070
+ tags: [
33071
+ "drink",
33072
+ "sticky"
33073
+ ]
32671
33074
  },
32672
33075
  {
32673
- id: "materials",
32674
- name: "Materials"
33076
+ id: "juice",
33077
+ color: 15239467,
33078
+ opacity: 0.9,
33079
+ stainColor: 12741916,
33080
+ viscosity: 2,
33081
+ density: 1045,
33082
+ dryTime: 1100,
33083
+ gloss: 0.8,
33084
+ leavesMark: true,
33085
+ drink: {
33086
+ thirst: 75,
33087
+ effects: []
33088
+ },
33089
+ tags: [
33090
+ "drink",
33091
+ "sticky"
33092
+ ]
32675
33093
  },
32676
33094
  {
32677
- id: "clothing",
32678
- name: "Clothing"
33095
+ id: "beer",
33096
+ color: 14259740,
33097
+ opacity: 0.8,
33098
+ stainColor: 11039764,
33099
+ viscosity: 1.4,
33100
+ density: 1010,
33101
+ dryTime: 900,
33102
+ gloss: 0.8,
33103
+ drink: {
33104
+ thirst: 50,
33105
+ effects: [
33106
+ "alcohol"
33107
+ ]
33108
+ },
33109
+ tags: [
33110
+ "drink",
33111
+ "alcohol"
33112
+ ]
32679
33113
  },
32680
33114
  {
32681
- id: "bags",
32682
- name: "Bags"
33115
+ id: "wine",
33116
+ color: 7016223,
33117
+ opacity: 0.9,
33118
+ stainColor: 5048854,
33119
+ viscosity: 1.6,
33120
+ density: 990,
33121
+ dryTime: 800,
33122
+ gloss: 0.85,
33123
+ leavesMark: true,
33124
+ drink: {
33125
+ thirst: 40,
33126
+ effects: [
33127
+ "alcohol"
33128
+ ]
33129
+ },
33130
+ tags: [
33131
+ "drink",
33132
+ "alcohol"
33133
+ ]
32683
33134
  },
32684
33135
  {
32685
- id: "electronics",
32686
- name: "Electronics"
33136
+ id: "spirits",
33137
+ color: 13214042,
33138
+ opacity: 0.6,
33139
+ stainColor: 10320959,
33140
+ viscosity: 1.8,
33141
+ density: 940,
33142
+ dryTime: 200,
33143
+ gloss: 0.85,
33144
+ flammable: true,
33145
+ drink: {
33146
+ thirst: 5,
33147
+ effects: [
33148
+ "alcohol"
33149
+ ]
33150
+ },
33151
+ tags: [
33152
+ "drink",
33153
+ "alcohol"
33154
+ ]
32687
33155
  },
32688
33156
  {
32689
33157
  id: "fuel",
32690
- name: "Fuel"
33158
+ color: 14926682,
33159
+ opacity: 0.6,
33160
+ stainColor: 7232298,
33161
+ viscosity: 0.6,
33162
+ density: 740,
33163
+ dryTime: 60,
33164
+ gloss: 0.95,
33165
+ leavesMark: false,
33166
+ flammable: true,
33167
+ drink: {
33168
+ thirst: 0,
33169
+ effects: [
33170
+ "poison"
33171
+ ]
33172
+ },
33173
+ tags: [
33174
+ "fuel",
33175
+ "gasoline"
33176
+ ]
32691
33177
  },
32692
33178
  {
32693
- id: "outdoors",
32694
- name: "Outdoors"
33179
+ id: "diesel",
33180
+ color: 12098094,
33181
+ opacity: 0.8,
33182
+ stainColor: 5917208,
33183
+ viscosity: 3,
33184
+ density: 830,
33185
+ dryTime: 3600,
33186
+ gloss: 0.95,
33187
+ leavesMark: true,
33188
+ flammable: true,
33189
+ drink: {
33190
+ thirst: 0,
33191
+ effects: [
33192
+ "poison"
33193
+ ]
33194
+ },
33195
+ tags: [
33196
+ "fuel"
33197
+ ]
32695
33198
  },
32696
33199
  {
32697
- id: "books",
32698
- name: "Books"
33200
+ id: "motor_oil",
33201
+ color: 3877388,
33202
+ opacity: 0.95,
33203
+ stainColor: 1840134,
33204
+ viscosity: 100,
33205
+ density: 880,
33206
+ dryTime: 0,
33207
+ gloss: 1,
33208
+ leavesMark: true,
33209
+ flammable: true,
33210
+ drink: {
33211
+ thirst: 0,
33212
+ effects: [
33213
+ "poison"
33214
+ ]
33215
+ },
33216
+ tags: [
33217
+ "oil"
33218
+ ]
32699
33219
  },
32700
33220
  {
32701
- id: "collectibles",
32702
- name: "Collectibles"
33221
+ id: "cooking_oil",
33222
+ color: 14267708,
33223
+ opacity: 0.85,
33224
+ stainColor: 11110698,
33225
+ viscosity: 60,
33226
+ density: 920,
33227
+ dryTime: 0,
33228
+ gloss: 1,
33229
+ leavesMark: true,
33230
+ flammable: true,
33231
+ drink: {
33232
+ thirst: 0,
33233
+ effects: [
33234
+ "poison"
33235
+ ]
33236
+ },
33237
+ tags: [
33238
+ "oil",
33239
+ "food"
33240
+ ]
32703
33241
  },
32704
33242
  {
32705
- id: "keys",
32706
- name: "Keys"
33243
+ id: "blood",
33244
+ color: 7997964,
33245
+ opacity: 0.92,
33246
+ stainColor: 3874068,
33247
+ viscosity: 4,
33248
+ density: 1060,
33249
+ dryTime: 600,
33250
+ gloss: 0.75,
33251
+ leavesMark: true,
33252
+ drink: {
33253
+ thirst: 10,
33254
+ effects: [
33255
+ "disgust"
33256
+ ]
33257
+ },
33258
+ tags: [
33259
+ "organic"
33260
+ ]
32707
33261
  },
32708
33262
  {
32709
- id: "ammo",
32710
- name: "Ammo"
33263
+ id: "old_blood",
33264
+ color: 7085078,
33265
+ opacity: 0.92,
33266
+ stainColor: 2758158,
33267
+ viscosity: 4,
33268
+ density: 1060,
33269
+ dryTime: 360,
33270
+ gloss: 0.7,
33271
+ leavesMark: true,
33272
+ drink: {
33273
+ thirst: 10,
33274
+ effects: [
33275
+ "disgust"
33276
+ ]
33277
+ },
33278
+ tags: [
33279
+ "organic"
33280
+ ]
32711
33281
  },
32712
33282
  {
32713
- id: "firearms",
32714
- name: "Firearms"
33283
+ id: "bile",
33284
+ color: 9083434,
33285
+ opacity: 0.9,
33286
+ stainColor: 4080160,
33287
+ viscosity: 6,
33288
+ density: 1020,
33289
+ dryTime: 900,
33290
+ gloss: 0.75,
33291
+ leavesMark: true,
33292
+ drink: {
33293
+ thirst: 0,
33294
+ effects: [
33295
+ "disgust"
33296
+ ]
33297
+ },
33298
+ tags: [
33299
+ "organic"
33300
+ ]
32715
33301
  },
32716
33302
  {
32717
- id: "throwables",
32718
- name: "Throwables"
32719
- }
32720
- ];
32721
- var containers_default = [
33303
+ id: "sap",
33304
+ color: 13146940,
33305
+ opacity: 0.8,
33306
+ stainColor: 10122282,
33307
+ viscosity: 200,
33308
+ density: 1100,
33309
+ dryTime: 3600,
33310
+ gloss: 0.8,
33311
+ leavesMark: true,
33312
+ drink: {
33313
+ thirst: 20,
33314
+ effects: []
33315
+ },
33316
+ tags: [
33317
+ "organic",
33318
+ "sticky"
33319
+ ]
33320
+ },
32722
33321
  {
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
33322
+ id: "acid",
33323
+ color: 10146378,
33324
+ opacity: 0.6,
33325
+ stainColor: 7313970,
33326
+ viscosity: 1.5,
33327
+ density: 1200,
33328
+ dryTime: 900,
33329
+ gloss: 0.9,
33330
+ leavesMark: true,
33331
+ drink: {
33332
+ thirst: 0,
33333
+ effects: [
33334
+ "poison"
33335
+ ]
32743
33336
  },
32744
- teamCategories: "comida perec\xEDvel e bebida",
32745
- rule: "Sem energia, o perec\xEDvel de dentro come\xE7a a contar como fora da geladeira."
33337
+ tags: [
33338
+ "corrosive"
33339
+ ]
32746
33340
  },
32747
33341
  {
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
33342
+ id: "paint",
33343
+ color: 11740715,
33344
+ opacity: 0.98,
33345
+ stainColor: 9050655,
33346
+ viscosity: 300,
33347
+ density: 1300,
33348
+ dryTime: 1800,
33349
+ gloss: 0.6,
33350
+ leavesMark: true,
33351
+ drink: {
33352
+ thirst: 0,
33353
+ effects: [
33354
+ "poison"
33355
+ ]
32770
33356
  },
32771
- teamCategories: "comida seca e enlatada, panela, abridor, isqueiro"
33357
+ tags: [
33358
+ "paint"
33359
+ ]
32772
33360
  },
32773
33361
  {
32774
- id: "bathroom_cabinet",
33362
+ id: "bleach",
33363
+ color: 15134688,
33364
+ opacity: 0.7,
33365
+ stainColor: 13621446,
33366
+ viscosity: 1.2,
33367
+ density: 1100,
33368
+ dryTime: 900,
33369
+ gloss: 0.85,
33370
+ leavesMark: true,
33371
+ drink: {
33372
+ thirst: 0,
33373
+ effects: [
33374
+ "poison"
33375
+ ]
33376
+ },
33377
+ tags: [
33378
+ "corrosive"
33379
+ ]
33380
+ },
33381
+ {
33382
+ id: "sewage",
33383
+ color: 5921582,
33384
+ opacity: 0.92,
33385
+ stainColor: 3093273,
33386
+ viscosity: 4,
33387
+ density: 1010,
33388
+ dryTime: 1800,
33389
+ gloss: 0.8,
33390
+ leavesMark: true,
33391
+ drink: {
33392
+ thirst: 0,
33393
+ effects: [
33394
+ "disgust",
33395
+ "poison"
33396
+ ]
33397
+ },
33398
+ tags: [
33399
+ "organic",
33400
+ "waste"
33401
+ ]
33402
+ },
33403
+ {
33404
+ id: "honey",
33405
+ color: 14193162,
33406
+ opacity: 0.9,
33407
+ stainColor: 12089350,
33408
+ viscosity: 3e3,
33409
+ density: 1420,
33410
+ dryTime: 14400,
33411
+ gloss: 0.95,
33412
+ leavesMark: true,
33413
+ drink: {
33414
+ thirst: 10,
33415
+ effects: []
33416
+ },
33417
+ tags: [
33418
+ "drink",
33419
+ "sticky"
33420
+ ]
33421
+ },
33422
+ {
33423
+ id: "mud",
33424
+ color: 4008988,
33425
+ opacity: 0.95,
33426
+ stainColor: 3811866,
33427
+ viscosity: 40,
33428
+ density: 1600,
33429
+ dryTime: 900,
33430
+ gloss: 0.4,
33431
+ tags: [
33432
+ "dirty"
33433
+ ]
33434
+ },
33435
+ {
33436
+ id: "coolant",
33437
+ color: 3455050,
33438
+ opacity: 0.7,
33439
+ stainColor: 2783796,
33440
+ viscosity: 4,
33441
+ density: 1070,
33442
+ dryTime: 1200,
33443
+ gloss: 0.85,
33444
+ leavesMark: true,
33445
+ drink: {
33446
+ thirst: 0,
33447
+ effects: [
33448
+ "poison"
33449
+ ]
33450
+ },
33451
+ tags: [
33452
+ "coolant"
33453
+ ]
33454
+ },
33455
+ {
33456
+ id: "brake_fluid",
33457
+ color: 13145646,
33458
+ opacity: 0.8,
33459
+ stainColor: 9069600,
33460
+ viscosity: 8,
33461
+ density: 1050,
33462
+ dryTime: 3600,
33463
+ gloss: 0.9,
33464
+ leavesMark: true,
33465
+ drink: {
33466
+ thirst: 0,
33467
+ effects: [
33468
+ "poison"
33469
+ ]
33470
+ },
33471
+ tags: [
33472
+ "brake_fluid"
33473
+ ]
33474
+ }
33475
+ ];
33476
+ var LIQUIDS = liquids_default;
33477
+ var SAMPLES = 16;
33478
+ var COS = [];
33479
+ var SIN = [];
33480
+ for (let i = 0; i < SAMPLES; i++) {
33481
+ COS.push(Math.cos(i / SAMPLES * Math.PI * 2));
33482
+ SIN.push(Math.sin(i / SAMPLES * Math.PI * 2));
33483
+ }
33484
+ var RUNOFF_TILT = 6 * Math.PI / 180;
33485
+ var RUNOFF_TILT_MAX = 60 * Math.PI / 180;
33486
+ function hashCell(x, y) {
33487
+ let value = x * 374761393 + y * 668265263 | 0;
33488
+ value = (value ^ value >>> 13) * 1274126177 | 0;
33489
+ return ((value ^ value >>> 16) >>> 0) / 4294967296;
33490
+ }
33491
+ function valueNoise(x, y) {
33492
+ const xi = Math.floor(x);
33493
+ const yi = Math.floor(y);
33494
+ const xf = x - xi;
33495
+ const yf = y - yi;
33496
+ const u = xf * xf * (3 - 2 * xf);
33497
+ const v = yf * yf * (3 - 2 * yf);
33498
+ const a = hashCell(xi, yi);
33499
+ const b = hashCell(xi + 1, yi);
33500
+ const c = hashCell(xi, yi + 1);
33501
+ const d = hashCell(xi + 1, yi + 1);
33502
+ return a + (b - a) * u + (c - a) * v + (a - b - c + d) * u * v;
33503
+ }
33504
+ var REGION_NAMES = ["wall", "sidewalk", "curb", "road"];
33505
+ var dot3 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
33506
+ function impactOf(region, position, velocity2, cellSize) {
33507
+ const local2 = [position[0] - region.origin[0], position[1] - region.origin[1], position[2] - region.origin[2]];
33508
+ return {
33509
+ row: region.firstRow + dot3(local2, region.rowAxis) / cellSize,
33510
+ column: dot3(local2, region.columnAxis) / cellSize,
33511
+ along: [dot3(velocity2, region.columnAxis), dot3(velocity2, region.rowAxis)],
33512
+ normalSpeed: -dot3(velocity2, region.normal)
33513
+ };
33514
+ }
33515
+ function cellToWorldOf(regions, cellSize, row, column) {
33516
+ let region = regions[regions.length - 1];
33517
+ for (const candidate of regions) {
33518
+ if (row < candidate.firstRow + candidate.rowCount) {
33519
+ region = candidate;
33520
+ break;
33521
+ }
33522
+ }
33523
+ const across2 = column * cellSize;
33524
+ const down2 = (row - region.firstRow) * cellSize;
33525
+ return [
33526
+ region.origin[0] + region.columnAxis[0] * across2 + region.rowAxis[0] * down2,
33527
+ region.origin[1] + region.columnAxis[1] * across2 + region.rowAxis[1] * down2,
33528
+ region.origin[2] + region.columnAxis[2] * across2 + region.rowAxis[2] * down2
33529
+ ];
33530
+ }
33531
+ function createFoldedLayout(params) {
33532
+ const { columns, cellSize, originX, wallRows, sidewalkRows, curbRows, roadRows, wallTopY, sidewalkY, roadY, wallZ, rules } = params;
33533
+ const curbStep = params.curbStep ?? (sidewalkY - roadY) / curbRows;
33534
+ const height = wallRows + sidewalkRows + curbRows + roadRows;
33535
+ const cellCount = columns * height;
33536
+ const bed = new Float32Array(cellCount);
33537
+ const pin = new Float32Array(cellCount);
33538
+ const vertical = new Float32Array(cellCount);
33539
+ const sidewalkEnd = wallRows + sidewalkRows;
33540
+ const curbEnd = sidewalkEnd + curbRows;
33541
+ const regionOfRow = (row) => row < wallRows ? 0 : row < sidewalkEnd ? 1 : row < curbEnd ? 2 : 3;
33542
+ for (let row = 0; row < height; row++) {
33543
+ for (let column = 0; column < columns; column++) {
33544
+ const index = row * columns + column;
33545
+ const region = regionOfRow(row);
33546
+ const x = originX + (column + 0.5) * cellSize;
33547
+ let bedHeight;
33548
+ let roughness = 0.2;
33549
+ if (region === 0) {
33550
+ bedHeight = (wallTopY - (row + 0.5) * cellSize) * 1e3;
33551
+ roughness = 0.3;
33552
+ } else if (region === 1) {
33553
+ const z = (row - wallRows + 0.5) * cellSize;
33554
+ bedHeight = sidewalkY * 1e3 - z * 6;
33555
+ const jointX = Math.abs(((x - originX) % 0.5 + 0.5) % 0.5 - 0.25);
33556
+ const jointZ = Math.abs((z % 0.5 + 0.5) % 0.5 - 0.25);
33557
+ if (jointX > 0.25 - cellSize * 0.6 || jointZ > 0.25 - cellSize * 0.6) bedHeight -= 0.9;
33558
+ roughness = 0.18;
33559
+ } else if (region === 2) {
33560
+ bedHeight = sidewalkY * 1e3 - (row - sidewalkEnd + 0.5) * curbStep * 1e3;
33561
+ } else {
33562
+ const z = (row - curbEnd + 0.5) * cellSize;
33563
+ bedHeight = roadY * 1e3 + z * 14 - (x - params.roadSlopeAnchorX) * 5;
33564
+ roughness = 0.55;
33565
+ }
33566
+ const noise3 = valueNoise(column * 0.35, row * 0.35) * 0.6 + valueNoise(column * 1.3, row * 1.3) * 0.4;
33567
+ bed[index] = bedHeight + (noise3 - 0.5) * roughness * 2;
33568
+ vertical[index] = region === 0 || region === 2 ? 0.95 : 1;
33569
+ 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);
33570
+ }
33571
+ }
33572
+ const curbZ = wallZ + sidewalkRows * cellSize;
33573
+ const roadEndZ = curbZ + roadRows * cellSize;
33574
+ const right = [1, 0, 0];
33575
+ const regions = [
33576
+ { id: REGION_NAMES[0], firstRow: 0, rowCount: wallRows, origin: [originX, wallTopY, wallZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
33577
+ { id: REGION_NAMES[1], firstRow: wallRows, rowCount: sidewalkRows, origin: [originX, sidewalkY, wallZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false },
33578
+ { id: REGION_NAMES[2], firstRow: sidewalkEnd, rowCount: curbRows, origin: [originX, sidewalkY, curbZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
33579
+ { id: REGION_NAMES[3], firstRow: curbEnd, rowCount: roadRows, origin: [originX, roadY, curbZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false }
33580
+ ];
33581
+ const maxX = originX + columns * cellSize;
33582
+ return {
33583
+ id: params.id,
33584
+ width: columns,
33585
+ height,
33586
+ cellSize,
33587
+ bed,
33588
+ pin,
33589
+ vertical,
33590
+ regions,
33591
+ rules,
33592
+ cellToWorld: (row, column) => cellToWorldOf(regions, cellSize, row, column),
33593
+ collide(previous, position) {
33594
+ if (position[2] <= wallZ && position[1] > sidewalkY) {
33595
+ position[2] = wallZ;
33596
+ return 0;
33597
+ }
33598
+ if (position[2] < curbZ && (!rules.guardBehindWall || position[2] >= wallZ) && position[1] <= sidewalkY) {
33599
+ position[1] = sidewalkY;
33600
+ return 1;
33601
+ }
33602
+ if (rules.curbCatch && position[2] >= curbZ && previous[2] < curbZ && position[1] < sidewalkY) {
33603
+ position[2] = curbZ;
33604
+ return 2;
33605
+ }
33606
+ if (position[2] >= curbZ && position[1] <= roadY) {
33607
+ position[1] = roadY;
33608
+ return 3;
33609
+ }
33610
+ return -1;
33611
+ },
33612
+ impact: (region, position, velocity2) => impactOf(regions[region], position, velocity2, cellSize),
33613
+ contains: (position) => position[0] > originX && position[0] < maxX && (!rules.clipRoadEnd || position[2] < roadEndZ),
33614
+ escaped(position) {
33615
+ if (position[1] < -1) return true;
33616
+ const box5 = rules.escapeBox;
33617
+ return box5 !== void 0 && (position[0] < box5.minX || position[0] > box5.maxX || position[2] > box5.maxZ);
33618
+ }
33619
+ };
33620
+ }
33621
+ var PADRAO_CELL = 0.0125;
33622
+ var PADRAO_WALL_Z = 0;
33623
+ var PADRAO_LAYOUT = createFoldedLayout({
33624
+ id: "padrao",
33625
+ columns: 256,
33626
+ cellSize: PADRAO_CELL,
33627
+ originX: -1.6,
33628
+ wallRows: 144,
33629
+ sidewalkRows: 128,
33630
+ curbRows: 12,
33631
+ roadRows: 112,
33632
+ wallTopY: 1.95,
33633
+ sidewalkY: 0.15,
33634
+ roadY: 0,
33635
+ wallZ: PADRAO_WALL_Z,
33636
+ curbStep: PADRAO_CELL,
33637
+ roadSlopeAnchorX: 0,
33638
+ rules: {
33639
+ dropCapacity: 600,
33640
+ curbCatch: true,
33641
+ guardBehindWall: true,
33642
+ clipRoadEnd: true,
33643
+ escapeBox: { minX: -3, maxX: 3, maxZ: PADRAO_WALL_Z + 128 * PADRAO_CELL + 112 * PADRAO_CELL + 1 },
33644
+ dripStyle: "padrao"
33645
+ }
33646
+ });
33647
+ var WORKSHOP_CELL = 0.0125;
33648
+ var WORKSHOP_LAYOUT = createFoldedLayout({
33649
+ id: "workshop",
33650
+ columns: 160,
33651
+ cellSize: WORKSHOP_CELL,
33652
+ originX: -2.2,
33653
+ wallRows: 160,
33654
+ sidewalkRows: 128,
33655
+ curbRows: 9,
33656
+ roadRows: 151,
33657
+ wallTopY: 2.12,
33658
+ sidewalkY: 0.1235,
33659
+ roadY: 9e-3,
33660
+ wallZ: -4.497,
33661
+ roadSlopeAnchorX: -1.2,
33662
+ rules: { dropCapacity: 400, curbCatch: false, guardBehindWall: false, clipRoadEnd: false, dripStyle: "workshop" }
33663
+ });
33664
+
33665
+ // ../game-items-goods/dist/index.js
33666
+ var FLOORPLAN_POOL_KEYS = {
33667
+ fridge: "geladeira",
33668
+ display_fridge: "refrig_exp",
33669
+ freezer: "freezer",
33670
+ kitchen_cabinet: "pia",
33671
+ overhead_cabinet: "aereo",
33672
+ washbasin: "pia_b",
33673
+ wardrobe: "guarda",
33674
+ wardrobe_large: "guarda",
33675
+ dresser: "comoda",
33676
+ console_table: "comoda",
33677
+ nightstand: "criado",
33678
+ filing_cabinet: "gaveteiro",
33679
+ pantry: "despensa",
33680
+ tv_unit: "rack",
33681
+ laundry_cabinet: "armario_lav",
33682
+ laundry_shelf: "estante_lav",
33683
+ workbench: "bancada",
33684
+ tool_shelf: "estante_ferr",
33685
+ mailbox: "correio",
33686
+ trash_bin: "lixeira",
33687
+ outdoor_bin: "lixeira",
33688
+ china_cabinet: "cristaleira"
33689
+ };
33690
+ var FLOORPLAN_POOL_ALIASES = FLOORPLAN_POOL_KEYS;
33691
+ var categories_default = [
33692
+ {
33693
+ id: "food",
33694
+ name: "Food"
33695
+ },
33696
+ {
33697
+ id: "drink",
33698
+ name: "Drink"
33699
+ },
33700
+ {
33701
+ id: "medical",
33702
+ name: "Medical"
33703
+ },
33704
+ {
33705
+ id: "tools",
33706
+ name: "Tools"
33707
+ },
33708
+ {
33709
+ id: "melee",
33710
+ name: "Melee"
33711
+ },
33712
+ {
33713
+ id: "materials",
33714
+ name: "Materials"
33715
+ },
33716
+ {
33717
+ id: "clothing",
33718
+ name: "Clothing"
33719
+ },
33720
+ {
33721
+ id: "bags",
33722
+ name: "Bags"
33723
+ },
33724
+ {
33725
+ id: "electronics",
33726
+ name: "Electronics"
33727
+ },
33728
+ {
33729
+ id: "fuel",
33730
+ name: "Fuel"
33731
+ },
33732
+ {
33733
+ id: "outdoors",
33734
+ name: "Outdoors"
33735
+ },
33736
+ {
33737
+ id: "books",
33738
+ name: "Books"
33739
+ },
33740
+ {
33741
+ id: "collectibles",
33742
+ name: "Collectibles"
33743
+ },
33744
+ {
33745
+ id: "keys",
33746
+ name: "Keys"
33747
+ },
33748
+ {
33749
+ id: "ammo",
33750
+ name: "Ammo"
33751
+ },
33752
+ {
33753
+ id: "firearms",
33754
+ name: "Firearms"
33755
+ },
33756
+ {
33757
+ id: "throwables",
33758
+ name: "Throwables"
33759
+ }
33760
+ ];
33761
+ var containers_default = [
33762
+ {
33763
+ id: "fridge",
33764
+ teamName: "Geladeira",
33765
+ gameKey: "geladeira",
33766
+ places: [
33767
+ "house",
33768
+ "apartment",
33769
+ "supermarket",
33770
+ "gas_station"
33771
+ ],
33772
+ count: [
33773
+ 0,
33774
+ 4
33775
+ ],
33776
+ teamCount: [
33777
+ 0,
33778
+ 4
33779
+ ],
33780
+ categories: {
33781
+ food: 0.55,
33782
+ drink: 0.45
33783
+ },
33784
+ teamCategories: "comida perec\xEDvel e bebida",
33785
+ rule: "Sem energia, o perec\xEDvel de dentro come\xE7a a contar como fora da geladeira."
33786
+ },
33787
+ {
33788
+ id: "kitchen_cabinet",
33789
+ teamName: "Arm\xE1rio de cozinha",
33790
+ gameKey: "cozinha",
33791
+ places: [
33792
+ "house",
33793
+ "apartment",
33794
+ "church",
33795
+ "school"
33796
+ ],
33797
+ count: [
33798
+ 1,
33799
+ 4
33800
+ ],
33801
+ teamCount: [
33802
+ 1,
33803
+ 4
33804
+ ],
33805
+ categories: {
33806
+ food: 0.7,
33807
+ melee: 0.12,
33808
+ electronics: 0.1,
33809
+ tools: 0.08
33810
+ },
33811
+ teamCategories: "comida seca e enlatada, panela, abridor, isqueiro"
33812
+ },
33813
+ {
33814
+ id: "bathroom_cabinet",
32775
33815
  teamName: "Arm\xE1rio do banheiro",
32776
33816
  gameKey: "banheiro",
32777
33817
  places: [
@@ -46238,6 +47278,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
46238
47278
  impact: {
46239
47279
  response: "dent",
46240
47280
  pushImpulse: true
47281
+ },
47282
+ use: {
47283
+ clip: "use_hygiene",
47284
+ sounds: [
47285
+ "scrub"
47286
+ ]
46241
47287
  }
46242
47288
  }
46243
47289
  }
@@ -49825,6 +50871,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
49825
50871
  items: [
49826
50872
  "alcohol_70",
49827
50873
  "povidone_iodine"
50874
+ ],
50875
+ params: {
50876
+ clip: "apply_dressing"
50877
+ }
50878
+ },
50879
+ {
50880
+ id: "wash",
50881
+ effect: "wash",
50882
+ consumes: false,
50883
+ items: [
50884
+ "soap",
50885
+ "shampoo",
50886
+ "toothpaste",
50887
+ "toothbrush",
50888
+ "deodorant",
50889
+ "towel"
49828
50890
  ]
49829
50891
  },
49830
50892
  {
@@ -49846,7 +50908,44 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
49846
50908
  consumes: false,
49847
50909
  items: [
49848
50910
  "flashlight"
49849
- ]
50911
+ ],
50912
+ params: {
50913
+ clip: "toggle_flashlight"
50914
+ }
50915
+ },
50916
+ {
50917
+ id: "ignite",
50918
+ effect: "ignite",
50919
+ consumes: false,
50920
+ items: [
50921
+ "lighter"
50922
+ ],
50923
+ params: {
50924
+ clip: "light_lighter"
50925
+ }
50926
+ },
50927
+ {
50928
+ id: "radio_call",
50929
+ effect: "radio_call",
50930
+ consumes: false,
50931
+ items: [
50932
+ "portable_radio",
50933
+ "walkie_talkies"
50934
+ ],
50935
+ params: {
50936
+ clip: "use_radio"
50937
+ }
50938
+ },
50939
+ {
50940
+ id: "turn_key",
50941
+ effect: "turn_key",
50942
+ consumes: false,
50943
+ category: [
50944
+ "keys"
50945
+ ],
50946
+ params: {
50947
+ clip: "turn_key"
50948
+ }
49850
50949
  },
49851
50950
  {
49852
50951
  id: "swap_bag",
@@ -51147,6 +52246,29 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51147
52246
  "kind.hygiene.description": "Sabonete, pasta de dente, papel higi\xEAnico e toalha."
51148
52247
  };
51149
52248
  var GOODS_STRINGS = { en: en_default2, "pt-BR": pt_BR_default2 };
52249
+ var drinkHydrationOf = (item, liquids = LIQUIDS) => {
52250
+ const fluid = item.fluid;
52251
+ const drink = fluid ? liquids.find((liquid) => liquid.id === fluid.liquid)?.drink : void 0;
52252
+ if (!fluid || !drink) return void 0;
52253
+ const doses = item.durability?.kind === "doses" ? Math.max(1, item.durability.amount ?? 1) : 1;
52254
+ return drink.thirst * fluid.liters / doses;
52255
+ };
52256
+ var createGoodsItemUse = (options = {}) => {
52257
+ const kinds = options.kinds ?? createGoodsKinds();
52258
+ const effects = options.effects ?? GOODS_USE_EFFECTS;
52259
+ const liquids = options.liquids ?? LIQUIDS;
52260
+ return (item) => {
52261
+ if (item.kind === void 0 || !kinds.has(item.kind)) return void 0;
52262
+ const result2 = resolveUse(item, effects);
52263
+ const { clip: effectClip, ...params } = result2?.params ?? {};
52264
+ const clip = typeof effectClip === "string" ? effectClip : resolveEntry(kinds, item).use?.clip;
52265
+ if (clip === void 0) return void 0;
52266
+ if (!result2) return { clip, consumes: false };
52267
+ const nutrition = result2.nutrition ? { satiety: result2.nutrition.satiety, hydration: drinkHydrationOf(item, liquids) ?? result2.nutrition.hydration } : {};
52268
+ return { clip, consumes: result2.consumes, effect: { id: result2.effect, ...Object.keys(params).length > 0 ? { params } : {}, ...nutrition } };
52269
+ };
52270
+ };
52271
+ var goodsItemUse = createGoodsItemUse();
51150
52272
 
51151
52273
  // ../game-interactables-household/dist/index.js
51152
52274
  var door = (material, joint2 = "hinge", piece2 = "door") => ({ material, joint: joint2, piece: piece2 });
@@ -51158,6 +52280,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51158
52280
  var fridgeLike = { body: { material: "steel", joint: "weld" }, parts: [[/^door/, door("steel")]] };
51159
52281
  var bin = { body: { material: "plastic", joint: "fused" }, parts: [["lid", door("plastic", "hinge", "lid")]] };
51160
52282
  var upholstery = { material: "fabric", joint: "glue" };
52283
+ var POLE_CAGE = { material: "steel", spacing: 0.1, diameter: 0.01 };
51161
52284
  var DESTRUCTION = {
51162
52285
  fridge: fridgeLike,
51163
52286
  fridge_compact: fridgeLike,
@@ -51183,7 +52306,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51183
52306
  },
51184
52307
  wall_socket: { body: { material: "plastic", joint: "screw" }, parts: [] },
51185
52308
  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")]] },
52309
+ // 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
52310
+ service_entrance: { body: { material: "concrete", joint: "rebar", reinforcement: POLE_CAGE }, parts: [["meter_door", door("steel")]] },
51187
52311
  conduit_run: { body: { material: "plastic", joint: "clip" }, parts: [] },
51188
52312
  service_mast: { body: { material: "steel", joint: "clip" }, parts: [] },
51189
52313
  electrical_panel: {
@@ -51847,7 +52971,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51847
52971
  h: 0.7,
51848
52972
  y: 1.4,
51849
52973
  solid: true,
51850
- massKg: 15
52974
+ massKg: 15,
52975
+ fixed: true
51851
52976
  },
51852
52977
  {
51853
52978
  id: "pantry",
@@ -51932,7 +53057,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51932
53057
  h: 1.2,
51933
53058
  y: 0,
51934
53059
  solid: true,
51935
- massKg: 40
53060
+ massKg: 40,
53061
+ fixed: true
51936
53062
  },
51937
53063
  {
51938
53064
  id: "sink_bathroom",
@@ -51942,7 +53068,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51942
53068
  h: 1.05,
51943
53069
  y: 0,
51944
53070
  solid: true,
51945
- massKg: 25
53071
+ massKg: 25,
53072
+ fixed: true
51946
53073
  },
51947
53074
  {
51948
53075
  id: "shower",
@@ -51952,7 +53079,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51952
53079
  h: 2.1,
51953
53080
  y: 0,
51954
53081
  solid: true,
51955
- massKg: 90
53082
+ massKg: 90,
53083
+ fixed: true
51956
53084
  },
51957
53085
  {
51958
53086
  id: "toilet",
@@ -51962,7 +53090,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51962
53090
  h: 0.8,
51963
53091
  y: 0,
51964
53092
  solid: true,
51965
- massKg: 30
53093
+ massKg: 30,
53094
+ fixed: true
51966
53095
  },
51967
53096
  {
51968
53097
  id: "utility_sink",
@@ -51972,7 +53101,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51972
53101
  h: 1.2,
51973
53102
  y: 0,
51974
53103
  solid: true,
51975
- massKg: 25
53104
+ massKg: 25,
53105
+ fixed: true
51976
53106
  },
51977
53107
  {
51978
53108
  id: "wall_socket",
@@ -52002,7 +53132,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52002
53132
  h: 6.5,
52003
53133
  y: 0,
52004
53134
  solid: true,
52005
- massKg: 60
53135
+ massKg: 320,
53136
+ fixed: true
52006
53137
  },
52007
53138
  {
52008
53139
  id: "service_mast",
@@ -54954,7 +56085,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
54954
56085
  }
54955
56086
  var residentialTower = residentialTowerTemplate();
54956
56087
 
54957
- // ../game-floorplan-three/dist/chunk-T2LV6LOQ.js
56088
+ // ../game-floorplan-three/dist/chunk-Z3IBCX7E.js
54958
56089
  var __defProp4 = Object.defineProperty;
54959
56090
  var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
54960
56091
  var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
@@ -62665,8 +63796,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
62665
63796
  return drawer2 ? "drawer" : /^wardrobe/.test(type) ? "wardrobe" : /fridge|refrig|freezer/.test(type) ? "fridge" : /pantry/.test(type) ? "pantry" : "cabinet";
62666
63797
  }
62667
63798
  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) => {
63799
+ const calls = [], pr = { light: (MM2, ...a) => api.light(MM2, ...a) };
63800
+ for (const n of ["box", "cylinder", "leaf", "plane"]) pr[n] = (MM2, ...a) => {
62670
63801
  calls.push([n, a]);
62671
63802
  };
62672
63803
  return { pr, calls };
@@ -67403,8 +68534,51 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67403
68534
  installBuildBuild(K, shared3);
67404
68535
  return buildApi(K, shared3);
67405
68536
  }
68537
+ var STRUCTURE_SKIN = {
68538
+ wood_hard: 0.018,
68539
+ wood_soft: 0.018,
68540
+ plywood: 0.015,
68541
+ mdf: 0.018,
68542
+ plastic: 4e-3,
68543
+ rubber: 5e-3,
68544
+ steel: 12e-4,
68545
+ aluminium: 2e-3,
68546
+ cast_iron: 6e-3,
68547
+ copper: 1e-3,
68548
+ glass: 5e-3,
68549
+ tempered_glass: 6e-3,
68550
+ ceramic: 8e-3
68551
+ };
68552
+ var FOAM_DENSITY = 30;
68553
+ var FABRIC_DENSITY = 400;
68554
+ var UPHOLSTERY_COVER = 3e-3;
68555
+ var shellFraction = (shape, skin) => {
68556
+ if (shape.kind === "box") {
68557
+ const [a, b, c] = shape.size;
68558
+ const inner = Math.max(0, a - 2 * skin) * Math.max(0, b - 2 * skin) * Math.max(0, c - 2 * skin);
68559
+ return 1 - inner / (a * b * c);
68560
+ }
68561
+ if (shape.kind === "cylinder") {
68562
+ const { radius: r, height: h } = shape;
68563
+ const inner = Math.max(0, r - skin) ** 2 * Math.max(0, h - 2 * skin);
68564
+ return 1 - inner / (r * r * h);
68565
+ }
68566
+ return 1 - (Math.max(0, shape.radius - skin) / shape.radius) ** 3;
68567
+ };
68568
+ var thinnest = (shape) => shape.kind === "box" ? Math.min(...shape.size) : shape.kind === "cylinder" ? Math.min(shape.radius * 2, shape.height) : shape.radius * 2;
68569
+ function structureFill(material, shape) {
68570
+ if (material === "fabric") {
68571
+ if (thinnest(shape) <= 4 * UPHOLSTERY_COVER) return 1;
68572
+ const cover = shellFraction(shape, UPHOLSTERY_COVER);
68573
+ return cover + (1 - cover) * (FOAM_DENSITY / FABRIC_DENSITY);
68574
+ }
68575
+ const skin = STRUCTURE_SKIN[material];
68576
+ if (skin === void 0 || thinnest(shape) <= 3 * skin) return 1;
68577
+ return shellFraction(shape, skin);
68578
+ }
67406
68579
  var HOLD_REACH2 = 0.05;
67407
68580
  var BACK_TOUCH = 0.02;
68581
+ var AGAINST_WALL = 0.1;
67408
68582
  var SOFT = /* @__PURE__ */ new Set(["fabric", "paper", "foliage"]);
67409
68583
  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
68584
  function groupsOf(parts2, joints) {
@@ -67423,11 +68597,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67423
68597
  }
67424
68598
  return [...groups.values()];
67425
68599
  }
67426
- function nearestJoint(loose, held, boxOf3, reach2) {
68600
+ function nearestJoint(loose, held, boxOf4, reach2) {
67427
68601
  let best = null;
67428
68602
  for (const a of loose) {
67429
68603
  for (const b of held) {
67430
- const gap = gapOf(boxOf3(a.id), boxOf3(b.id));
68604
+ const gap = gapOf(boxOf4(a.id), boxOf4(b.id));
67431
68605
  if (gap <= reach2 && (!best || gap < best.gap)) best = { gap, a, b };
67432
68606
  }
67433
68607
  }
@@ -67437,21 +68611,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67437
68611
  }
67438
68612
  var FLOOR_TOUCH = 5e-3;
67439
68613
  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);
68614
+ function standsAlone(group, boxOf4) {
68615
+ const feet = group.map((part) => boxOf4(part.id)).filter((box5) => box5.min[1] <= FLOOR_TOUCH);
67442
68616
  if (feet.length === 0) return false;
67443
- const height = Math.max(...group.map((part) => boxOf3(part.id).max[1]));
68617
+ const height = Math.max(...group.map((part) => boxOf4(part.id).max[1]));
67444
68618
  const across2 = (k) => Math.max(...feet.map((box5) => box5.max[k])) - Math.min(...feet.map((box5) => box5.min[k]));
67445
68619
  return Math.min(across2(0), across2(2)) >= STANDS_ALONE * height;
67446
68620
  }
67447
- function joinBodies({ parts: parts2, joints, boxOf: boxOf3 }, byId) {
68621
+ function joinBodies({ parts: parts2, joints, boxOf: boxOf4 }, byId) {
67448
68622
  const groups = groupsOf(parts2, joints).map((ids) => ids.map((id) => byId.get(id))).sort((a, b) => b.length - a.length);
67449
68623
  const [main, ...rest2] = groups;
67450
68624
  if (!main) return;
68625
+ const mainHeld = main.some((part) => part.anchored);
67451
68626
  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);
68627
+ if (standsAlone(group, boxOf4)) continue;
68628
+ const joint2 = nearestJoint(group, main, boxOf4, Infinity);
68629
+ if (joint2) joints.push(mainHeld && group.some((part) => part.anchored) ? { ...joint2, tears: true } : joint2);
67455
68630
  }
67456
68631
  }
67457
68632
  function holdLooseGroups(params) {
@@ -67459,8 +68634,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67459
68634
  holdHanging(params, byId);
67460
68635
  joinBodies(params, byId);
67461
68636
  }
67462
- function holdHanging({ parts: parts2, joints, boxOf: boxOf3 }, byId) {
67463
- const back = Math.min(...parts2.map((part) => boxOf3(part.id).min[2]));
68637
+ function holdHanging({ parts: parts2, joints, boxOf: boxOf4 }, byId) {
68638
+ const back = Math.min(...parts2.map((part) => boxOf4(part.id).min[2]));
67464
68639
  for (let pass = 0; pass < parts2.length; pass++) {
67465
68640
  const groups = groupsOf(parts2, joints).map((ids) => ids.map((id) => byId.get(id)));
67466
68641
  const held = groups.filter((group) => group.some((part) => part.anchored)).flat();
@@ -67468,20 +68643,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67468
68643
  if (loose.length === 0) return;
67469
68644
  let changed = false;
67470
68645
  for (const group of loose) {
67471
- const joint2 = nearestJoint(group, held, boxOf3, HOLD_REACH2);
68646
+ const joint2 = nearestJoint(group, held, boxOf4, HOLD_REACH2);
67472
68647
  if (joint2) {
67473
68648
  joints.push(joint2);
67474
68649
  changed = true;
67475
68650
  continue;
67476
68651
  }
67477
- const onWall = group.filter((part) => !SOFT.has(part.material) && boxOf3(part.id).min[2] <= back + BACK_TOUCH);
68652
+ const againstWall = held.length === 0 || held.some((part) => boxOf4(part.id).min[2] <= back + AGAINST_WALL);
68653
+ const onWall = againstWall ? group.filter((part) => !SOFT.has(part.material) && boxOf4(part.id).min[2] <= back + BACK_TOUCH) : [];
67478
68654
  if (onWall.length === 0) continue;
67479
68655
  for (const part of onWall) part.anchored = true;
67480
68656
  changed = true;
67481
68657
  }
67482
68658
  if (changed) continue;
67483
68659
  for (const group of loose) {
67484
- const joint2 = nearestJoint(group, held, boxOf3, Infinity);
68660
+ const joint2 = nearestJoint(group, held, boxOf4, Infinity);
67485
68661
  if (joint2) joints.push(joint2);
67486
68662
  }
67487
68663
  return;
@@ -67514,7 +68690,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67514
68690
  if (carcassed) return tops;
67515
68691
  for (let i = drawn.length - 1; i >= 0; i--) {
67516
68692
  const p = drawn[i];
67517
- if (p.key !== "wood" || materialOf2.wood !== "wood_hard" || p.shape.kind !== "box" || p.rotation) continue;
68693
+ if (p.material || p.key !== "wood" || materialOf2.wood !== "wood_hard" || p.shape.kind !== "box" || p.rotation) continue;
67518
68694
  const [sx, sy, sz] = p.shape.size;
67519
68695
  const across2 = sx < sz ? 0 : 2;
67520
68696
  const width = Math.min(sx, sz);
@@ -67537,14 +68713,106 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67537
68713
  }
67538
68714
  return tops;
67539
68715
  }
67540
- function shadeBoard(color2, board) {
67541
- const k = [1, 0.94, 1.05, 0.97, 1.03][board % 5];
68716
+ 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)$/;
68717
+ var DRAWER_CASES = /^(dresser|nightstand|console_table|vanity_table)$/;
68718
+ var CASE_BODY_MIN = 0.2;
68719
+ var FRONT_THICK = 0.03;
68720
+ var FRONT_REACH = 0.03;
68721
+ var CASE_BOARD = 0.018;
68722
+ var CASE_BACK = 6e-3;
68723
+ var DRAWER_SIDE = 0.012;
68724
+ var DRAWER_BOTTOM = 6e-3;
68725
+ var SHELF_PITCH = 0.45;
68726
+ var WARDROBES = /wardrobe/;
68727
+ var HANGING_SHELF_DROP = 0.35;
68728
+ function board(body, suffix, material, min2, max2, color2 = body.color) {
68729
+ const size = [max2[0] - min2[0], max2[1] - min2[1], max2[2] - min2[2]];
68730
+ const position = [(min2[0] + max2[0]) / 2, (min2[1] + max2[1]) / 2, (min2[2] + max2[2]) / 2];
68731
+ return { id: `${body.id}_${suffix}`, key: body.key, material, shape: { kind: "box", size }, position, rotation: null, color: color2, min: min2, max: max2 };
68732
+ }
68733
+ function hollowCases(drawn, type) {
68734
+ const made2 = /* @__PURE__ */ new Set();
68735
+ if (!CASES.test(type)) return made2;
68736
+ const drawers = DRAWER_CASES.test(type);
68737
+ for (let i = drawn.length - 1; i >= 0; i--) {
68738
+ const body = drawn[i];
68739
+ if (body.key !== "wood" && body.key !== "plain" || body.shape.kind !== "box" || body.rotation) continue;
68740
+ const [sx, sy, sz] = body.shape.size;
68741
+ if (Math.min(sx, sy, sz) < CASE_BODY_MIN) continue;
68742
+ const fronts = drawn.filter((p) => {
68743
+ if (p === body || p.shape.kind !== "box" || p.rotation || p.key !== "wood" && p.key !== "plain") return false;
68744
+ const thick = p.max[2] - p.min[2];
68745
+ if (thick > FRONT_THICK || thick >= p.max[0] - p.min[0] || thick >= p.max[1] - p.min[1]) return false;
68746
+ const cx = (p.min[0] + p.max[0]) / 2;
68747
+ const cy = (p.min[1] + p.max[1]) / 2;
68748
+ 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];
68749
+ });
68750
+ if (fronts.length === 0) continue;
68751
+ const [x0, y0, z0] = body.min;
68752
+ const [x1, y1, z1] = body.max;
68753
+ const T2 = CASE_BOARD;
68754
+ const zi = z0 + CASE_BACK;
68755
+ const inner = 0.92;
68756
+ const tone = (k) => {
68757
+ const c = (s) => Math.min(255, Math.round((body.color >> s & 255) * k)) << s;
68758
+ return c(16) | c(8) | c(0);
68759
+ };
68760
+ const boards = [
68761
+ board(body, "back", "plywood", [x0, y0, z0], [x1, y1, zi], tone(0.8)),
68762
+ board(body, "side_l", "mdf", [x0, y0, zi], [x0 + T2, y1, z1]),
68763
+ board(body, "side_r", "mdf", [x1 - T2, y0, zi], [x1, y1, z1]),
68764
+ board(body, "top", "mdf", [x0 + T2, y1 - T2, zi], [x1 - T2, y1, z1]),
68765
+ board(body, "bottom", "mdf", [x0 + T2, y0, zi], [x1 - T2, y0 + T2, z1], tone(inner))
68766
+ ];
68767
+ const ix0 = x0 + T2;
68768
+ const ix1 = x1 - T2;
68769
+ const iy0 = y0 + T2;
68770
+ const iy1 = y1 - T2;
68771
+ if (drawers) {
68772
+ const stack = [...fronts].sort((a, b) => a.min[1] - b.min[1]);
68773
+ stack.forEach((front, k) => {
68774
+ const dy0 = Math.max(front.min[1] + 0.01, iy0 + 2e-3);
68775
+ const dy1 = Math.min(front.max[1] - 0.02, iy1 - 2e-3);
68776
+ const dz0 = zi + 0.01;
68777
+ const dz1 = front.min[2];
68778
+ if (dy1 - dy0 < 0.04 || dz1 - dz0 < 0.1) return;
68779
+ const a = ix0 + 2e-3;
68780
+ const b = ix1 - 2e-3;
68781
+ boards.push(
68782
+ board(body, `drawer${k}_side_l`, "mdf", [a, dy0, dz0], [a + DRAWER_SIDE, dy1, dz1], tone(inner)),
68783
+ board(body, `drawer${k}_side_r`, "mdf", [b - DRAWER_SIDE, dy0, dz0], [b, dy1, dz1], tone(inner)),
68784
+ board(body, `drawer${k}_back`, "mdf", [a + DRAWER_SIDE, dy0, dz0], [b - DRAWER_SIDE, dy1, dz0 + DRAWER_SIDE], tone(inner)),
68785
+ board(body, `drawer${k}_bottom`, "mdf", [a + DRAWER_SIDE, dy0, dz0 + DRAWER_SIDE], [b - DRAWER_SIDE, dy0 + DRAWER_BOTTOM, dz1], tone(inner))
68786
+ );
68787
+ const above2 = stack[k + 1];
68788
+ if (!above2) return;
68789
+ const mid = (front.max[1] + above2.min[1]) / 2;
68790
+ if (above2.min[1] - front.max[1] < T2 || mid - T2 / 2 < dy1 || mid + T2 / 2 > iy1) return;
68791
+ boards.push(board(body, `rail${k}`, "mdf", [ix0, mid - T2 / 2, zi], [ix1, mid + T2 / 2, z1], tone(inner)));
68792
+ });
68793
+ } else {
68794
+ const height = iy1 - iy0;
68795
+ const count = Math.max(0, Math.round(height / SHELF_PITCH) - 1);
68796
+ const levels = WARDROBES.test(type) ? [iy1 - HANGING_SHELF_DROP] : Array.from({ length: count }, (_, k) => iy0 + (k + 1) * height / (count + 1));
68797
+ 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))));
68798
+ }
68799
+ for (const front of fronts) front.material = "mdf";
68800
+ drawn.splice(i, 1, ...boards);
68801
+ for (const b of boards) made2.add(b.id);
68802
+ }
68803
+ return made2;
68804
+ }
68805
+ function shadeBoard(color2, board2) {
68806
+ const k = [1, 0.94, 1.05, 0.97, 1.03][board2 % 5];
67542
68807
  const channel = (shift) => Math.min(255, Math.round((color2 >> shift & 255) * k)) << shift;
67543
68808
  return channel(16) | channel(8) | channel(0);
67544
68809
  }
67545
68810
  var FLOOR_TOUCH2 = 5e-3;
67546
68811
  var LOOSE = /* @__PURE__ */ new Set(["paper"]);
67547
- var PLANTED = /* @__PURE__ */ new Set(["mailbox", "correio", "clothesline", "tree_small", "bbq_simple"]);
68812
+ var PLANTED = /* @__PURE__ */ new Set(["mailbox", "correio", "clothesline", "tree_small", "fruit_tree", "bbq_simple"]);
68813
+ var INSTALLED = /* @__PURE__ */ new Set(["toilet", "washbasin", "pedestal_basin", "shower", "shower_large", "laundry_tub"]);
68814
+ var WEIGHTED_FOOT = /* @__PURE__ */ new Set(["floor_lamp"]);
68815
+ var FOOT_MATERIAL = "cast_iron";
67548
68816
  var BASE_MATERIAL = {
67549
68817
  wood: "wood_hard",
67550
68818
  metal: "steel",
@@ -67620,13 +68888,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67620
68888
  };
67621
68889
  run(A);
67622
68890
  if (!drawn.length) throw new Error(`game-floorplan-three: the builder of "${name}" drew no box or cylinder`);
68891
+ hollowCases(drawn, name);
67623
68892
  const boardsOf = splitTopsIntoBoards(drawn, materialOf2, Boolean(opts.carcass));
67624
68893
  const parts2 = drawn.map((p) => {
67625
68894
  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";
68895
+ let material = p.material ?? materialOf2[p.key] ?? "plastic";
68896
+ if (p.material) {
68897
+ } else if (p.key === "wood" && material === "wood_hard" && opts.carcass && !opts.materials?.wood) material = "mdf";
67628
68898
  else if (p.key === "wood" && material === "wood_hard" && thin < WOOD_THIN) material = "wood_soft";
68899
+ if (WEIGHTED_FOOT.has(name) && p.key === "metal" && p.min[1] <= FLOOR_TOUCH2) material = FOOT_MATERIAL;
67629
68900
  const part = { id: p.id, material, shape: p.shape, position: p.position };
68901
+ const fill22 = structureFill(material, p.shape);
68902
+ if (fill22 < 1) part.fill = Math.round(fill22 * 1e4) / 1e4;
67630
68903
  if (p.rotation) part.rotation = p.rotation;
67631
68904
  if (!LOOSE.has(material) && p.min[1] <= FLOOR_TOUCH2) part.anchored = true;
67632
68905
  if (opts.carcass && LOOSE.has(material)) {
@@ -67656,7 +68929,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67656
68929
  const wallMounted = parts2.some((part) => part.anchored && low(part) > FLOOR_TOUCH2);
67657
68930
  const sunk = parts2.some((part) => low(part) < -FLOOR_TOUCH2);
67658
68931
  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);
68932
+ const fixed2 = wallMounted || sunk || rooted || PLANTED.has(name) || INSTALLED.has(name);
67660
68933
  const all = drawn.reduce(
67661
68934
  (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
68935
  { x0: Infinity, x1: -Infinity, z0: Infinity, z1: -Infinity }
@@ -81600,8 +82873,59 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
81600
82873
  { at: 1, ...HOLD }
81601
82874
  ]
81602
82875
  };
81603
- var TOOL_MOTIONS = /* @__PURE__ */ new Map([
81604
- ["shovel", /* @__PURE__ */ new Map([["dig", SHOVEL_DIG], ["fill", SHOVEL_FILL], ["swing", SHOVEL_SWING]])]
82876
+ var KNIFE_SLASH = {
82877
+ pivot: "grip",
82878
+ keys: [
82879
+ { at: 0, ...HOLD },
82880
+ { at: 0.28, offset: [0.07, 0.2, 0.05], turn: [0.5, -0.9, 0] },
82881
+ { at: 0.43, offset: [-0.14, 0.06, -0.07], turn: [0.1, 0.9, 0] },
82882
+ { at: 0.62, offset: [-0.2, -0.08, 0], turn: [-0.2, 1.3, 0] },
82883
+ { at: 1, ...HOLD }
82884
+ ]
82885
+ };
82886
+ var KNIFE_STAB = {
82887
+ pivot: "grip",
82888
+ keys: [
82889
+ { at: 0, ...HOLD },
82890
+ { at: 0.28, offset: [0.03, -0.05, 0.08], turn: [0.15, -0.1, 0] },
82891
+ { at: 0.43, offset: [-0.1, 0.07, -0.12], turn: [0.1, 0.55, 0] },
82892
+ { at: 0.6, offset: [-0.1, 0.07, -0.11], turn: [0.1, 0.52, 0] },
82893
+ { at: 1, ...HOLD }
82894
+ ]
82895
+ };
82896
+ var BAT_SWING = {
82897
+ pivot: "grip",
82898
+ keys: [
82899
+ { at: 0, ...HOLD },
82900
+ { at: 0.29, offset: [0.12, 0.12, 0.1], turn: [1.9, -0.6, 0] },
82901
+ { at: 0.43, offset: [-0.1, 0.04, -0.07], turn: [-0.3, 1.2, 0] },
82902
+ { at: 0.64, offset: [-0.28, 0.1, 0], turn: [2, 1, 0] },
82903
+ { at: 0.8, offset: [-0.2, 0.06, 0.02], turn: [1.8, 0.8, 0] },
82904
+ { at: 1, ...HOLD }
82905
+ ]
82906
+ };
82907
+ var ONE_HAND_CHOP = {
82908
+ keys: [
82909
+ { at: 0, ...HOLD },
82910
+ { at: 0.3, offset: [0.04, 0.4, 0.04], turn: [0.5, 0, -0.2] },
82911
+ { at: 0.43, offset: [-0.03, 0.18, -0.22], turn: [-0.6, 0, 0.1] },
82912
+ { at: 0.62, offset: [-0.05, -0.03, -0.18], turn: [-1.1, 0, 0.2] },
82913
+ { at: 1, ...HOLD }
82914
+ ]
82915
+ };
82916
+ var FAMILY_MOTIONS = /* @__PURE__ */ new Map([
82917
+ ["short_blade", /* @__PURE__ */ new Map([["slash", KNIFE_SLASH], ["stab", KNIFE_STAB]])],
82918
+ ["one_hand_swing", /* @__PURE__ */ new Map([["chop", ONE_HAND_CHOP]])],
82919
+ ["bat_swing", /* @__PURE__ */ new Map([["bat_swing", BAT_SWING]])],
82920
+ // an axe or a pickaxe swung with both hands goes as the shovel's swing
82921
+ ["two_hand_swing", /* @__PURE__ */ new Map([["swing", SHOVEL_SWING]])]
82922
+ ]);
82923
+ var TOOL_MOTIONS = new Map([
82924
+ ["shovel", /* @__PURE__ */ new Map([["dig", SHOVEL_DIG], ["fill", SHOVEL_FILL], ["swing", SHOVEL_SWING]])],
82925
+ ...MELEE_FAMILIES.flatMap((family) => {
82926
+ const motions = FAMILY_MOTIONS.get(family.id);
82927
+ return motions ? family.weapons.map((weapon2) => [weapon2, motions]) : [];
82928
+ })
81605
82929
  ]);
81606
82930
  var ease2 = (s) => s * s * (3 - 2 * s);
81607
82931
  function sampleToolMotion(motion, at4) {
@@ -81684,696 +83008,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
81684
83008
  return group;
81685
83009
  }
81686
83010
 
81687
- // ../game-fluids/dist/index.js
81688
- var liquids_default = [
81689
- {
81690
- id: "water",
81691
- color: 11064558,
81692
- opacity: 0.35,
81693
- stainColor: 7309206,
81694
- viscosity: 1,
81695
- density: 1e3,
81696
- dryTime: 180,
81697
- gloss: 0.9,
81698
- drink: {
81699
- thirst: 100,
81700
- effects: []
81701
- },
81702
- tags: [
81703
- "drink",
81704
- "clear"
81705
- ]
81706
- },
81707
- {
81708
- id: "coffee",
81709
- color: 3875604,
81710
- opacity: 0.95,
81711
- stainColor: 2824202,
81712
- viscosity: 1.5,
81713
- density: 1005,
81714
- dryTime: 900,
81715
- gloss: 0.8,
81716
- leavesMark: true,
81717
- steamC: 60,
81718
- drink: {
81719
- thirst: 80,
81720
- effects: [
81721
- "caffeine"
81722
- ]
81723
- },
81724
- tags: [
81725
- "drink",
81726
- "hot"
81727
- ]
81728
- },
81729
- {
81730
- id: "tea",
81731
- color: 9063188,
81732
- opacity: 0.8,
81733
- stainColor: 6961682,
81734
- viscosity: 1.4,
81735
- density: 1005,
81736
- dryTime: 800,
81737
- gloss: 0.8,
81738
- leavesMark: true,
81739
- steamC: 60,
81740
- drink: {
81741
- thirst: 90,
81742
- effects: []
81743
- },
81744
- tags: [
81745
- "drink",
81746
- "hot"
81747
- ]
81748
- },
81749
- {
81750
- id: "milk",
81751
- color: 16052712,
81752
- opacity: 0.98,
81753
- stainColor: 14473160,
81754
- viscosity: 2,
81755
- density: 1030,
81756
- dryTime: 900,
81757
- gloss: 0.5,
81758
- leavesMark: true,
81759
- drink: {
81760
- thirst: 70,
81761
- effects: []
81762
- },
81763
- tags: [
81764
- "drink"
81765
- ]
81766
- },
81767
- {
81768
- id: "soda",
81769
- color: 3808530,
81770
- opacity: 0.85,
81771
- stainColor: 2757901,
81772
- viscosity: 1.3,
81773
- density: 1040,
81774
- dryTime: 1200,
81775
- gloss: 0.85,
81776
- leavesMark: true,
81777
- drink: {
81778
- thirst: 60,
81779
- effects: []
81780
- },
81781
- tags: [
81782
- "drink",
81783
- "sticky"
81784
- ]
81785
- },
81786
- {
81787
- id: "juice",
81788
- color: 15239467,
81789
- opacity: 0.9,
81790
- stainColor: 12741916,
81791
- viscosity: 2,
81792
- density: 1045,
81793
- dryTime: 1100,
81794
- gloss: 0.8,
81795
- leavesMark: true,
81796
- drink: {
81797
- thirst: 75,
81798
- effects: []
81799
- },
81800
- tags: [
81801
- "drink",
81802
- "sticky"
81803
- ]
81804
- },
81805
- {
81806
- id: "beer",
81807
- color: 14259740,
81808
- opacity: 0.8,
81809
- stainColor: 11039764,
81810
- viscosity: 1.4,
81811
- density: 1010,
81812
- dryTime: 900,
81813
- gloss: 0.8,
81814
- drink: {
81815
- thirst: 50,
81816
- effects: [
81817
- "alcohol"
81818
- ]
81819
- },
81820
- tags: [
81821
- "drink",
81822
- "alcohol"
81823
- ]
81824
- },
81825
- {
81826
- id: "wine",
81827
- color: 7016223,
81828
- opacity: 0.9,
81829
- stainColor: 5048854,
81830
- viscosity: 1.6,
81831
- density: 990,
81832
- dryTime: 800,
81833
- gloss: 0.85,
81834
- leavesMark: true,
81835
- drink: {
81836
- thirst: 40,
81837
- effects: [
81838
- "alcohol"
81839
- ]
81840
- },
81841
- tags: [
81842
- "drink",
81843
- "alcohol"
81844
- ]
81845
- },
81846
- {
81847
- id: "spirits",
81848
- color: 13214042,
81849
- opacity: 0.6,
81850
- stainColor: 10320959,
81851
- viscosity: 1.8,
81852
- density: 940,
81853
- dryTime: 200,
81854
- gloss: 0.85,
81855
- flammable: true,
81856
- drink: {
81857
- thirst: 5,
81858
- effects: [
81859
- "alcohol"
81860
- ]
81861
- },
81862
- tags: [
81863
- "drink",
81864
- "alcohol"
81865
- ]
81866
- },
81867
- {
81868
- id: "fuel",
81869
- color: 14926682,
81870
- opacity: 0.6,
81871
- stainColor: 7232298,
81872
- viscosity: 0.6,
81873
- density: 740,
81874
- dryTime: 60,
81875
- gloss: 0.95,
81876
- leavesMark: false,
81877
- flammable: true,
81878
- drink: {
81879
- thirst: 0,
81880
- effects: [
81881
- "poison"
81882
- ]
81883
- },
81884
- tags: [
81885
- "fuel",
81886
- "gasoline"
81887
- ]
81888
- },
81889
- {
81890
- id: "diesel",
81891
- color: 12098094,
81892
- opacity: 0.8,
81893
- stainColor: 5917208,
81894
- viscosity: 3,
81895
- density: 830,
81896
- dryTime: 3600,
81897
- gloss: 0.95,
81898
- leavesMark: true,
81899
- flammable: true,
81900
- drink: {
81901
- thirst: 0,
81902
- effects: [
81903
- "poison"
81904
- ]
81905
- },
81906
- tags: [
81907
- "fuel"
81908
- ]
81909
- },
81910
- {
81911
- id: "motor_oil",
81912
- color: 3877388,
81913
- opacity: 0.95,
81914
- stainColor: 1840134,
81915
- viscosity: 100,
81916
- density: 880,
81917
- dryTime: 0,
81918
- gloss: 1,
81919
- leavesMark: true,
81920
- flammable: true,
81921
- drink: {
81922
- thirst: 0,
81923
- effects: [
81924
- "poison"
81925
- ]
81926
- },
81927
- tags: [
81928
- "oil"
81929
- ]
81930
- },
81931
- {
81932
- id: "cooking_oil",
81933
- color: 14267708,
81934
- opacity: 0.85,
81935
- stainColor: 11110698,
81936
- viscosity: 60,
81937
- density: 920,
81938
- dryTime: 0,
81939
- gloss: 1,
81940
- leavesMark: true,
81941
- flammable: true,
81942
- drink: {
81943
- thirst: 0,
81944
- effects: [
81945
- "poison"
81946
- ]
81947
- },
81948
- tags: [
81949
- "oil",
81950
- "food"
81951
- ]
81952
- },
81953
- {
81954
- id: "blood",
81955
- color: 7997964,
81956
- opacity: 0.92,
81957
- stainColor: 3874068,
81958
- viscosity: 4,
81959
- density: 1060,
81960
- dryTime: 600,
81961
- gloss: 0.75,
81962
- leavesMark: true,
81963
- drink: {
81964
- thirst: 10,
81965
- effects: [
81966
- "disgust"
81967
- ]
81968
- },
81969
- tags: [
81970
- "organic"
81971
- ]
81972
- },
81973
- {
81974
- id: "old_blood",
81975
- color: 7085078,
81976
- opacity: 0.92,
81977
- stainColor: 2758158,
81978
- viscosity: 4,
81979
- density: 1060,
81980
- dryTime: 360,
81981
- gloss: 0.7,
81982
- leavesMark: true,
81983
- drink: {
81984
- thirst: 10,
81985
- effects: [
81986
- "disgust"
81987
- ]
81988
- },
81989
- tags: [
81990
- "organic"
81991
- ]
81992
- },
81993
- {
81994
- id: "bile",
81995
- color: 9083434,
81996
- opacity: 0.9,
81997
- stainColor: 4080160,
81998
- viscosity: 6,
81999
- density: 1020,
82000
- dryTime: 900,
82001
- gloss: 0.75,
82002
- leavesMark: true,
82003
- drink: {
82004
- thirst: 0,
82005
- effects: [
82006
- "disgust"
82007
- ]
82008
- },
82009
- tags: [
82010
- "organic"
82011
- ]
82012
- },
82013
- {
82014
- id: "sap",
82015
- color: 13146940,
82016
- opacity: 0.8,
82017
- stainColor: 10122282,
82018
- viscosity: 200,
82019
- density: 1100,
82020
- dryTime: 3600,
82021
- gloss: 0.8,
82022
- leavesMark: true,
82023
- drink: {
82024
- thirst: 20,
82025
- effects: []
82026
- },
82027
- tags: [
82028
- "organic",
82029
- "sticky"
82030
- ]
82031
- },
82032
- {
82033
- id: "acid",
82034
- color: 10146378,
82035
- opacity: 0.6,
82036
- stainColor: 7313970,
82037
- viscosity: 1.5,
82038
- density: 1200,
82039
- dryTime: 900,
82040
- gloss: 0.9,
82041
- leavesMark: true,
82042
- drink: {
82043
- thirst: 0,
82044
- effects: [
82045
- "poison"
82046
- ]
82047
- },
82048
- tags: [
82049
- "corrosive"
82050
- ]
82051
- },
82052
- {
82053
- id: "paint",
82054
- color: 11740715,
82055
- opacity: 0.98,
82056
- stainColor: 9050655,
82057
- viscosity: 300,
82058
- density: 1300,
82059
- dryTime: 1800,
82060
- gloss: 0.6,
82061
- leavesMark: true,
82062
- drink: {
82063
- thirst: 0,
82064
- effects: [
82065
- "poison"
82066
- ]
82067
- },
82068
- tags: [
82069
- "paint"
82070
- ]
82071
- },
82072
- {
82073
- id: "bleach",
82074
- color: 15134688,
82075
- opacity: 0.7,
82076
- stainColor: 13621446,
82077
- viscosity: 1.2,
82078
- density: 1100,
82079
- dryTime: 900,
82080
- gloss: 0.85,
82081
- leavesMark: true,
82082
- drink: {
82083
- thirst: 0,
82084
- effects: [
82085
- "poison"
82086
- ]
82087
- },
82088
- tags: [
82089
- "corrosive"
82090
- ]
82091
- },
82092
- {
82093
- id: "sewage",
82094
- color: 5921582,
82095
- opacity: 0.92,
82096
- stainColor: 3093273,
82097
- viscosity: 4,
82098
- density: 1010,
82099
- dryTime: 1800,
82100
- gloss: 0.8,
82101
- leavesMark: true,
82102
- drink: {
82103
- thirst: 0,
82104
- effects: [
82105
- "disgust",
82106
- "poison"
82107
- ]
82108
- },
82109
- tags: [
82110
- "organic",
82111
- "waste"
82112
- ]
82113
- },
82114
- {
82115
- id: "honey",
82116
- color: 14193162,
82117
- opacity: 0.9,
82118
- stainColor: 12089350,
82119
- viscosity: 3e3,
82120
- density: 1420,
82121
- dryTime: 14400,
82122
- gloss: 0.95,
82123
- leavesMark: true,
82124
- drink: {
82125
- thirst: 10,
82126
- effects: []
82127
- },
82128
- tags: [
82129
- "drink",
82130
- "sticky"
82131
- ]
82132
- },
82133
- {
82134
- id: "mud",
82135
- color: 4008988,
82136
- opacity: 0.95,
82137
- stainColor: 3811866,
82138
- viscosity: 40,
82139
- density: 1600,
82140
- dryTime: 900,
82141
- gloss: 0.4,
82142
- tags: [
82143
- "dirty"
82144
- ]
82145
- },
82146
- {
82147
- id: "coolant",
82148
- color: 3455050,
82149
- opacity: 0.7,
82150
- stainColor: 2783796,
82151
- viscosity: 4,
82152
- density: 1070,
82153
- dryTime: 1200,
82154
- gloss: 0.85,
82155
- leavesMark: true,
82156
- drink: {
82157
- thirst: 0,
82158
- effects: [
82159
- "poison"
82160
- ]
82161
- },
82162
- tags: [
82163
- "coolant"
82164
- ]
82165
- },
82166
- {
82167
- id: "brake_fluid",
82168
- color: 13145646,
82169
- opacity: 0.8,
82170
- stainColor: 9069600,
82171
- viscosity: 8,
82172
- density: 1050,
82173
- dryTime: 3600,
82174
- gloss: 0.9,
82175
- leavesMark: true,
82176
- drink: {
82177
- thirst: 0,
82178
- effects: [
82179
- "poison"
82180
- ]
82181
- },
82182
- tags: [
82183
- "brake_fluid"
82184
- ]
82185
- }
82186
- ];
82187
- var LIQUIDS = liquids_default;
82188
- var SAMPLES = 16;
82189
- var COS = [];
82190
- var SIN = [];
82191
- for (let i = 0; i < SAMPLES; i++) {
82192
- COS.push(Math.cos(i / SAMPLES * Math.PI * 2));
82193
- SIN.push(Math.sin(i / SAMPLES * Math.PI * 2));
82194
- }
82195
- var RUNOFF_TILT = 6 * Math.PI / 180;
82196
- var RUNOFF_TILT_MAX = 60 * Math.PI / 180;
82197
- function hashCell(x, y) {
82198
- let value = x * 374761393 + y * 668265263 | 0;
82199
- value = (value ^ value >>> 13) * 1274126177 | 0;
82200
- return ((value ^ value >>> 16) >>> 0) / 4294967296;
82201
- }
82202
- function valueNoise(x, y) {
82203
- const xi = Math.floor(x);
82204
- const yi = Math.floor(y);
82205
- const xf = x - xi;
82206
- const yf = y - yi;
82207
- const u = xf * xf * (3 - 2 * xf);
82208
- const v = yf * yf * (3 - 2 * yf);
82209
- const a = hashCell(xi, yi);
82210
- const b = hashCell(xi + 1, yi);
82211
- const c = hashCell(xi, yi + 1);
82212
- const d = hashCell(xi + 1, yi + 1);
82213
- return a + (b - a) * u + (c - a) * v + (a - b - c + d) * u * v;
82214
- }
82215
- var REGION_NAMES = ["wall", "sidewalk", "curb", "road"];
82216
- var dot3 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
82217
- function impactOf(region, position, velocity2, cellSize) {
82218
- const local2 = [position[0] - region.origin[0], position[1] - region.origin[1], position[2] - region.origin[2]];
82219
- return {
82220
- row: region.firstRow + dot3(local2, region.rowAxis) / cellSize,
82221
- column: dot3(local2, region.columnAxis) / cellSize,
82222
- along: [dot3(velocity2, region.columnAxis), dot3(velocity2, region.rowAxis)],
82223
- normalSpeed: -dot3(velocity2, region.normal)
82224
- };
82225
- }
82226
- function cellToWorldOf(regions, cellSize, row, column) {
82227
- let region = regions[regions.length - 1];
82228
- for (const candidate of regions) {
82229
- if (row < candidate.firstRow + candidate.rowCount) {
82230
- region = candidate;
82231
- break;
82232
- }
82233
- }
82234
- const across2 = column * cellSize;
82235
- const down2 = (row - region.firstRow) * cellSize;
82236
- return [
82237
- region.origin[0] + region.columnAxis[0] * across2 + region.rowAxis[0] * down2,
82238
- region.origin[1] + region.columnAxis[1] * across2 + region.rowAxis[1] * down2,
82239
- region.origin[2] + region.columnAxis[2] * across2 + region.rowAxis[2] * down2
82240
- ];
82241
- }
82242
- function createFoldedLayout(params) {
82243
- const { columns, cellSize, originX, wallRows, sidewalkRows, curbRows, roadRows, wallTopY, sidewalkY, roadY, wallZ, rules } = params;
82244
- const curbStep = params.curbStep ?? (sidewalkY - roadY) / curbRows;
82245
- const height = wallRows + sidewalkRows + curbRows + roadRows;
82246
- const cellCount = columns * height;
82247
- const bed = new Float32Array(cellCount);
82248
- const pin = new Float32Array(cellCount);
82249
- const vertical = new Float32Array(cellCount);
82250
- const sidewalkEnd = wallRows + sidewalkRows;
82251
- const curbEnd = sidewalkEnd + curbRows;
82252
- const regionOfRow = (row) => row < wallRows ? 0 : row < sidewalkEnd ? 1 : row < curbEnd ? 2 : 3;
82253
- for (let row = 0; row < height; row++) {
82254
- for (let column = 0; column < columns; column++) {
82255
- const index = row * columns + column;
82256
- const region = regionOfRow(row);
82257
- const x = originX + (column + 0.5) * cellSize;
82258
- let bedHeight;
82259
- let roughness = 0.2;
82260
- if (region === 0) {
82261
- bedHeight = (wallTopY - (row + 0.5) * cellSize) * 1e3;
82262
- roughness = 0.3;
82263
- } else if (region === 1) {
82264
- const z = (row - wallRows + 0.5) * cellSize;
82265
- bedHeight = sidewalkY * 1e3 - z * 6;
82266
- const jointX = Math.abs(((x - originX) % 0.5 + 0.5) % 0.5 - 0.25);
82267
- const jointZ = Math.abs((z % 0.5 + 0.5) % 0.5 - 0.25);
82268
- if (jointX > 0.25 - cellSize * 0.6 || jointZ > 0.25 - cellSize * 0.6) bedHeight -= 0.9;
82269
- roughness = 0.18;
82270
- } else if (region === 2) {
82271
- bedHeight = sidewalkY * 1e3 - (row - sidewalkEnd + 0.5) * curbStep * 1e3;
82272
- } else {
82273
- const z = (row - curbEnd + 0.5) * cellSize;
82274
- bedHeight = roadY * 1e3 + z * 14 - (x - params.roadSlopeAnchorX) * 5;
82275
- roughness = 0.55;
82276
- }
82277
- const noise3 = valueNoise(column * 0.35, row * 0.35) * 0.6 + valueNoise(column * 1.3, row * 1.3) * 0.4;
82278
- bed[index] = bedHeight + (noise3 - 0.5) * roughness * 2;
82279
- vertical[index] = region === 0 || region === 2 ? 0.95 : 1;
82280
- 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);
82281
- }
82282
- }
82283
- const curbZ = wallZ + sidewalkRows * cellSize;
82284
- const roadEndZ = curbZ + roadRows * cellSize;
82285
- const right = [1, 0, 0];
82286
- const regions = [
82287
- { id: REGION_NAMES[0], firstRow: 0, rowCount: wallRows, origin: [originX, wallTopY, wallZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
82288
- { id: REGION_NAMES[1], firstRow: wallRows, rowCount: sidewalkRows, origin: [originX, sidewalkY, wallZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false },
82289
- { id: REGION_NAMES[2], firstRow: sidewalkEnd, rowCount: curbRows, origin: [originX, sidewalkY, curbZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
82290
- { id: REGION_NAMES[3], firstRow: curbEnd, rowCount: roadRows, origin: [originX, roadY, curbZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false }
82291
- ];
82292
- const maxX = originX + columns * cellSize;
82293
- return {
82294
- id: params.id,
82295
- width: columns,
82296
- height,
82297
- cellSize,
82298
- bed,
82299
- pin,
82300
- vertical,
82301
- regions,
82302
- rules,
82303
- cellToWorld: (row, column) => cellToWorldOf(regions, cellSize, row, column),
82304
- collide(previous, position) {
82305
- if (position[2] <= wallZ && position[1] > sidewalkY) {
82306
- position[2] = wallZ;
82307
- return 0;
82308
- }
82309
- if (position[2] < curbZ && (!rules.guardBehindWall || position[2] >= wallZ) && position[1] <= sidewalkY) {
82310
- position[1] = sidewalkY;
82311
- return 1;
82312
- }
82313
- if (rules.curbCatch && position[2] >= curbZ && previous[2] < curbZ && position[1] < sidewalkY) {
82314
- position[2] = curbZ;
82315
- return 2;
82316
- }
82317
- if (position[2] >= curbZ && position[1] <= roadY) {
82318
- position[1] = roadY;
82319
- return 3;
82320
- }
82321
- return -1;
82322
- },
82323
- impact: (region, position, velocity2) => impactOf(regions[region], position, velocity2, cellSize),
82324
- contains: (position) => position[0] > originX && position[0] < maxX && (!rules.clipRoadEnd || position[2] < roadEndZ),
82325
- escaped(position) {
82326
- if (position[1] < -1) return true;
82327
- const box5 = rules.escapeBox;
82328
- return box5 !== void 0 && (position[0] < box5.minX || position[0] > box5.maxX || position[2] > box5.maxZ);
82329
- }
82330
- };
82331
- }
82332
- var PADRAO_CELL = 0.0125;
82333
- var PADRAO_WALL_Z = 0;
82334
- var PADRAO_LAYOUT = createFoldedLayout({
82335
- id: "padrao",
82336
- columns: 256,
82337
- cellSize: PADRAO_CELL,
82338
- originX: -1.6,
82339
- wallRows: 144,
82340
- sidewalkRows: 128,
82341
- curbRows: 12,
82342
- roadRows: 112,
82343
- wallTopY: 1.95,
82344
- sidewalkY: 0.15,
82345
- roadY: 0,
82346
- wallZ: PADRAO_WALL_Z,
82347
- curbStep: PADRAO_CELL,
82348
- roadSlopeAnchorX: 0,
82349
- rules: {
82350
- dropCapacity: 600,
82351
- curbCatch: true,
82352
- guardBehindWall: true,
82353
- clipRoadEnd: true,
82354
- escapeBox: { minX: -3, maxX: 3, maxZ: PADRAO_WALL_Z + 128 * PADRAO_CELL + 112 * PADRAO_CELL + 1 },
82355
- dripStyle: "padrao"
82356
- }
82357
- });
82358
- var WORKSHOP_CELL = 0.0125;
82359
- var WORKSHOP_LAYOUT = createFoldedLayout({
82360
- id: "workshop",
82361
- columns: 160,
82362
- cellSize: WORKSHOP_CELL,
82363
- originX: -2.2,
82364
- wallRows: 160,
82365
- sidewalkRows: 128,
82366
- curbRows: 9,
82367
- roadRows: 151,
82368
- wallTopY: 2.12,
82369
- sidewalkY: 0.1235,
82370
- roadY: 9e-3,
82371
- wallZ: -4.497,
82372
- roadSlopeAnchorX: -1.2,
82373
- rules: { dropCapacity: 400, curbCatch: false, guardBehindWall: false, clipRoadEnd: false, dripStyle: "workshop" }
82374
- });
82375
-
82376
- // ../game-items-three/dist/chunk-S4UUQQOL.js
83011
+ // ../game-items-three/dist/chunk-64JEKMFT.js
82377
83012
  var destruction_default = {
82378
83013
  families: {
82379
83014
  drink_can: {
@@ -86841,13 +87476,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
86841
87476
  const hole = metal2(1842463);
86842
87477
  const corners = [[2.5, 1.8], [-2.5, 1.8], [2.5, -1.8], [-2.5, -1.8]];
86843
87478
  return G(
86844
- mesh3(bx(6, 0.02, 4.5), zinc, [0, -5e-3, 0]),
86845
- mesh3(bx(6, 0.01, 0.16), edge, [0, 0.01, 2.17]),
86846
- mesh3(bx(6, 0.01, 0.16), edge, [0, 0.01, -2.17]),
86847
- mesh3(bx(0.16, 0.01, 4.18), edge, [2.92, 0.01, 0]),
86848
- mesh3(bx(0.16, 0.01, 4.18), edge, [-2.92, 0.01, 0]),
86849
- mesh3(bx(1.2, 0.01, 0.8), metal2(8014380), [-0.8, 0.01, -0.4]),
86850
- ...corners.map(([x, z]) => mesh3(cyl(0.12, 0.12, 0.01, 8), hole, [x, 0.01, z]))
87479
+ mesh3(bx(5.68, 6e-3, 4.18), zinc, [0, 0, 0]),
87480
+ mesh3(bx(6, 0.03, 0.16), edge, [0, 0, 2.17]),
87481
+ mesh3(bx(6, 0.03, 0.16), edge, [0, 0, -2.17]),
87482
+ mesh3(bx(0.16, 0.03, 4.18), edge, [2.92, 0, 0]),
87483
+ mesh3(bx(0.16, 0.03, 4.18), edge, [-2.92, 0, 0]),
87484
+ mesh3(bx(1.2, 0.03, 0.8), metal2(8014380), [-0.8, 0, -0.4]),
87485
+ ...corners.map(([x, z]) => mesh3(cyl(0.12, 0.12, 0.03, 8), hole, [x, 0, z]))
86851
87486
  );
86852
87487
  };
86853
87488
  var cementBag = ({ mesh: mesh3, bx, G, paper: paper2, cloth: cloth2 }) => {
@@ -87715,7 +88350,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
87715
88350
  };
87716
88351
  var laptop = ({ mesh: mesh3, cyl, bx, G, metal: metal2, plastic }) => G(
87717
88352
  mesh3(bx(0.36, 0.012, 0.25), metal2(9277588), [0, 6e-3, 0]),
87718
- mesh3(bx(0.358, 0.012, 0.248), metal2(2895667), [0, 0.017, 0]),
88353
+ mesh3(bx(0.356, 0.012, 0.246), metal2(2895667), [0, 0.017, 0]),
88354
+ // the lid 2 mm inside the base's sides (CLAUDE.md §13)
87719
88355
  mesh3(cyl(6e-3, 6e-3, 0.2, 8), plastic(1842204), [0, 0.0125, -0.12], [0, 0, Math.PI / 2]),
87720
88356
  mesh3(bx(0.05, 42e-4, 0.03), metal2(11843514), [0, 0.0231, 0])
87721
88357
  );
@@ -89085,7 +89721,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
89085
89721
  // the blade of the KA-BAR and of the katana is the narrow end of the lying item, so the head is turned to +x; the katana is held with both hands on its long handle (the left 11 cm behind the right: 0.1122 of its 0.98 m); the brass knuckles lie with the ring row across the strike
89086
89722
  ["kabar", { flip: true }],
89087
89723
  ["katana", { flip: true, grips: { handle: -0.35, support: -0.4622 } }],
89088
- ["brass_knuckles", { turn: 1, roll: 1, grips: { handle: -0.35, handleAt: [-0.045, 0.03] } }]
89724
+ ["brass_knuckles", { turn: 1, roll: 1, grips: { handle: -0.35, handleAt: [-0.045, 0.03] } }],
89725
+ // a club is swung with both hands at the knob end as a batter holds it: the left hand below at the knob, the right just above it (a sledgehammer's right hand higher up the haft)
89726
+ ["baseball_bat", { grips: { handle: -0.3, support: -0.41 } }],
89727
+ ["nail_bat", { grips: { handle: -0.3, support: -0.41 } }],
89728
+ ["iron_pipe", { grips: { handle: -0.29, support: -0.41 } }],
89729
+ ["crowbar", { grips: { handle: -0.3, support: -0.42 } }],
89730
+ ["sledgehammer", { grips: { handle: -0.22, support: -0.42 } }]
89089
89731
  ];
89090
89732
  var hasThrowableModel = (def) => def.action?.kind === "throwable" && def.action.explosive !== void 0 && hasExplosiveModel(def.action.explosive);
89091
89733
  var buildThrowableModel = (THREE, def) => def.action?.kind === "throwable" && def.action.explosive !== void 0 ? buildExplosiveModel(THREE, def.action.explosive) : void 0;
@@ -89116,6 +89758,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
89116
89758
  var buildWeaponModel = (THREE, def, items) => defaultWeaponProps().buildModel(THREE, def, items);
89117
89759
 
89118
89760
  // src/box-fx.ts
89761
+ var TOOL_REACH = 0.47;
89119
89762
  var EJECTS_ON_SHOT = /* @__PURE__ */ new Set(["pistol", "smg", "carbine", "rifle", "sniper", "shotgun"]);
89120
89763
  var SPOUTS = /* @__PURE__ */ new Set(["firearm", "flame", "heat", "extinguisher"]);
89121
89764
  var DROPS_MAGAZINE = /* @__PURE__ */ new Set(["pistol", "smg", "carbine", "rifle", "sniper"]);
@@ -89146,8 +89789,27 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
89146
89789
  const applyMotion = (frame2) => {
89147
89790
  if (!motion) return;
89148
89791
  const at4 = sampleToolMotion(motion.clip, motion.elapsed / motion.duration);
89149
- hand.position.add(v.set(at4.offset[0], at4.offset[1], at4.offset[2]).applyQuaternion(frame2));
89792
+ const anchor = motion.clip.pivot === "grip" ? heldAnchor(heldHold()) : null;
89793
+ if (anchor) {
89794
+ hand.updateMatrixWorld(true);
89795
+ anchor.part.localToWorld(gripBefore.copy(anchor.offset));
89796
+ }
89150
89797
  hand.quaternion.multiply(q.setFromEuler(new THREE.Euler(at4.turn[0], at4.turn[1], at4.turn[2])));
89798
+ if (anchor) {
89799
+ hand.updateMatrixWorld(true);
89800
+ hand.position.add(gripBefore.sub(anchor.part.localToWorld(gripAfter.copy(anchor.offset))));
89801
+ }
89802
+ hand.position.add(v.set(at4.offset[0], at4.offset[1], at4.offset[2]).applyQuaternion(frame2));
89803
+ };
89804
+ const keepInReach = (shoulder) => {
89805
+ const anchor = heldAnchor(heldHold());
89806
+ if (!anchor) return;
89807
+ hand.updateMatrixWorld(true);
89808
+ const away = anchor.part.localToWorld(gripAfter.copy(anchor.offset)).sub(gripBefore.set(shoulder[0], shoulder[1], shoulder[2]));
89809
+ const distance4 = away.length();
89810
+ if (distance4 <= TOOL_REACH) return;
89811
+ hand.position.sub(away.multiplyScalar(1 - TOOL_REACH / distance4));
89812
+ hand.updateMatrixWorld(true);
89151
89813
  };
89152
89814
  let dip = 0;
89153
89815
  let reloading = false;
@@ -89165,8 +89827,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
89165
89827
  const q2 = new THREE.Quaternion();
89166
89828
  const pointForward = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI / 2);
89167
89829
  const frontOf = new THREE.Vector3();
89168
- const restBox = new THREE.Box3();
89830
+ const restBox2 = new THREE.Box3();
89169
89831
  const noMotion = new THREE.Vector3();
89832
+ const gripBefore = new THREE.Vector3();
89833
+ const gripAfter = new THREE.Vector3();
89170
89834
  let inLens = false;
89171
89835
  const setLens = (on) => {
89172
89836
  if (on !== inLens) options.viewmodelFov?.(on ? VIEW_HOLD.tool.fov : null);
@@ -89181,7 +89845,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
89181
89845
  def = arsenal.weapons.get(weapon2) ?? null;
89182
89846
  if (!def || BODY_ACTIONS.has(def.id)) return;
89183
89847
  model = buildWeaponModel(THREE, def, options.items);
89184
- restBox.setFromObject(model);
89848
+ restBox2.setFromObject(model);
89185
89849
  inLens = false;
89186
89850
  const length2 = new THREE.Box3().setFromObject(model).getSize(v).x;
89187
89851
  rear = new THREE.Box3().setFromObject(model).min.x;
@@ -89351,7 +90015,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
89351
90015
  setLens(true);
89352
90016
  const held = heldHold();
89353
90017
  const kind = isOneHand() && def?.action.kind === "firearm" ? "dual" : "tool";
89354
- placeInView({ THREE, hand, holder: model, camera: camera2, right: heldAnchor(held), box: restBox, kind, aim: 0, offset: noMotion, ...side === "L" ? { mirror: true } : {} });
90018
+ placeInView({ THREE, hand, holder: model, camera: camera2, right: heldAnchor(held), box: restBox2, kind, aim: 0, offset: noMotion, ...side === "L" ? { mirror: true } : {} });
89355
90019
  hand.position.add(v.set(0, -0.12 * dip, 0.05 * kick).applyQuaternion(camera2.quaternion));
89356
90020
  applyMotion(camera2.quaternion);
89357
90021
  hand.updateMatrixWorld(true);
@@ -89366,8 +90030,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
89366
90030
  hand.position.add(v.set(0, -0.12 * dip, 0.05 * kick).applyQuaternion(camera2.quaternion));
89367
90031
  q.setFromEuler(new THREE.Euler(0.14 * kick - 0.25 * dip, 0, 0.6 * dip));
89368
90032
  hand.quaternion.multiply(q);
89369
- const body = (options.bodyHold?.() ?? eyeFrame()).quaternion;
89370
- applyMotion(bodyFrame.set(body[0], body[1], body[2], body[3]));
90033
+ const body = options.bodyHold?.() ?? eyeFrame();
90034
+ applyMotion(bodyFrame.set(body.quaternion[0], body.quaternion[1], body.quaternion[2], body.quaternion[3]));
90035
+ if (motion) keepInReach(body.position);
89371
90036
  }
89372
90037
  stow(dt);
89373
90038
  for (const body of [...bodies]) {
@@ -97298,7 +97963,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
97298
97963
  return [carrier.origin[0] + turned[0], carrier.origin[1] + turned[1], carrier.origin[2] + turned[2]];
97299
97964
  }
97300
97965
  var CAPACITY3 = 400;
97301
- var IDENTITY2 = [0, 0, 0, 1];
97966
+ var IDENTITY3 = [0, 0, 0, 1];
97302
97967
  function multiply2(a, b) {
97303
97968
  const [ax, ay, az, aw] = a;
97304
97969
  const [bx, by, bz, bw] = b;
@@ -97314,7 +97979,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
97314
97979
  get count() {
97315
97980
  return this.particles.length;
97316
97981
  }
97317
- spawn(options, frame2 = IDENTITY2, carried) {
97982
+ spawn(options, frame2 = IDENTITY3, carried) {
97318
97983
  const velocity2 = options.v ?? [0, 0, 0];
97319
97984
  const world = options.wv ?? [0, 0, 0];
97320
97985
  const particle = {
@@ -98304,7 +98969,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
98304
98969
  }
98305
98970
  var DEGREES = 180 / Math.PI;
98306
98971
 
98307
- // ../game-vfx-three/dist/chunk-EE6XER4D.js
98972
+ // ../game-vfx-three/dist/chunk-ACY6ZQC5.js
98308
98973
  var GLOW_VERTEX = `attribute vec4 aP;attribute vec4 aC;varying vec2 vU;varying vec4 vC;
98309
98974
  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]);
98310
98975
  vec3 wp=aP.xyz+(R*position.x+Up*position.y)*aP.w;vU=position.xy;vC=aC;gl_Position=projectionMatrix*viewMatrix*vec4(wp,1.);}`;
@@ -99352,8 +100017,48 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
99352
100017
  }
99353
100018
  };
99354
100019
  }
99355
- var REST_LAYER = 2e-3;
99356
- var REST_LAYERS = 4;
100020
+ var REST_STEP = 15e-4;
100021
+ var REST_TRIES = 8;
100022
+ var SAME_NORMAL = 0.9995;
100023
+ var restBox = () => ({ c: new Float64Array(3), axes: new Float64Array(9), half: new Float64Array(3), ext: new Float64Array(3) });
100024
+ function boxOf3(piece2, out) {
100025
+ 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);
100026
+ const a = out.axes;
100027
+ a[0] = cy * cz;
100028
+ a[1] = sx * sy * cz + cx * sz;
100029
+ a[2] = sx * sz - cx * sy * cz;
100030
+ a[3] = -cy * sz;
100031
+ a[4] = cx * cz - sx * sy * sz;
100032
+ a[5] = cx * sy * sz + sx * cz;
100033
+ a[6] = sy;
100034
+ a[7] = -sx * cy;
100035
+ a[8] = cx * cy;
100036
+ out.half[0] = piece2.sx / 2;
100037
+ out.half[1] = piece2.sy / 2;
100038
+ out.half[2] = piece2.sz / 2;
100039
+ out.c[0] = piece2.x;
100040
+ out.c[1] = piece2.y;
100041
+ out.c[2] = piece2.z;
100042
+ 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];
100043
+ }
100044
+ function sharedPlane(a, b, push) {
100045
+ 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;
100046
+ for (let i = 0; i < 3; i++) for (let j = 0; j < 3; j++) {
100047
+ const ax = a.axes[3 * i], ay = a.axes[3 * i + 1], az = a.axes[3 * i + 2];
100048
+ const dot2 = ax * b.axes[3 * j] + ay * b.axes[3 * j + 1] + az * b.axes[3 * j + 2];
100049
+ if (Math.abs(dot2) < SAME_NORMAL) continue;
100050
+ const ca = ax * a.c[0] + ay * a.c[1] + az * a.c[2];
100051
+ const cb = ax * b.c[0] + ay * b.c[1] + az * b.c[2];
100052
+ for (let side = -1; side <= 1; side += 2) {
100053
+ if (Math.abs(ca + side * a.half[i] - (cb + side * b.half[j])) >= REST_STEP * 0.75) continue;
100054
+ push[0] = ax * side;
100055
+ push[1] = ay * side;
100056
+ push[2] = az * side;
100057
+ return true;
100058
+ }
100059
+ }
100060
+ return false;
100061
+ }
99357
100062
  function debrisLayer(THREE, pool) {
99358
100063
  const geometry = new THREE.BoxGeometry(1, 1, 1);
99359
100064
  const material = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.45, metalness: 0.25, flatShading: true });
@@ -99368,6 +100073,36 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
99368
100073
  const matrix = new THREE.Matrix4();
99369
100074
  const colour = new THREE.Color();
99370
100075
  const hidden = new THREE.Matrix4().makeScale(0, 0, 0);
100076
+ const offset = new Float64Array(DEBRIS_CAPACITY * 3);
100077
+ const settled = new Uint8Array(DEBRIS_CAPACITY);
100078
+ const boxes = Array.from({ length: DEBRIS_CAPACITY }, restBox);
100079
+ const push = new Float64Array(3);
100080
+ const settle = (index) => {
100081
+ const box5 = boxes[index];
100082
+ boxOf3(pool.pieces[index], box5);
100083
+ let dx = 0, dy = 0, dz = 0;
100084
+ for (let tries = 0; tries < REST_TRIES; tries++) {
100085
+ let clash = false;
100086
+ for (let other = 0; other < DEBRIS_CAPACITY && !clash; other++) {
100087
+ if (other === index || !settled[other]) continue;
100088
+ if (!sharedPlane(box5, boxes[other], push)) continue;
100089
+ clash = true;
100090
+ const up = Math.abs(push[1]) > 0.7;
100091
+ const ux = up ? 0 : push[0], uy = up ? 1 : push[1], uz = up ? 0 : push[2];
100092
+ dx += ux * REST_STEP;
100093
+ dy += uy * REST_STEP;
100094
+ dz += uz * REST_STEP;
100095
+ box5.c[0] = box5.c[0] + ux * REST_STEP;
100096
+ box5.c[1] = box5.c[1] + uy * REST_STEP;
100097
+ box5.c[2] = box5.c[2] + uz * REST_STEP;
100098
+ }
100099
+ if (!clash) break;
100100
+ }
100101
+ offset[3 * index] = dx;
100102
+ offset[3 * index + 1] = dy;
100103
+ offset[3 * index + 2] = dz;
100104
+ settled[index] = 1;
100105
+ };
99371
100106
  for (let index = 0; index < DEBRIS_CAPACITY; index++) mesh3.setMatrixAt(index, hidden);
99372
100107
  mesh3.setColorAt(0, colour.setHex(16777215));
99373
100108
  return {
@@ -99376,16 +100111,18 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
99376
100111
  let drawn = false;
99377
100112
  for (let index = 0; index < DEBRIS_CAPACITY; index++) {
99378
100113
  const piece2 = pool.pieces[index];
100114
+ if (!piece2.on || !piece2.rest) settled[index] = 0;
99379
100115
  if (!piece2.on) {
99380
100116
  mesh3.setMatrixAt(index, hidden);
99381
100117
  continue;
99382
100118
  }
100119
+ if (piece2.rest && !settled[index]) settle(index);
99383
100120
  drawn = true;
99384
100121
  const shrink = Math.min(1, piece2.life / FADE_SECONDS2);
99385
100122
  euler.set(piece2.rx, piece2.ry, piece2.rz);
99386
100123
  quaternion2.setFromEuler(euler);
99387
- const lift = piece2.rest ? index % REST_LAYERS * REST_LAYER : 0;
99388
- matrix.compose(position.set(piece2.x, piece2.y + lift, piece2.z), quaternion2, scale.set(piece2.sx * shrink, piece2.sy * shrink, piece2.sz * shrink));
100124
+ const off = piece2.rest ? 3 * index : -1;
100125
+ 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));
99389
100126
  mesh3.setMatrixAt(index, matrix);
99390
100127
  mesh3.setColorAt(index, colour.setHex(piece2.color));
99391
100128
  }
@@ -101107,7 +101844,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
101107
101844
  const modelBox = new THREE.Box3().setFromObject(model.root);
101108
101845
  const length2 = modelBox.getSize(new THREE.Vector3()).x;
101109
101846
  modelRear = modelBox.min.x;
101110
- restBox.copy(modelBox);
101847
+ restBox2.copy(modelBox);
101111
101848
  lens2 = null;
101112
101849
  lensLayer = -1;
101113
101850
  holder.add(model.root);
@@ -101177,7 +101914,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
101177
101914
  let reach2 = 0;
101178
101915
  let pull = 0;
101179
101916
  let lift = 0;
101180
- const restBox = new THREE.Box3();
101917
+ const restBox2 = new THREE.Box3();
101181
101918
  let lens2 = null;
101182
101919
  let lensLayer = -1;
101183
101920
  const lensPoint = new THREE.Vector3();
@@ -101276,7 +102013,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
101276
102013
  if (options.firstPerson?.()) {
101277
102014
  const kind = oneHand ? "dual" : session.model.parts.carry === "hip" ? "hip" : family === "pistol" || family === "revolver" ? "handgun" : family === "rocket" ? "launcher" : "long";
101278
102015
  const aim = oneHand || kind === "hip" ? 0 : options.aim?.() ?? 0;
101279
- placeInView({ THREE, hand, holder, camera: camera2, right: heldAnchor(held), box: restBox, kind, aim, offset: viewMotion(dt, aim), ...side === "L" ? { mirror: true } : {} });
102016
+ placeInView({ THREE, hand, holder, camera: camera2, right: heldAnchor(held), box: restBox2, kind, aim, offset: viewMotion(dt, aim), ...side === "L" ? { mirror: true } : {} });
101280
102017
  setLens(kind);
101281
102018
  lift = 0;
101282
102019
  pull = 0;