@adatechnology/game-weapons-three 0.20.0 → 0.21.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.
@@ -18344,9 +18344,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
18344
18344
  }
18345
18345
  return points;
18346
18346
  }
18347
- function extrudeOf(shapes, options = {}) {
18348
- if (Array.isArray(shapes) || !shapes || options.extrudePath !== void 0 || options.UVGenerator !== void 0) return null;
18349
- const shape = shapes;
18347
+ function extrudeOf(shapes2, options = {}) {
18348
+ if (Array.isArray(shapes2) || !shapes2 || options.extrudePath !== void 0 || options.UVGenerator !== void 0) return null;
18349
+ const shape = shapes2;
18350
18350
  const outer = linePoints(shape);
18351
18351
  if (!outer) return null;
18352
18352
  const holes = [];
@@ -18394,11 +18394,11 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
18394
18394
  return made(viaCache({ kind: "lathe", points: profile, ...defined({ segments, phiStart, phiLength }) }, () => lathe(profile, segments, phiStart, phiLength)));
18395
18395
  },
18396
18396
  TorusGeometry: (radius, tube2, radialSegments, tubularSegments, arc) => made(viaCache({ kind: "torus", ...defined({ radius, tube: tube2, radialSegments, tubularSegments, arc }) }, () => torus(radius, tube2, radialSegments, tubularSegments, arc))),
18397
- ExtrudeGeometry: (shapes, extrudeOptions) => {
18398
- const buffers = shapes === void 0 ? null : extrudeOf(shapes, extrudeOptions);
18399
- if (!buffers) return new THREE.ExtrudeGeometry(shapes, extrudeOptions);
18397
+ ExtrudeGeometry: (shapes2, extrudeOptions) => {
18398
+ const buffers = shapes2 === void 0 ? null : extrudeOf(shapes2, extrudeOptions);
18399
+ if (!buffers) return new THREE.ExtrudeGeometry(shapes2, extrudeOptions);
18400
18400
  const geometry = toGeometry(THREE, buffers);
18401
- geometry.parameters = { shapes, options: extrudeOptions ?? {} };
18401
+ geometry.parameters = { shapes: shapes2, options: extrudeOptions ?? {} };
18402
18402
  return geometry;
18403
18403
  }
18404
18404
  };
@@ -22861,6 +22861,60 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
22861
22861
  const stable = converged && cholesky3(ev.Jt, [0, 0, 0]) !== null;
22862
22862
  return { s, a, b, stable, yielded: ev.yielded, bearing: capSum > 0 ? weight / capSum : Infinity, edge: ev.edge, residual: [ev.r[0], ev.r[1], ev.r[2]] };
22863
22863
  };
22864
+ var GROUND_LOSS_DEFAULTS = {
22865
+ footingDepth: 0.5,
22866
+ spread: 1,
22867
+ voidDepth: 0.05,
22868
+ maxSettlement: 0.05,
22869
+ crackDistortion: 1 / 300,
22870
+ damageDistortion: 1 / 150,
22871
+ distortionDamage: 0.3,
22872
+ bridgeSpanDepth: 10,
22873
+ beamRebarRatio: 4e-3
22874
+ };
22875
+ var DISTORTION_BASE = 1;
22876
+ var FOOTPRINT_STEP = 0.1;
22877
+ var FOOTPRINT_MAX_SAMPLES = 40;
22878
+ var resolveGroundLoss = (options = {}) => ({
22879
+ ...GROUND_LOSS_DEFAULTS,
22880
+ ...Object.fromEntries(Object.entries(options).filter(([, value]) => value !== void 0))
22881
+ });
22882
+ var bowlDepth = (loss, r) => r >= loss.radius ? 0 : loss.depth * (1 - (r / loss.radius) ** 2);
22883
+ var undercutAt = (loss, r, embed, spread2) => {
22884
+ if (loss.depth <= embed || loss.radius <= 0) return 0;
22885
+ const reach = Math.min(r, loss.radius);
22886
+ const cut = (t) => bowlDepth(loss, t) - Math.max(0, r - t) / spread2 - embed;
22887
+ const steepest = loss.radius * loss.radius / (2 * loss.depth * spread2);
22888
+ return Math.max(0, cut(reach), cut(Math.min(reach, steepest)), cut(0));
22889
+ };
22890
+ var longestRun = (flags) => {
22891
+ let best = null;
22892
+ let start = -1;
22893
+ for (let i = 0; i <= flags.length; i++) {
22894
+ if (i < flags.length && flags[i]) {
22895
+ if (start < 0) start = i;
22896
+ continue;
22897
+ }
22898
+ if (start >= 0 && (!best || i - start > best.end - best.start)) best = { start, end: i };
22899
+ start = -1;
22900
+ }
22901
+ return best;
22902
+ };
22903
+ var distortionOf = (drops, step) => {
22904
+ const span = Math.max(1, Math.round(DISTORTION_BASE / step));
22905
+ let value = 0;
22906
+ let at4 = 0;
22907
+ for (let i = 0; i < drops.length; i++) {
22908
+ const j = Math.min(drops.length - 1, i + span);
22909
+ if (j === i) continue;
22910
+ const beta = Math.abs(drops[j] - drops[i]) / Math.max((j - i) * step, DISTORTION_BASE);
22911
+ if (beta > value) {
22912
+ value = beta;
22913
+ at4 = (i + j) / 2;
22914
+ }
22915
+ }
22916
+ return { value, at: at4 };
22917
+ };
22864
22918
  var wind_terrain_default = [
22865
22919
  { id: "I", zg: 250, b: { A: 1.1, B: 1.11, C: 1.12 }, p: { A: 0.06, B: 0.065, C: 0.07 }, z0: 5e-3 },
22866
22920
  { id: "II", zg: 300, b: { A: 1, B: 1, C: 1 }, p: { A: 0.085, B: 0.09, C: 0.1 }, z0: 0.05 },
@@ -24662,6 +24716,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24662
24716
  var EDGE_REACH = 1.5;
24663
24717
  var BAR_BOW = 0.08;
24664
24718
  var BULLET_JOINT_SPAN = 0.3;
24719
+ var SUBSIDE_MIN = 1e-3;
24720
+ var DISTORTION_GROWTH = 1.2;
24721
+ var MAX_SETTLEMENT_CRACKS = 4;
24722
+ var SETTLEMENT_CRACK_LENGTH = 0.3;
24723
+ var CRACKED_STIFFNESS = 0.4;
24665
24724
  var CUT_SLICE = 1;
24666
24725
  var cutFactorOf = (shape) => clamp2(Math.max(...shapeDims(shape)) / CUT_SLICE, 1, 50);
24667
24726
  var clamp2 = (v, a, b) => Math.max(a, Math.min(b, v));
@@ -24851,6 +24910,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24851
24910
  dirty: false,
24852
24911
  maxStress: 0,
24853
24912
  collapsed: new Set(carry?.collapsed ?? []),
24913
+ unanchored: new Set(carry?.unanchored ?? []),
24854
24914
  unsup: [],
24855
24915
  anyAnchor: false,
24856
24916
  order: ++orderCounter,
@@ -24946,6 +25006,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24946
25006
  o.byPart.get(r.b).push(j);
24947
25007
  o.st.joints.push(jst);
24948
25008
  }
25009
+ for (const id2 of o.unanchored) {
25010
+ const p = o.byId.get(id2);
25011
+ if (p) p.anchored = false;
25012
+ }
24949
25013
  for (const [jid, c] of carry?.joints ?? []) if (c.st.open && !o.jointMap.has(jid)) o.st.joints.push(c.st);
24950
25014
  updateBound(o);
24951
25015
  o.anyAnchor = o.parts.some((p) => p.anchored);
@@ -25685,6 +25749,196 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
25685
25749
  }
25686
25750
  }
25687
25751
  };
25752
+ const groundCfg = resolveGroundLoss(options.groundLoss);
25753
+ const pendingLosses = [];
25754
+ const bearersOf = (o) => {
25755
+ const terrain = /* @__PURE__ */ new Set();
25756
+ o.parts.forEach((p, i) => {
25757
+ if (isTerrain(p) && !isLost(p)) terrain.add(i);
25758
+ });
25759
+ const tops = [...terrain].map((i) => aabbOf(o.parts[i].spec.shape, o.parts[i].pos, o.parts[i].q).max[1]);
25760
+ const out = [];
25761
+ o.parts.forEach((p, i) => {
25762
+ if (terrain.has(i) || isLost(p) || o.collapsed.has(p.spec.id) || p.spec.structure?.pile) return;
25763
+ const ground = (o.byPart.get(p.spec.id) ?? []).filter((j) => !j.st.open && terrain.has(restsOn(o, j, i)));
25764
+ if (!p.anchored && ground.length === 0) return;
25765
+ const bottom = aabbOf(p.spec.shape, p.pos, p.q).min[1];
25766
+ const depth = Math.max(0, (tops.length ? Math.max(...tops) : bottom) - bottom);
25767
+ const footed = p.spec.structure?.role === "wall" || p.spec.structure?.role === "column";
25768
+ out.push({ p, i, ground, embed: footed ? Math.max(depth, groundCfg.footingDepth) : depth });
25769
+ });
25770
+ return out;
25771
+ };
25772
+ const nearLoss = (o, p, loss) => {
25773
+ const box5 = partWorldAabb(o, p);
25774
+ const dx = Math.max(box5.min[0] - loss.x, 0, loss.x - box5.max[0]);
25775
+ const dz = Math.max(box5.min[2] - loss.z, 0, loss.z - box5.max[2]);
25776
+ return Math.hypot(dx, dz) < loss.radius + loss.depth * groundCfg.spread;
25777
+ };
25778
+ const footprintOf = (o, b, loss) => {
25779
+ const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
25780
+ const long = box5.max[0] - box5.min[0] >= box5.max[2] - box5.min[2] ? 0 : 2;
25781
+ const across2 = long === 0 ? 2 : 0;
25782
+ const n = clamp2(Math.ceil((box5.max[long] - box5.min[long]) / FOOTPRINT_STEP), 1, FOOTPRINT_MAX_SAMPLES);
25783
+ const m = clamp2(Math.ceil((box5.max[across2] - box5.min[across2]) / FOOTPRINT_STEP), 1, FOOTPRINT_MAX_SAMPLES);
25784
+ const step = (box5.max[long] - box5.min[long]) / n;
25785
+ const slices = [];
25786
+ let voids = 0;
25787
+ let sum2 = 0;
25788
+ let worst = -1;
25789
+ let deepest = toWorld(o.st.position, o.st.rotation, [(box5.min[0] + box5.max[0]) / 2, box5.min[1], (box5.min[2] + box5.max[2]) / 2]);
25790
+ for (let k = 0; k < n; k++) {
25791
+ let open = 0;
25792
+ let drop = 0;
25793
+ for (let c = 0; c < m; c++) {
25794
+ const local2 = [0, box5.min[1], 0];
25795
+ local2[long] = box5.min[long] + (k + 0.5) * step;
25796
+ local2[across2] = box5.min[across2] + (c + 0.5) * (box5.max[across2] - box5.min[across2]) / m;
25797
+ const world2 = toWorld(o.st.position, o.st.rotation, local2);
25798
+ const cut = undercutAt(loss, Math.hypot(world2[0] - loss.x, world2[2] - loss.z), b.embed, groundCfg.spread);
25799
+ if (cut >= groundCfg.voidDepth) open++;
25800
+ drop += Math.min(cut, groundCfg.maxSettlement);
25801
+ if (cut > worst) {
25802
+ worst = cut;
25803
+ deepest = world2;
25804
+ }
25805
+ }
25806
+ voids += open;
25807
+ sum2 += drop;
25808
+ slices.push({ void: open * 2 > m, drop: drop / m });
25809
+ }
25810
+ return { long, step, slices, share: voids / (n * m), drop: sum2 / (n * m), deepest };
25811
+ };
25812
+ const bridgeOf = (b, fp, voids) => {
25813
+ const p = b.p;
25814
+ if (p.spec.shape.kind !== "box" || !p.mat.strength?.tensileMPa) return null;
25815
+ const g = bendGeometry(p.spec);
25816
+ if (g.gravity < 0) return null;
25817
+ const footing = p.spec.structure?.role === "foundation" && g.member && !isReinforced(p.spec);
25818
+ const spec = footing ? { ...p.spec, structure: { ...p.spec.structure, rebar: { ratio: groundCfg.beamRebarRatio } } } : p.spec;
25819
+ const section = { b: sectionWidth(g, g.gravity), h: g.dims[g.gravity] };
25820
+ const m = sectionMoments(p.mat, section, tensionSteel(spec, g.dims, section, flexure), flexure);
25821
+ const span = (voids.end - voids.start) * fp.step;
25822
+ const cantilever = voids.start === 0 || voids.end === fp.slices.length;
25823
+ const w = lineLoad(g, p.st.load ?? p.st.mass);
25824
+ const moment = (cantilever ? w * span * span / 2 : spanMoment(w, span)) * structureSafety;
25825
+ const whole2 = voids.start === 0 && voids.end === fp.slices.length;
25826
+ const holds3 = !whole2 && span <= groundCfg.bridgeSpanDepth * section.h && moment <= (p.st.cracked ? m.steel : m.ultimate);
25827
+ const cracks = moment > m.cracking;
25828
+ const EI = (p.mat.strength.elasticGPa ?? 0) * 1e9 * section.b * section.h ** 3 * (cracks || p.st.cracked ? CRACKED_STIFFNESS : 1) / 12;
25829
+ const sag = EI > 0 ? w * span ** 4 / (cantilever ? 8 * EI : 384 / 5 * EI) : groundCfg.maxSettlement;
25830
+ return { holds: holds3, cracks, cantilever, span, depth: section.h, sag };
25831
+ };
25832
+ const crackBridge = (o, b, fp, voids, bridge, src) => {
25833
+ if (b.p.st.cracked) return;
25834
+ b.p.st.cracked = true;
25835
+ const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
25836
+ const local2 = [(box5.min[0] + box5.max[0]) / 2, bridge.cantilever ? box5.max[1] : box5.min[1], (box5.min[2] + box5.max[2]) / 2];
25837
+ const edge = voids.start === 0 ? voids.end : voids.start;
25838
+ local2[fp.long] = box5.min[fp.long] + (bridge.cantilever ? edge : (voids.start + voids.end) / 2) * fp.step;
25839
+ addCrack(o, b.p, toWorld(o.st.position, o.st.rotation, local2), rotateVec(o.st.rotation, [0, bridge.cantilever ? 1 : -1, 0]), bridge.depth, src);
25840
+ };
25841
+ const distort = (o, q, beta, at4, src) => {
25842
+ const prior = q.rt.distortion ?? 0;
25843
+ if (beta < groundCfg.crackDistortion || beta <= prior * DISTORTION_GROWTH) return;
25844
+ q.rt.distortion = beta;
25845
+ const box5 = aabbOf(q.spec.shape, q.pos, q.q);
25846
+ const height = box5.max[1] - box5.min[1];
25847
+ const cracks = (d) => d < groundCfg.crackDistortion ? 0 : Math.min(MAX_SETTLEMENT_CRACKS, 1 + Math.floor(Math.log2(d / groundCfg.crackDistortion)));
25848
+ const count = Math.max(1, cracks(beta) - cracks(prior));
25849
+ const axis2 = [0, 0, 0];
25850
+ axis2[q.thin] = 1;
25851
+ const normal = rotateVec(quat.mul(o.st.rotation, q.q), axis2);
25852
+ const length2 = Math.min(height * 0.6, SETTLEMENT_CRACK_LENGTH * Math.sqrt(beta / groundCfg.crackDistortion));
25853
+ for (let c = 0; c < count; c++) {
25854
+ const local2 = [clamp2(at4[0], box5.min[0], box5.max[0]), box5.min[1] + height * (0.15 + 0.2 * c), clamp2(at4[2], box5.min[2], box5.max[2])];
25855
+ addCrack(o, q, toWorld(o.st.position, o.st.rotation, local2), normal, length2, src);
25856
+ }
25857
+ if (beta >= groundCfg.damageDistortion && prior < groundCfg.damageDistortion) {
25858
+ q.st.hp = Math.max(1, q.st.hp - q.st.maxHp * groundCfg.distortionDamage);
25859
+ markDamaged(q);
25860
+ }
25861
+ };
25862
+ const crackOver = (o, b, fp, src) => {
25863
+ const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
25864
+ const drops = fp.slices.map((slice) => slice.drop);
25865
+ for (const j of o.byPart.get(b.p.spec.id) ?? []) {
25866
+ if (j.st.open) continue;
25867
+ const qi = j.ia === b.i ? j.ib : j.ia;
25868
+ const q = o.parts[qi];
25869
+ if (isLost(q) || isTerrain(q) || o.collapsed.has(q.spec.id) || !isSlender(q.spec, q.mat)) continue;
25870
+ if (restsOn(o, j, qi) !== b.i) {
25871
+ distort(o, q, (b.p.st.subsidence ?? 0) / DISTORTION_BASE, j.pos, src);
25872
+ continue;
25873
+ }
25874
+ const over = aabbOf(q.spec.shape, q.pos, q.q);
25875
+ const k0 = clamp2(Math.floor((over.min[fp.long] - box5.min[fp.long]) / fp.step), 0, drops.length - 1);
25876
+ const k1 = clamp2(Math.ceil((over.max[fp.long] - box5.min[fp.long]) / fp.step), k0 + 1, drops.length);
25877
+ const { value, at: at4 } = distortionOf(drops.slice(k0, k1), fp.step);
25878
+ const point = [(over.min[0] + over.max[0]) / 2, over.min[1], (over.min[2] + over.max[2]) / 2];
25879
+ point[fp.long] = box5.min[fp.long] + (k0 + at4 + 0.5) * fp.step;
25880
+ distort(o, q, value, point, src);
25881
+ }
25882
+ };
25883
+ const loseGround = (o, b, opened) => {
25884
+ if (b.p.anchored) {
25885
+ b.p.anchored = false;
25886
+ o.unanchored.add(b.p.spec.id);
25887
+ }
25888
+ for (const j of b.ground) {
25889
+ if (j.st.open) continue;
25890
+ j.st.open = true;
25891
+ j.st.hp = 0;
25892
+ j.st.openedBy = "break";
25893
+ opened.push(j);
25894
+ }
25895
+ };
25896
+ const bearLoss = (o, b, fp, src) => {
25897
+ const voids = longestRun(fp.slices.map((slice) => slice.void));
25898
+ const bridge = voids ? bridgeOf(b, fp, voids) : null;
25899
+ if (voids && bridge && bridge.span >= bridge.depth) {
25900
+ if (!bridge.holds) return "unsupported";
25901
+ if (bridge.cracks) crackBridge(o, b, fp, voids, bridge, src);
25902
+ for (let k = voids.start; k < voids.end; k++) fp.slices[k].drop = Math.min(fp.slices[k].drop, bridge.sag);
25903
+ fp.drop = fp.slices.reduce((sum2, slice) => sum2 + slice.drop, 0) / fp.slices.length;
25904
+ return "bridged";
25905
+ }
25906
+ return fp.share <= 1 - 1 / soilCfg.safety ? "settled" : "unsupported";
25907
+ };
25908
+ const undermine = (o, loss) => {
25909
+ if (!o.hasStructure || !o.anyAnchor || o.st.soil?.status === "toppled") return;
25910
+ const src = loss.source ?? "ground";
25911
+ const opened = [];
25912
+ const settled = [];
25913
+ let lost = false;
25914
+ for (const b of bearersOf(o)) {
25915
+ if (!nearLoss(o, b.p, loss)) continue;
25916
+ const fp = footprintOf(o, b, loss);
25917
+ if (fp.share <= 0 && fp.drop < SUBSIDE_MIN) continue;
25918
+ const status = bearLoss(o, b, fp, src);
25919
+ const before = b.p.st.subsidence ?? 0;
25920
+ const drop = Math.max(before, fp.drop);
25921
+ if (status === "unsupported") {
25922
+ loseGround(o, b, opened);
25923
+ lost = true;
25924
+ } else settled.push({ b, fp });
25925
+ if (status === "settled" && drop - before < SUBSIDE_MIN) continue;
25926
+ b.p.st.subsidence = drop;
25927
+ emit2({ ...base(o, src), type: "subside", part: b.p.spec.id, drop, share: fp.share, point: fp.deepest, status });
25928
+ }
25929
+ for (const { b, fp } of settled) crackOver(o, b, fp, src);
25930
+ o.active = true;
25931
+ if (!lost) return;
25932
+ solveStructure(o);
25933
+ recomputeGroups(o);
25934
+ detachEvents(o, opened, "break", src);
25935
+ collapseCheck(o, src);
25936
+ };
25937
+ const applyGroundLosses = () => {
25938
+ for (let loss = pendingLosses.shift(); loss; loss = pendingLosses.shift()) {
25939
+ for (const o of [...objects.values()]) if (objects.get(o.id) === o) undermine(o, loss);
25940
+ }
25941
+ };
25688
25942
  const getObj = (id) => {
25689
25943
  const o = objects.get(id);
25690
25944
  if (!o) throw new Error(`unknown object "${id}"`);
@@ -27696,18 +27950,27 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27696
27950
  blastProbe.partsNear = 0;
27697
27951
  return withCollapses(run(() => blastWorld(point, energy, radius, source, blast)));
27698
27952
  },
27953
+ groundLoss(loss) {
27954
+ if (!(loss.radius > 0) || !(loss.depth > 0) || !Number.isFinite(loss.x) || !Number.isFinite(loss.z)) return;
27955
+ pendingLosses.push({ ...loss });
27956
+ },
27699
27957
  raycast(origin, direction, maxDistance = Infinity) {
27700
27958
  const r = raycastInternal(origin, direction, maxDistance, void 0, false, true);
27701
27959
  return r ? { object: r.object, part: r.part, point: r.point, normal: r.normal, distance: r.distance } : null;
27702
27960
  },
27703
27961
  sweepBox(box5, direction, distance4, options2 = {}) {
27704
27962
  const d = vec.normalize(direction);
27705
- const ignored = options2.ignore === void 0 ? void 0 : objects.get(options2.ignore);
27706
- const hosted = options2.ignore === void 0 || ignored ? void 0 : impls.get(options2.ignore);
27707
- const ignore = ignored ? new Set(ignored.parts.map((p) => `${ignored.id}\0${p.spec.id}`)) : hosted ? new Set(hosted.impl.describe().parts.map((p) => `${hosted.impl.id}\0${p.id}`)) : void 0;
27963
+ const ignoredIds = options2.ignore === void 0 ? [] : typeof options2.ignore === "string" ? [options2.ignore] : options2.ignore;
27964
+ const ignore = /* @__PURE__ */ new Set();
27965
+ for (const id of ignoredIds) {
27966
+ const ignored = objects.get(id);
27967
+ const hosted = ignored ? void 0 : impls.get(id);
27968
+ if (ignored) for (const p of ignored.parts) ignore.add(`${ignored.id}\0${p.spec.id}`);
27969
+ else if (hosted) for (const p of hosted.impl.describe().parts) ignore.add(`${hosted.impl.id}\0${p.id}`);
27970
+ }
27708
27971
  let best = null;
27709
27972
  for (const origin of sweepOrigins(box5, d, options2.spacing ?? 0.2)) {
27710
- const r = raycastInternal(origin, d, distance4 + SWEEP_BACK, ignore);
27973
+ const r = raycastInternal(origin, d, distance4 + SWEEP_BACK, ignore.size > 0 ? ignore : void 0);
27711
27974
  if (!r || best && r.distance >= best.distance) continue;
27712
27975
  best = { object: r.object, part: r.part, point: r.point, normal: r.normal, distance: Math.max(0, r.distance - SWEEP_BACK) };
27713
27976
  }
@@ -27898,6 +28161,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27898
28161
  if (!(dt > 0)) return [];
27899
28162
  return run(() => {
27900
28163
  time += dt;
28164
+ applyGroundLosses();
27901
28165
  const sources = [];
27902
28166
  for (const o of [...objects.values()]) if (o.active) stepObject(o, dt, sources);
27903
28167
  for (const o of [...objects.values()]) if (o.soil && objects.get(o.id) === o) stepSoil(o, dt);
@@ -27944,7 +28208,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27944
28208
  rng: rng2.state(),
27945
28209
  counter,
27946
28210
  objects: [...objects.values()].map((o) => {
27947
- const runtime = { parts: {}, joints: {}, collapsed: [...o.collapsed], ...o.soil?.sets.size ? { soil: Object.fromEntries(o.soil.sets) } : {}, ...o.wind ? { wind: [o.wind.dyn.x, o.wind.dyn.v, o.wind.dyn.y, o.wind.dyn.w, o.wind.dyn.peak] } : {} };
28211
+ const runtime = { parts: {}, joints: {}, collapsed: [...o.collapsed], ...o.unanchored.size ? { unanchored: [...o.unanchored] } : {}, ...o.soil?.sets.size ? { soil: Object.fromEntries(o.soil.sets) } : {}, ...o.wind ? { wind: [o.wind.dyn.x, o.wind.dyn.v, o.wind.dyn.y, o.wind.dyn.w, o.wind.dyn.peak] } : {} };
27948
28212
  for (const p of o.parts) runtime.parts[p.spec.id] = clone(p.rt);
27949
28213
  for (const j of o.joints) runtime.joints[j.spec.id] = j.step;
27950
28214
  return { id: o.id, spec: clone(o.spec), state: clone(o.st), runtime };
@@ -27966,6 +28230,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27966
28230
  ),
27967
28231
  joints: new Map(state.joints.map((st) => [st.id, { st, step: e.runtime?.joints[st.id] ?? 0 }])),
27968
28232
  collapsed: e.runtime?.collapsed,
28233
+ ...e.runtime?.unanchored ? { unanchored: e.runtime.unanchored } : {},
27969
28234
  ...e.runtime?.wind ? { wind: e.runtime.wind } : {}
27970
28235
  };
27971
28236
  let pos = state.position, rot = state.rotation;
@@ -41054,15 +41319,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41054
41319
  found: "commons: GP-25 grenade launcher"
41055
41320
  },
41056
41321
  ag36: {
41057
- title: "File:AG36.png",
41058
- page: "https://commons.wikimedia.org/wiki/File:AG36.png",
41059
- url: "https://upload.wikimedia.org/wikipedia/commons/a/a8/AG36.png?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail_unscaled",
41060
- width: 350,
41061
- height: 150,
41062
- author: "Pjedvaj",
41063
- license: "CC BY-SA 3.0",
41064
- licenseUrl: "https://creativecommons.org/licenses/by-sa/3.0",
41065
- found: "commons: AG36 grenade launcher"
41322
+ title: "File:HK G36 with AG36.jpg",
41323
+ page: "https://commons.wikimedia.org/wiki/File:HK_G36_with_AG36.jpg",
41324
+ url: "https://thumb.wikimedia.org/wikipedia/commons/thumb/8/8a/HK_G36_with_AG36.jpg/960px-HK_G36_with_AG36.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail",
41325
+ width: 1279,
41326
+ height: 344,
41327
+ author: "sonaz",
41328
+ license: "CC BY-SA 2.5",
41329
+ licenseUrl: "https://creativecommons.org/licenses/by-sa/2.5",
41330
+ found: "pinned"
41066
41331
  },
41067
41332
  flashbang: {
41068
41333
  title: "File:M-84-Flash-Bang-Grenade.jpg",
@@ -41249,7 +41514,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41249
41514
  taurus_g2c: "File:Taurus G2C 9mm Sn 1C014003 L DSC0277.jpg",
41250
41515
  taurus_pt100: "File:TaurusPT92.jpg",
41251
41516
  taurus_smt9: "File:Taurus SMT9 with IA2 crop.jpg",
41252
- sledgehammer: "File:C&O Railway Heritage Center - Sledgehammer.jpg"
41517
+ sledgehammer: "File:C&O Railway Heritage Center - Sledgehammer.jpg",
41518
+ ag36: "File:HK G36 with AG36.jpg"
41253
41519
  }
41254
41520
  };
41255
41521
 
@@ -46496,7 +46762,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
46496
46762
  };
46497
46763
  var showcaseTextOf = (locale) => TEXT[locale] ?? TEXT.en;
46498
46764
 
46499
- // ../game-audio/dist/chunk-JV5XXCQE.js
46765
+ // ../game-audio/dist/chunk-TXGRBRE6.js
46500
46766
  var SFX_TIERS = { light: 0, medium: 0.34, heavy: 0.67 };
46501
46767
  function splitTier(id) {
46502
46768
  const match = /^(.*)_(light|medium|heavy)$/.exec(id);
@@ -46545,14 +46811,48 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
46545
46811
  ...numbers.cutoffK === void 0 ? {} : { cutoffK: numbers.cutoffK },
46546
46812
  ...numbers.group ? { group: numbers.group } : {},
46547
46813
  ...numbers.priority === void 0 ? {} : { priority: numbers.priority },
46814
+ ...numbers.choke ? { choke: numbers.choke } : {},
46548
46815
  ...numbers.fallback ? { fallback: numbers.fallback } : {},
46549
46816
  sources: files.map((file) => `${file.file}: ${file.source} ${file.author} ${file.license}`)
46550
46817
  });
46551
46818
  }
46552
46819
  return { id: options.id, samples };
46553
46820
  }
46821
+ var sample_levels_default = {
46822
+ $comment: "How loud each family of recorded sound plays against a gunshot, in dB under the shot (the converter normalizes every file to about -1 dBFS, so without these numbers a spent case lands as loud as the rifle that ejected it). A rifle is 155-165 dB SPL at the muzzle and a brass case on concrete 60-75 dB SPL at a metre: a game cannot hold 80 dB between two sounds, so the case sits 32 dB under the shot and a dropped magazine 24 dB, which keeps both audible near and below the shot after the mix. choke = how many of the family ring at once, per sound id: a full-auto burst leaves a few cases ringing, not one per round.",
46823
+ casing: {
46824
+ gainDb: -32,
46825
+ pitch: 0.06,
46826
+ cutoffK: 0.03,
46827
+ priority: 1,
46828
+ falloff: { model: "inverse_square", k: 0.08, minGain: 3e-3 },
46829
+ choke: { voices: 3, fade: 0.05 }
46830
+ },
46831
+ magazine: {
46832
+ gainDb: -24,
46833
+ pitch: 0.06,
46834
+ cutoffK: 0.03,
46835
+ priority: 1,
46836
+ falloff: { model: "inverse_square", k: 0.08, minGain: 3e-3 },
46837
+ choke: { voices: 2, fade: 0.05 }
46838
+ }
46839
+ };
46840
+ var SAMPLE_LEVELS = sample_levels_default;
46841
+ var gainOf = (gainDb) => 10 ** (gainDb / 20);
46842
+ var defaultsOf = (entry2) => ({
46843
+ bus: "weapons",
46844
+ gain: gainOf(entry2.gainDb),
46845
+ pitch: entry2.pitch,
46846
+ falloff: entry2.falloff,
46847
+ cutoffK: entry2.cutoffK,
46848
+ priority: entry2.priority,
46849
+ choke: entry2.choke
46850
+ });
46851
+ var CASING_DEFAULTS = defaultsOf(SAMPLE_LEVELS.casing);
46852
+ var MAGAZINE_DROP_DEFAULTS = defaultsOf(SAMPLE_LEVELS.magazine);
46853
+ var droppedPartDefaults = (id) => id.startsWith("casing_drop_") ? CASING_DEFAULTS : id.startsWith("mag_drop_") ? MAGAZINE_DROP_DEFAULTS : void 0;
46554
46854
 
46555
- // ../game-audio/dist/chunk-S6WJVZGX.js
46855
+ // ../game-audio/dist/chunk-KGYMFUK7.js
46556
46856
  var DISTANCE_CURVES = {
46557
46857
  /** The game's `sfx`: `vol / (1 + d² × 0.004)`, cutoff `/ (1 + d × 0.01)`, silent below 0.01 (jogo L62091–62092, L62101). */
46558
46858
  game_sfx: { model: "inverse_square", k: 4e-3, cutoffK: 0.01, minGain: 0.01 },
@@ -47256,8 +47556,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
47256
47556
  const Constructor = scope2.AudioContext ?? scope2.webkitAudioContext;
47257
47557
  return Constructor ? new Constructor() : null;
47258
47558
  }
47559
+ function isLiveContext(context) {
47560
+ return typeof context.close === "function" && typeof context.resume === "function";
47561
+ }
47259
47562
  function unlockContext(context) {
47260
- if (context.state === "suspended" && typeof context.close === "function") void context.resume();
47563
+ if (context.state === "suspended" && isLiveContext(context)) void context.resume();
47261
47564
  }
47262
47565
  var TRANSMISSION_LOSS = {
47263
47566
  open: { lossDb: 0, thickness: 1 },
@@ -49145,7 +49448,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
49145
49448
  for (const loop of [...loops]) loop.stop();
49146
49449
  occluders?.clear();
49147
49450
  active.clear();
49148
- void context?.close();
49451
+ if (context && isLiveContext(context)) void context.close();
49149
49452
  context = null;
49150
49453
  chain = null;
49151
49454
  busNodes.clear();
@@ -52371,7 +52674,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52371
52674
  var LAUNCH_SAMPLE = { bus: "weapons", gain: 0.9, pitch: 0.04, falloff: { model: "inverse_square", k: 1e-3, minGain: 1e-3 }, cutoffK: 0.03, priority: 3 };
52372
52675
  var LAUNCH_IDS = /* @__PURE__ */ new Set(["launcher_40mm", "rocket_launch"]);
52373
52676
  var RELOAD_SAMPLE = { bus: "weapons", gain: 0.32, pitch: 0.05, falloff: { model: "inverse_square", k: 0.05, minGain: 2e-3 }, cutoffK: 0.02, priority: 2 };
52374
- var CASING_SAMPLE = { bus: "weapons", gain: 0.22, pitch: 0.06, falloff: { model: "inverse_square", k: 0.08, minGain: 3e-3 }, cutoffK: 0.03, priority: 1 };
52375
52677
  var casingSampleId = (sample) => sample.replace(/_(pistol|rifle|shell)$/, "");
52376
52678
  var RELOAD_SAMPLE_HITS = reload_sample_hits_default.hits;
52377
52679
  var WEIGHT_INTENSITY = { light: 0.1, medium: 0.5, heavy: 0.9 };
@@ -52379,7 +52681,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52379
52681
  var isGunshot = (id) => GUNSHOT_SAMPLE_IDS.includes(id);
52380
52682
  function weaponSampleDefaults(sound3, overrides = {}) {
52381
52683
  if (sound3.category !== "armas") return void 0;
52382
- const base = LAUNCH_IDS.has(sound3.id) ? LAUNCH_SAMPLE : sound3.id.startsWith("suppressed_") ? SUPPRESSED_SAMPLE : isGunshot(sound3.id) ? GUNSHOT_SAMPLE : sound3.id.startsWith("casing_drop_") || sound3.id.startsWith("mag_drop_") ? CASING_SAMPLE : RELOAD_SAMPLE;
52684
+ const base = LAUNCH_IDS.has(sound3.id) ? LAUNCH_SAMPLE : sound3.id.startsWith("suppressed_") ? SUPPRESSED_SAMPLE : isGunshot(sound3.id) ? GUNSHOT_SAMPLE : droppedPartDefaults(sound3.id) ?? RELOAD_SAMPLE;
52383
52685
  return { ...base, ...overrides[sound3.id] };
52384
52686
  }
52385
52687
  function weaponSampleBank(options) {
@@ -53710,7 +54012,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
53710
54012
  rules: { dropCapacity: 400, curbCatch: false, guardBehindWall: false, clipRoadEnd: false, dripStyle: "workshop" }
53711
54013
  });
53712
54014
 
53713
- // ../game-items-three/dist/chunk-76GT7V27.js
54015
+ // ../game-items-three/dist/chunk-V4L35AWB.js
53714
54016
  var destruction_default = {
53715
54017
  families: {
53716
54018
  drink_can: {
@@ -54224,11 +54526,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
54224
54526
  id: "crowbar",
54225
54527
  teamId: "pe_cabra",
54226
54528
  teamBox: [
54227
- 0.428,
54228
- 1.7087,
54229
- 0.11
54529
+ 0.3559,
54530
+ 1.6698,
54531
+ 0.068
54230
54532
  ],
54231
- scale: 0.43893
54533
+ scale: 0.449156
54232
54534
  },
54233
54535
  {
54234
54536
  id: "hammer",
@@ -56649,9 +56951,34 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
56649
56951
  return G(mesh3(cyl(0.34, 0.34, 0.38, 18), c, [0, 0, 0], [Math.PI / 2, 0, 0]), mesh3(cyl(0.1, 0.1, 0.4, 12), cloth2(9078135), [0, 0, 0], [Math.PI / 2, 0, 0]), mesh3(bx(0.36, 0.02, 0.36), c, [0.2, -0.33, 0.05], [0, 0, -0.25]), mesh3(bx(0.3, 0.02, 0.36), c, [0.5, -0.4, 0.05], [0, 0, -0.05]));
56650
56952
  };
56651
56953
  var amoxicillin = ({ T: T2, mesh: mesh3, bx, G, metal: metal2, plastic, paper: paper2 }) => G(mesh3(bx(0.8, 0.42, 0.24), paper2(15789798)), mesh3(bx(0.81, 0.1, 0.25), plastic(5141127), [0, 0.1, 0]), mesh3(bx(0.6, 0.04, 0.3), metal2(12172736), [0.15, -0.24, 0.25], [0, 0.3, 0]), ...[0, 1, 2, 3].map((k) => mesh3(new T2.SphereGeometry(0.05, 10, 8), plastic(14263361), [-0.05 + k * 0.14, -0.21, 0.3], [0, 0, 0], [1, 0.6, 1])));
56652
- var crowbar = ({ T: T2, mesh: mesh3, cyl, G, metal: metal2 }) => {
56653
- const c = new T2.CatmullRomCurve3([[0, -0.8, 0], [0, 0.45, 0], [0.02, 0.62, 0], [0.12, 0.72, 0], [0.26, 0.7, 0], [0.32, 0.6, 0]].map((p) => new T2.Vector3(...p)));
56654
- return G(mesh3(new T2.TubeGeometry(c, 30, 0.055, 8), metal2(10168863)), mesh3(cyl(0.02, 0.055, 0.14, 8), metal2(3816510), [0, -0.86, 0]));
56954
+ var CURVE = [[0, -0.8, 0], [0, 0.5, 0], [0.012, 0.625, 0], [0.06, 0.7, 0], [0.12, 0.715, 0], [0.19, 0.685, 0], [0.26, 0.63, 0]];
56955
+ var BAR_RADIUS = 0.026;
56956
+ var CHISEL = [[-0.024, -0.79], [0.024, -0.79], [0.016, -0.86], [4e-3, -0.928], [-8e-3, -0.928], [-0.022, -0.86]];
56957
+ var CHISEL_WIDTH = 0.06;
56958
+ var shapes = /* @__PURE__ */ new WeakMap();
56959
+ var shapesOf = (T2, extrude2) => {
56960
+ const cached = shapes.get(T2);
56961
+ if (cached) return cached;
56962
+ const curve = new T2.CatmullRomCurve3(CURVE.map((point) => new T2.Vector3(...point)));
56963
+ const bar2 = new T2.TubeGeometry(curve, 30, BAR_RADIUS, 6);
56964
+ const chisel = extrude2(CHISEL, CHISEL_WIDTH, 4e-3);
56965
+ chisel.translate(0, 0, -CHISEL_WIDTH / 2);
56966
+ markShared(bar2);
56967
+ markShared(chisel);
56968
+ const made = { bar: bar2, chisel };
56969
+ shapes.set(T2, made);
56970
+ return made;
56971
+ };
56972
+ var crowbar = ({ T: T2, mesh: mesh3, bx, extrude: extrude2, G, metal: metal2 }) => {
56973
+ const forged = metal2(7764863);
56974
+ const steel = metal2(9277844);
56975
+ const end3 = CURVE[CURVE.length - 1];
56976
+ const before = CURVE[CURVE.length - 2];
56977
+ const angle = Math.atan2(end3[1] - before[1], end3[0] - before[0]);
56978
+ const along = (distance4) => [end3[0] + Math.cos(angle) * distance4, end3[1] + Math.sin(angle) * distance4, 0];
56979
+ const prongs = [-1, 1].map((side) => mesh3(bx(0.1, 0.016, 0.022), steel, [...along(0.03)].map((value, index) => index === 2 ? side * 0.014 : value), [0, 0, angle]));
56980
+ const { bar: bar2, chisel } = shapesOf(T2, extrude2);
56981
+ return G(mesh3(bar2, forged), mesh3(chisel, steel), ...prongs);
56655
56982
  };
56656
56983
  var hammer = ({ T: T2, mesh: mesh3, cyl, bx, G, metal: metal2, wood, plastic }) => G(mesh3(cyl(0.05, 0.065, 1.1, 10), wood(9069628), [0, -0.15, 0]), mesh3(cyl(0.07, 0.07, 0.3, 10), plastic(2237727), [0, -0.6, 0]), mesh3(bx(0.28, 0.15, 0.15), metal2(5593437), [0.05, 0.45, 0]), mesh3(cyl(0.08, 0.08, 0.1, 12), metal2(5593437), [0.22, 0.45, 0], [0, 0, Math.PI / 2]), mesh3(new T2.ConeGeometry(0.06, 0.3, 6), metal2(5593437), [-0.22, 0.5, 0.035], [0, 0, 1.9]), mesh3(new T2.ConeGeometry(0.06, 0.3, 6), metal2(5593437), [-0.22, 0.5, -0.035], [0, 0, 1.9]));
56657
56984
  var machete = ({ mesh: mesh3, cyl, bx, extrude: extrude2, G, metal: metal2, wood }) => G(mesh3(extrude2([[0, 0], [1.25, 0.05], [1.4, 0.14], [1.3, 0.26], [0, 0.2]], 0.03), metal2(11120048), [-0.55, 0, 0]), mesh3(bx(0.45, 0.2, 0.1), wood(3877408), [-0.78, 0.1, 0.015]), ...[-0.9, -0.68].map((x) => mesh3(cyl(0.025, 0.025, 0.12, 8), metal2(12095802), [x, 0.1, 0.015], [Math.PI / 2, 0, 0])));
@@ -61388,36 +61715,93 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
61388
61715
  };
61389
61716
 
61390
61717
  // src/models/attachments/ugl.ts
61391
- var LAUNCHERS = {
61392
- m203: { tubeRadius: 0.0215, tubeFraction: 0.8, housing: [0.1, 0.05, 0.05], hasFrontGrip: false },
61393
- gp_25: { tubeRadius: 0.023, tubeFraction: 0.78, housing: [0.08, 0.055, 0.05], hasFrontGrip: false },
61394
- ag36: { tubeRadius: 0.02, tubeFraction: 0.8, housing: [0.13, 0.06, 0.05], hasFrontGrip: true }
61718
+ var PI15 = Math.PI;
61719
+ var clamp3 = (kit, fixed2, from, to) => {
61720
+ const { M, box: box5 } = kit;
61721
+ kit.roundness = 0.15;
61722
+ box5(fixed2, to - from, 0.022, 0.03, M.dark, (from + to) / 2, 9e-3, 0);
61723
+ kit.roundness = null;
61724
+ for (const x of [from + 0.02, to - 0.02]) box5(fixed2, 0.012, 6e-3, 0.036, M.metal, x, 0.016, 0);
61395
61725
  };
61396
- var drawFixed = (kit, group, look, length2) => {
61397
- const { M, box: box5, cylinderY } = kit;
61398
- const [housingLength, housingHeight, housingWidth] = look.housing;
61399
- box5(group, housingLength, housingHeight, housingWidth, M.dark, housingLength / 2 - 0.02, -look.tubeRadius, 0);
61400
- box5(group, 0.05, 4e-3, 0.012, M.metal, housingLength * 0.45, -look.tubeRadius - housingHeight / 2 - 4e-3, 0);
61401
- box5(group, 4e-3, 0.02, 8e-3, M.dark, housingLength * 0.6, -look.tubeRadius - housingHeight / 2 - 0.016, 0);
61402
- if (look.hasFrontGrip) {
61403
- cylinderY(group, 0.012, 0.07, M.poly, length2 * 0.55, -look.tubeRadius - 0.04, 0, 12);
61404
- box5(group, 0.04, 0.01, 0.03, M.dark, length2 * 0.55, -look.tubeRadius - 4e-3, 0);
61726
+ var pistolGrip = (kit, fixed2, top, length2) => {
61727
+ const { M, box: box5 } = kit;
61728
+ const grip = kit.pivot(fixed2, top[0], top[1], 0);
61729
+ grip.rotation.z = -0.3;
61730
+ kit.roundness = 0.3;
61731
+ box5(grip, 0.032, length2, 0.03, M.poly, -0.016, -length2 / 2, 0);
61732
+ kit.roundness = null;
61733
+ for (let i = 0; i < 3; i++) box5(grip, 6e-3, 0.012, 0.028, M.poly, 1e-3, -length2 * 0.25 - i * 0.02, 0);
61734
+ };
61735
+ var triggerGuard = (kit, fixed2, back, front, bottom) => {
61736
+ const { M, box: box5 } = kit;
61737
+ const drop = 0.03;
61738
+ box5(fixed2, front - back, 5e-3, 0.01, M.dark, (back + front) / 2, bottom - drop, 0);
61739
+ box5(fixed2, 5e-3, drop, 0.01, M.dark, front, bottom - drop / 2, 0);
61740
+ box5(fixed2, 5e-3, 0.02, 6e-3, M.metal, back + (front - back) * 0.45, bottom - 0.011, 0, 0.25);
61741
+ };
61742
+ var m203 = (kit, fixed2) => {
61743
+ const { M, box: box5 } = kit;
61744
+ const tube2 = { from: 0, to: 0.305, radius: 0.025, axisY: -0.03 };
61745
+ clamp3(kit, fixed2, -0.075, 0.29);
61746
+ kit.roundness = 0.18;
61747
+ box5(fixed2, 0.078, 0.056, 0.05, M.dark, -0.037, tube2.axisY + 2e-3, 0);
61748
+ kit.roundness = null;
61749
+ box5(fixed2, 0.02, 0.012, 0.052, M.metal, -0.07, tube2.axisY + 0.012, 0);
61750
+ triggerGuard(kit, fixed2, -0.07, -0.012, tube2.axisY - 0.026);
61751
+ return tube2;
61752
+ };
61753
+ var gp25 = (kit, fixed2) => {
61754
+ const { M, box: box5 } = kit;
61755
+ const tube2 = { from: 0.07, to: 0.275, radius: 0.024, axisY: -0.032 };
61756
+ clamp3(kit, fixed2, -0.04, 0.27);
61757
+ kit.roundness = 0.2;
61758
+ box5(fixed2, 0.125, 0.054, 0.046, M.metal, 0.012, tube2.axisY + 1e-3, 0);
61759
+ kit.roundness = null;
61760
+ box5(fixed2, 0.03, 0.026, 6e-3, M.dark, 0.03, tube2.axisY + 6e-3, -0.026);
61761
+ pistolGrip(kit, fixed2, [-0.012, tube2.axisY - 0.022], 0.1);
61762
+ box5(fixed2, 5e-3, 0.022, 6e-3, M.metal, 0.012, tube2.axisY - 0.034, 0, 0.3);
61763
+ box5(fixed2, 0.03, 4e-3, 8e-3, M.dark, 0.016, tube2.axisY - 0.046, 0);
61764
+ return tube2;
61765
+ };
61766
+ var ag36 = (kit, fixed2) => {
61767
+ const { M, box: box5 } = kit;
61768
+ const tube2 = { from: 0.04, to: 0.295, radius: 0.022, axisY: -0.066 };
61769
+ kit.roundness = 0.12;
61770
+ box5(fixed2, 0.315, 0.044, 0.05, M.poly, 0.13, -0.02, 0);
61771
+ box5(fixed2, 0.09, 0.03, 0.046, M.poly, 0.01, -0.054, 0);
61772
+ kit.roundness = null;
61773
+ clamp3(kit, fixed2, -0.02, 0.28);
61774
+ box5(fixed2, 0.24, 4e-3, 0.051, M.dark, 0.16, -0.03, 0);
61775
+ box5(fixed2, 0.04, 0.022, 5e-3, M.dark, 0.02, -8e-3, -0.028);
61776
+ pistolGrip(kit, fixed2, [-0.012, -0.069], 0.105);
61777
+ triggerGuard(kit, fixed2, 0, 0.06, -0.069);
61778
+ return tube2;
61779
+ };
61780
+ var LAUNCHERS = { m203, gp_25: gp25, ag36 };
61781
+ var drawTube = (kit, slide2, tube2, ribbed) => {
61782
+ const { M, box: box5, cylinderX } = kit;
61783
+ const length2 = tube2.to - tube2.from;
61784
+ cylinderX(slide2, tube2.radius, length2, M.metal, tube2.from + length2 / 2, tube2.axisY, 0, 24);
61785
+ if (ribbed) {
61786
+ cylinderX(slide2, tube2.radius * 1.1, length2 * 0.68, M.poly, tube2.from + length2 * 0.42, tube2.axisY, 0, 24);
61787
+ for (let i = 0; i < 9; i++) {
61788
+ for (const angle of [PI15 / 2, -PI15 / 2, PI15]) {
61789
+ box5(slide2, 4e-3, 0.022, 3e-3, M.dark, tube2.from + length2 * 0.14 + i * length2 * 0.065, tube2.axisY + Math.cos(angle) * tube2.radius * 1.1, Math.sin(angle) * tube2.radius * 1.1, 0, 0, angle - PI15 / 2);
61790
+ }
61791
+ }
61405
61792
  }
61793
+ cylinderX(slide2, tube2.radius * 1.08, 0.012, M.dark, tube2.to - 6e-3, tube2.axisY, 0, 24);
61794
+ cylinderX(slide2, tube2.radius * 0.8, 4e-3, M.hole, tube2.to + 5e-4, tube2.axisY, 0, 20);
61795
+ const muzzle2 = kit.mark(slide2, tube2.to + 0.01, tube2.axisY, 0);
61796
+ muzzle2.name = "ugl_muzzle";
61797
+ return muzzle2;
61406
61798
  };
61407
61799
  var buildUnderbarrelLauncher = ({ kit, attachment, slide: slide2 }) => {
61408
- const look = LAUNCHERS[attachment.model];
61409
- if (!look || !slide2) return null;
61410
- const { M, cylinderX } = kit;
61411
- const length2 = attachment.dims?.length ?? 0.35;
61800
+ const draw2 = LAUNCHERS[attachment.model];
61801
+ if (!draw2 || !slide2) return null;
61412
61802
  const fixed2 = kit.group();
61413
- drawFixed(kit, fixed2, look, length2);
61414
- const tubeLength = length2 * look.tubeFraction;
61415
- const start = -0.02;
61416
- cylinderX(slide2, look.tubeRadius, tubeLength, M.metal, start + tubeLength / 2, -look.tubeRadius, 0, 18);
61417
- cylinderX(slide2, look.tubeRadius * 1.12, 0.012, M.dark, start + tubeLength - 6e-3, -look.tubeRadius, 0, 18);
61418
- cylinderX(slide2, look.tubeRadius * 0.7, 4e-3, M.hole, start + tubeLength + 5e-4, -look.tubeRadius, 0, 14);
61419
- const muzzle2 = kit.mark(slide2, start + tubeLength + 0.01, -look.tubeRadius, 0);
61420
- muzzle2.name = "ugl_muzzle";
61803
+ const tube2 = draw2(kit, fixed2);
61804
+ const muzzle2 = drawTube(kit, slide2, tube2, attachment.model === "m203");
61421
61805
  return {
61422
61806
  object: fixed2,
61423
61807
  muzzle: muzzle2,
@@ -63574,7 +63958,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
63574
63958
  var floor = call("floor");
63575
63959
  var ceil = call("ceil");
63576
63960
  var round4 = call("round");
63577
- var clamp3 = call("clamp");
63961
+ var clamp4 = call("clamp");
63578
63962
  var lerp2 = call("lerp");
63579
63963
  var ease3 = call("ease");
63580
63964
  var lt = call("lt");
@@ -64590,7 +64974,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
64590
64974
  ],
64591
64975
  tick: [
64592
64976
  when(query("cylinder", "live"), [
64593
- set("jet", clamp3(sub(1, div(sub(TIME, PUNCTURE_AT), JET_SECONDS)), 0, 1)),
64977
+ set("jet", clamp4(sub(1, div(sub(TIME, PUNCTURE_AT), JET_SECONDS)), 0, 1)),
64594
64978
  behavior("cylinder", "step", { dt: DELTA, t: TIME }),
64595
64979
  when(not(isOxygen), [
64596
64980
  when(gt(jetStrength, 0), [
@@ -64965,7 +65349,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
64965
65349
  emit("drip", "normal", 12, { p: TANK, box: [0.05, 0, 0.05], sp: 0, life: 1, size: 0.03, c0: 5921402, a: 0.9, g: 9.8, fi: 0, gnd: 1 })
64966
65350
  ]),
64967
65351
  when(and(gt(TIME, 3.5), lt(TIME, BOOM_AT)), [
64968
- set("spread", clamp3(div(sub(TIME, 3.5), 2.5), 0, 1)),
65352
+ set("spread", clamp4(div(sub(TIME, 3.5), 2.5), 0, 1)),
64969
65353
  set("front", vlerp(POOL, TANK_FLOOR, mul(variable("spread"), 0.8))),
64970
65354
  call2("fire_emit", "vz", variable("front"), add(0.6, mul(variable("spread"), 0.4)), 1.1, { smoke: 14 }),
64971
65355
  call2("fire_emit", "vz2", POOL, 0.7, 0.8, { smoke: 6 }),
@@ -65141,7 +65525,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65141
65525
  tick: [
65142
65526
  set("nearest", 99),
65143
65527
  repeat(WALKERS2, set("nearest", min(variable("nearest"), vdist(walkerPoint, CAMERA_POSITION)))),
65144
- set("fear", clamp3(div(sub(NEAR, variable("nearest")), RANGE), 0, 1)),
65528
+ set("fear", clamp4(div(sub(NEAR, variable("nearest")), RANGE), 0, 1)),
65145
65529
  set("bpm", add(RESTING_BPM, mul(BPM_RISE, variable("fear")))),
65146
65530
  when(lt(mod(div(mul(TIME, variable("bpm")), 60), 1), div(mul(DELTA, variable("bpm")), 60)), [screen({ set: { beat: add(0.4, mul(0.6, variable("fear"))) } })]),
65147
65531
  post({ tunnel: add(0.1, mul(0.65, variable("fear"))), desat: mul(0.45, variable("fear")) }),
@@ -65340,7 +65724,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65340
65724
  timeline: [call2("chips", ORIGIN, UP11, 8, 0.9), call2("rust_at", ORIGIN, 6)]
65341
65725
  }
65342
65726
  ];
65343
- var PI15 = Math.PI;
65727
+ var PI16 = Math.PI;
65344
65728
  var SMOKE = { color: 9079430, width: 10, height: 8, gravity: -0.08, drag: 2.2, growth: 2.1 };
65345
65729
  var DEFAULT_SMOKE = { puffs: 2, radius: 0.01, opacity: 0.14, life: 0.7, drift: 0.2, rise: 0.06, growth: 2.1, flash: 1 };
65346
65730
  var DEFAULT_SPREAD = { drift: 0.1, rise: 0.04, side: 0.06 };
@@ -65421,11 +65805,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65421
65805
  ],
65422
65806
  timeline: [
65423
65807
  set("angles", []),
65424
- repeat(4, append("angles", add(div(mul(INDEX, PI15), 2), mul(rand(), 0.6)))),
65425
- set("roll", mul(rand(), PI15)),
65808
+ repeat(4, append("angles", add(div(mul(INDEX, PI16), 2), mul(rand(), 0.6)))),
65809
+ set("roll", mul(rand(), PI16)),
65426
65810
  when(gt(FLASH_SCALE, 0), [
65427
65811
  flash(ORIGIN2, 16756832, mul(4, SIZE, FLASH_SCALE), FLASH_SECONDS, mul(2, SIZE, FLASH_SCALE), true, true),
65428
- flashPiece("cone_open", mul(0.013, SIZE, FLASH_SCALE), mul(0.085, SIZE, FLASH_SCALE), 10, [mul(0.042, SIZE, FLASH_SCALE), 0, 0], [0, 0, -PI15 / 2], 16757575),
65812
+ flashPiece("cone_open", mul(0.013, SIZE, FLASH_SCALE), mul(0.085, SIZE, FLASH_SCALE), 10, [mul(0.042, SIZE, FLASH_SCALE), 0, 0], [0, 0, -PI16 / 2], 16757575),
65429
65813
  repeat(
65430
65814
  4,
65431
65815
  set("angle", pick2(variable("angles"), INDEX)),
@@ -65435,7 +65819,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65435
65819
  mul(0.04, SIZE, FLASH_SCALE),
65436
65820
  6,
65437
65821
  [mul(0.012, SIZE, FLASH_SCALE), mul(cos(variable("angle")), 0.016, SIZE, FLASH_SCALE), mul(sin(variable("angle")), 0.016, SIZE, FLASH_SCALE)],
65438
- [variable("angle"), 0, -PI15 / 2],
65822
+ [variable("angle"), 0, -PI16 / 2],
65439
65823
  16757575
65440
65824
  )
65441
65825
  ),
@@ -66795,12 +67179,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66795
67179
  return bands.scales[3];
66796
67180
  }
66797
67181
  var BLOOD_LIMIT = 450;
67182
+ var SCRAPE_LIMIT = 400;
66798
67183
  var SCORCH_VARIANTS = 3;
66799
67184
  var RIM_COLORS = [2829359, 3815478];
66800
67185
  function createMarkStore() {
66801
67186
  const entries2 = [];
66802
67187
  let version = 0;
66803
67188
  let bloodCount = 0;
67189
+ let scrapeCount = 0;
66804
67190
  const listeners = /* @__PURE__ */ new Set();
66805
67191
  return {
66806
67192
  entries: entries2,
@@ -66810,16 +67196,25 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66810
67196
  get bloodCount() {
66811
67197
  return bloodCount;
66812
67198
  },
67199
+ get scrapeCount() {
67200
+ return scrapeCount;
67201
+ },
66813
67202
  lift: 0,
66814
67203
  add(mark) {
67204
+ if (mark.kind === "scrape" && scrapeCount >= SCRAPE_LIMIT) {
67205
+ entries2.splice(entries2.findIndex((m) => m.kind === "scrape"), 1);
67206
+ scrapeCount--;
67207
+ }
66815
67208
  entries2.push(mark);
66816
67209
  if (mark.kind === "blood") bloodCount++;
67210
+ if (mark.kind === "scrape") scrapeCount++;
66817
67211
  version++;
66818
67212
  for (const listener of listeners) listener({ type: "add", mark });
66819
67213
  },
66820
67214
  clear() {
66821
67215
  entries2.length = 0;
66822
67216
  bloodCount = 0;
67217
+ scrapeCount = 0;
66823
67218
  this.lift = 0;
66824
67219
  version++;
66825
67220
  for (const listener of listeners) listener({ type: "clear" });
@@ -66879,6 +67274,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66879
67274
  const scaleZ = spec.radius * random.between(1.2, 2);
66880
67275
  store.add({ kind: "blood", x: spec.x, y, z: spec.z, scaleX, scaleZ, rotation: random.next() * 6 });
66881
67276
  }
67277
+ function addScrape(store, spec) {
67278
+ store.add({ kind: "scrape", ...spec, y: spec.y + 2e-3 + nextLift(store) * 2e-4 });
67279
+ }
66882
67280
  function createRingPool(capacity) {
66883
67281
  return new OrderedPool(capacity, () => ({ x: 0, z: 0, y0: 0, rise: 0, rk: 0, R0: 0, R1: 0, r: 0, roll: 0, t: 0, life: 0 }));
66884
67282
  }
@@ -67427,7 +67825,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67427
67825
  state.beat *= Math.exp(-DECAY.beat * dt);
67428
67826
  }
67429
67827
  var PAD_OF_SIZE2 = 0.35;
67430
- var clamp4 = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
67828
+ var clamp42 = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
67431
67829
  var lerp4 = (a, b, t) => a + (b - a) * t;
67432
67830
  function rgb(hex2) {
67433
67831
  return [(hex2 >> 16 & 255) / 255, (hex2 >> 8 & 255) / 255, (hex2 & 255) / 255];
@@ -67634,7 +68032,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67634
68032
  this.color[i3 + 2] = lerp4(this.rgbStart[i3 + 2], this.rgbEnd[i3 + 2], t);
67635
68033
  let envelope2 = t < def.fadeIn ? t / def.fadeIn : 1 - (t - def.fadeIn) / (1 - def.fadeIn);
67636
68034
  if (def.flicker) envelope2 *= 1 - def.flicker * (0.5 + 0.5 * Math.sin(age * 38 + this.seed[i] * 50));
67637
- this.alpha[i] = clamp4(envelope2, 0, 1) * def.alpha * this.alphaMul[i];
68035
+ this.alpha[i] = clamp42(envelope2, 0, 1) * def.alpha * this.alphaMul[i];
67638
68036
  top = i + 1;
67639
68037
  }
67640
68038
  this.high = top;
@@ -69177,6 +69575,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
69177
69575
  }),
69178
69576
  fires: () => core.fires.items,
69179
69577
  onMarks: (listener) => core.marks.subscribe(listener),
69578
+ scrape: (mark) => addScrape(core.marks, mark),
69180
69579
  time: () => core.clock.time,
69181
69580
  randomState: () => sharedRandom.state,
69182
69581
  clear() {
@@ -69199,7 +69598,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
69199
69598
  };
69200
69599
  }
69201
69600
 
69202
- // ../game-vfx-three/dist/chunk-IOGYK5RO.js
69601
+ // ../game-vfx-three/dist/chunk-PZ6IVOLZ.js
69203
69602
  var GLOW_VERTEX = `attribute vec4 aP;attribute vec4 aC;varying vec2 vU;varying vec4 vC;
69204
69603
  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]);
69205
69604
  vec3 wp=aP.xyz+(R*position.x+Up*position.y)*aP.w;vU=position.xy;vC=aC;gl_Position=projectionMatrix*viewMatrix*vec4(wp,1.);}`;
@@ -69427,7 +69826,7 @@ void main(){
69427
69826
  }
69428
69827
  };
69429
69828
  }
69430
- function createChunkLayer(THREE, pool, shapes, colorOf) {
69829
+ function createChunkLayer(THREE, pool, shapes2, colorOf) {
69431
69830
  const capacity = pool.capacity;
69432
69831
  const rockMaterial = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.85, flatShading: true });
69433
69832
  const plateMaterial = rockMaterial.clone();
@@ -69441,8 +69840,8 @@ void main(){
69441
69840
  mesh3.setColorAt(0, new THREE.Color(1, 1, 1));
69442
69841
  return mesh3;
69443
69842
  };
69444
- const rocks = make3(shapes.rock, rockMaterial);
69445
- const plates = make3(shapes.plate, plateMaterial);
69843
+ const rocks = make3(shapes2.rock, rockMaterial);
69844
+ const plates = make3(shapes2.plate, plateMaterial);
69446
69845
  const matrix = new THREE.Matrix4();
69447
69846
  const quaternion2 = new THREE.Quaternion();
69448
69847
  const euler = new THREE.Euler();
@@ -69679,6 +70078,9 @@ void main(){
69679
70078
  const bloodMaterial = new THREE.MeshStandardMaterial({ color: 6031882, roughness: 0.15, metalness: 0.1, polygonOffset: true, polygonOffsetFactor: -3, polygonOffsetUnits: -3 });
69680
70079
  const bloodGeometry = new THREE.CircleGeometry(0.5, 9).rotateX(-Math.PI / 2);
69681
70080
  owned.push(bloodMaterial, bloodGeometry);
70081
+ const scrapeMaterial = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.6, transparent: true, opacity: 0.55, depthWrite: false, polygonOffset: true, polygonOffsetFactor: -4, polygonOffsetUnits: -4 });
70082
+ const scrapeGeometry = new THREE.PlaneGeometry(1, 1).rotateX(-Math.PI / 2);
70083
+ owned.push(scrapeMaterial, scrapeGeometry);
69682
70084
  const maxGroundMarks = options.maxGroundMarks ?? DEFAULT_MAX_GROUND_MARKS;
69683
70085
  const instanced = {};
69684
70086
  function rockMaterial() {
@@ -69691,6 +70093,9 @@ void main(){
69691
70093
  function bloodMesh() {
69692
70094
  return instanced.blood ?? (instanced.blood = attach(createInstanced(bloodGeometry, bloodMaterial, options.maxBlood ?? DEFAULT_MAX_BLOOD)));
69693
70095
  }
70096
+ function scrapeMesh() {
70097
+ return instanced.scrape ?? (instanced.scrape = attach(createInstanced(scrapeGeometry, scrapeMaterial, SCRAPE_LIMIT)));
70098
+ }
69694
70099
  function rockMesh() {
69695
70100
  return instanced.rock ?? (instanced.rock = attach(createInstanced(options.rockGeometry, rockMaterial(), options.maxRocks ?? DEFAULT_MAX_ROCKS), true));
69696
70101
  }
@@ -69706,7 +70111,7 @@ void main(){
69706
70111
  const groundMarks = [];
69707
70112
  const spareGeometries = [];
69708
70113
  const blood = [];
69709
- const placed = { blood: 0, rock: 0, plate: 0 };
70114
+ const placed = { blood: 0, rock: 0, plate: 0, scrape: 0 };
69710
70115
  const matrix = new THREE.Matrix4();
69711
70116
  const position = new THREE.Vector3();
69712
70117
  const quaternion2 = new THREE.Quaternion();
@@ -69793,10 +70198,21 @@ void main(){
69793
70198
  writeBlood(index, drawn, BLOOD_START_GROWTH);
69794
70199
  bloodMesh().count = Math.min(placed.blood, bloodMesh().instanceMatrix.count);
69795
70200
  }
70201
+ function addScrape2(mark) {
70202
+ const mesh3 = scrapeMesh();
70203
+ const index = placed.scrape++ % mesh3.instanceMatrix.count;
70204
+ quaternion2.setFromAxisAngle(up, -mark.rotation);
70205
+ mesh3.setMatrixAt(index, matrix.compose(position.set(mark.x, mark.y, mark.z), quaternion2, scale.set(mark.length, 1, mark.width)));
70206
+ mesh3.setColorAt(index, color2.set(mark.color));
70207
+ mesh3.count = Math.min(placed.scrape, mesh3.instanceMatrix.count);
70208
+ mesh3.instanceMatrix.needsUpdate = true;
70209
+ mesh3.instanceColor.needsUpdate = true;
70210
+ }
69796
70211
  function build(mark) {
69797
70212
  if (mark.kind === "scorch") conform(mark, scorchMaterials[mark.variant]);
69798
70213
  else if (mark.kind === "dirt") conform(mark, dirtMaterial);
69799
70214
  else if (mark.kind === "rock") addRock(mark);
70215
+ else if (mark.kind === "scrape") addScrape2(mark);
69800
70216
  else addBlood(mark);
69801
70217
  }
69802
70218
  function clearMarks() {
@@ -69806,8 +70222,8 @@ void main(){
69806
70222
  for (const geometry of spareGeometries) geometry.dispose();
69807
70223
  spareGeometries.length = 0;
69808
70224
  blood.length = 0;
69809
- placed.blood = placed.rock = placed.plate = 0;
69810
- for (const mesh3 of [instanced.blood, instanced.rock, instanced.plate]) if (mesh3) mesh3.count = 0;
70225
+ placed.blood = placed.rock = placed.plate = placed.scrape = 0;
70226
+ for (const mesh3 of [instanced.blood, instanced.rock, instanced.plate, instanced.scrape]) if (mesh3) mesh3.count = 0;
69811
70227
  }
69812
70228
  return {
69813
70229
  group,
@@ -69819,6 +70235,7 @@ void main(){
69819
70235
  bloodMesh();
69820
70236
  rockMesh();
69821
70237
  plateMesh();
70238
+ scrapeMesh();
69822
70239
  },
69823
70240
  probes() {
69824
70241
  probeGeometry ?? (probeGeometry = new THREE.PlaneGeometry(1e-3, 1e-3).rotateX(-Math.PI / 2));
@@ -69837,10 +70254,10 @@ void main(){
69837
70254
  writeBlood(index, drawn, Math.max(BLOOD_START_GROWTH, 1 - Math.pow(1 - Math.min(1, drawn.age), 2.5)));
69838
70255
  }
69839
70256
  },
69840
- count: () => groundMarks.length + [instanced.blood, instanced.rock, instanced.plate].filter((mesh3) => mesh3 && mesh3.count > 0).length,
70257
+ count: () => groundMarks.length + [instanced.blood, instanced.rock, instanced.plate, instanced.scrape].filter((mesh3) => mesh3 && mesh3.count > 0).length,
69841
70258
  dispose() {
69842
70259
  clearMarks();
69843
- for (const mesh3 of [instanced.blood, instanced.rock, instanced.plate]) mesh3?.dispose();
70260
+ for (const mesh3 of [instanced.blood, instanced.rock, instanced.plate, instanced.scrape]) mesh3?.dispose();
69844
70261
  probeGeometry?.dispose();
69845
70262
  for (const item of owned) item.dispose();
69846
70263
  }
@@ -70715,7 +71132,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
70715
71132
  }
70716
71133
 
70717
71134
  // src/fx/heavy.ts
70718
- var PI16 = Math.PI;
71135
+ var PI17 = Math.PI;
70719
71136
  var ROCKET_LIGHT_NAME = "rocket-light";
70720
71137
  var ROCKET_LIGHT_COLOR = 16751168;
70721
71138
  var ROCKET_LIGHT_INTENSITY = 3;
@@ -70760,7 +71177,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
70760
71177
  rocket.position.copy(muzzle2);
70761
71178
  scene.add(rocket);
70762
71179
  const exhaust = new THREE.Mesh(new THREE.ConeGeometry(0.018, 0.12, 8, 1, true), new THREE.MeshBasicMaterial({ color: 16760896, transparent: true, opacity: 0.9, depthWrite: false }));
70763
- exhaust.rotation.z = PI16 / 2;
71180
+ exhaust.rotation.z = PI17 / 2;
70764
71181
  exhaust.position.x = -0.08;
70765
71182
  rocket.add(exhaust);
70766
71183
  const flame = context.lights?.acquire({ owner: "weapons.rocket", priority: LIGHT_PRIORITY.rocket, urgent: true, color: ROCKET_LIGHT_COLOR, intensity: ROCKET_LIGHT_INTENSITY, distance: ROCKET_LIGHT_DISTANCE, position: [muzzle2.x, muzzle2.y, muzzle2.z] });
@@ -70993,7 +71410,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
70993
71410
  };
70994
71411
 
70995
71412
  // src/fx/viewmodel-events.ts
70996
- var PI17 = Math.PI;
71413
+ var PI18 = Math.PI;
70997
71414
  var UGL_FLASH = 1.6;
70998
71415
  var restFlat = (object2) => {
70999
71416
  object2.rotation.x = 0;
@@ -71068,14 +71485,14 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
71068
71485
  root.updateWorldMatrix(true, true);
71069
71486
  const copy2 = parts.mag.clone(true);
71070
71487
  parts.mag.matrixWorld.decompose(copy2.position, copy2.quaternion, copy2.scale);
71071
- particles.spawn(copy2, toWorld2(session, vector2(up ? -0.25 : 0.05, up ? 0.9 : -0.3, 0.18)), { kind: "magazine", life: 25, radius: 0.014, bounce: 0.15, spin: vector2(1.5, 0.5, 2.5), onRest: (object2) => object2.rotation.set(0, object2.rotation.y, PI17 / 2) });
71488
+ particles.spawn(copy2, toWorld2(session, vector2(up ? -0.25 : 0.05, up ? 0.9 : -0.3, 0.18)), { kind: "magazine", life: 25, radius: 0.014, bounce: 0.15, spin: vector2(1.5, 0.5, 2.5), onRest: (object2) => object2.rotation.set(0, object2.rotation.y, PI18 / 2) });
71072
71489
  };
71073
71490
  const stuckCase = () => {
71074
71491
  if (!session.cartridge || !parts.eject) return;
71075
71492
  const casing2 = buildCasing(kit, session.cartridge.dims, session.cartridge.shape);
71076
71493
  const at4 = root.worldToLocal(offsetFrom(positionOf3(parts.eject), 0, casing2.length * 0.35, 0));
71077
71494
  casing2.group.position.copy(at4);
71078
- casing2.group.rotation.set(0, 0, PI17 / 2 - 0.25);
71495
+ casing2.group.rotation.set(0, 0, PI18 / 2 - 0.25);
71079
71496
  root.add(casing2.group);
71080
71497
  session.stuckCase = casing2.group;
71081
71498
  };
@@ -71640,7 +72057,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
71640
72057
  }
71641
72058
 
71642
72059
  // src/fx/viewmodel.ts
71643
- var PI18 = Math.PI;
72060
+ var PI19 = Math.PI;
71644
72061
  var HEAT_DISPLAY_MAX_FALLBACK = 750;
71645
72062
  var SMOKE_WISPS_PER_SECOND = 10;
71646
72063
  var SMOKE_THICKNESS_GAIN = 1.7;
@@ -71650,7 +72067,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
71650
72067
  var fittedOf2 = (parts) => parts.map((part) => ({ id: part.id, mount: part.mount, ...part.integral ? { integral: true } : {}, ...part.on === void 0 ? {} : { on: part.on } }));
71651
72068
  var collapsedStockPose = (move2) => {
71652
72069
  if (move2.kind === "retract") return { position: [move2.travel, 0, 0] };
71653
- return { rotation: [move2.axis === "x" ? PI18 : 0, move2.axis === "y" ? PI18 : 0, move2.axis === "z" ? PI18 : 0] };
72070
+ return { rotation: [move2.axis === "x" ? PI19 : 0, move2.axis === "y" ? PI19 : 0, move2.axis === "z" ? PI19 : 0] };
71654
72071
  };
71655
72072
  var underbarrelStep = (step, tool2) => tool2.underbarrelActive && step.type === "play" && (step.clip === "shot" || step.clip === "reload") ? { ...step, variant: "ugl" } : step;
71656
72073
  var caliberOf = (arsenal, def) => def.action.kind === "firearm" ? arsenal.calibers.get(def.action.caliber) : void 0;
@@ -71703,7 +72120,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
71703
72120
  const rocketLight = options.lights ? void 0 : createRocketLight(THREE);
71704
72121
  if (rocketLight) scene.add(rocketLight);
71705
72122
  const holder = new THREE.Group();
71706
- holder.quaternion.setFromAxisAngle(new THREE.Vector3(0, 1, 0), PI18 / 2);
72123
+ holder.quaternion.setFromAxisAngle(new THREE.Vector3(0, 1, 0), PI19 / 2);
71707
72124
  hand.add(holder);
71708
72125
  let tasks = [];
71709
72126
  let stockRig = null;
@@ -71916,7 +72333,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
71916
72333
  const liftToKeepInView = () => {
71917
72334
  const held = heldHold();
71918
72335
  if (!held || !session || !("fov" in camera2)) return 0;
71919
- const tanHalf = Math.tan((camera2.fov ?? 70) * PI18 / 360);
72336
+ const tanHalf = Math.tan((camera2.fov ?? 70) * PI19 / 360);
71920
72337
  eyeTurn.copy(camera2.quaternion).invert();
71921
72338
  const rest2 = targetsOf(THREE, held, session.model.root.getWorldQuaternion(rootQuaternion), 0);
71922
72339
  let needed = 0;