@adatechnology/game-test-room 0.35.1 → 0.35.2

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.
@@ -5697,7 +5697,8 @@ var GameTestRoom = (() => {
5697
5697
  if (partSphereMiss(lo, ld, p, maxDist)) continue;
5698
5698
  const r = rayPart(o, p, origin, d);
5699
5699
  if (!r || r.t0 < 0 || r.t0 > maxDist) continue;
5700
- if (p.st.opening && insideOpening(o, p, vec.madd(origin, d, r.t0))) continue;
5700
+ if (p.st.opening && insideOpening(o, p, objLocal(o, vec.madd(origin, d, r.t0)))) continue;
5701
+ if (p.spec.apertures && throughAperture(p, objLocal(o, vec.madd(origin, d, r.t0)))) continue;
5701
5702
  if (p.st.chipped && insideChip(p, objLocal(o, vec.madd(origin, d, r.t0)))) continue;
5702
5703
  if (!best || r.t0 < best.distance) best = { object: o.id, part: p.spec.id, point: vec.madd(origin, d, r.t0), normal: r.n, distance: r.t0, pathLen: r.t1 - r.t0 };
5703
5704
  }
@@ -5969,6 +5970,18 @@ var GameTestRoom = (() => {
5969
5970
  const lc = toLocal(p.pos, p.q, op.center);
5970
5971
  return Math.hypot(lp[u] - lc[u], lp[v] - lc[v]) <= op.radius;
5971
5972
  };
5973
+ const throughAperture = (p, objectPoint) => {
5974
+ const [u, v] = planeAxes(p.thin);
5975
+ const lp = toLocal(p.pos, p.q, objectPoint);
5976
+ return (p.spec.apertures ?? []).some((ap) => {
5977
+ const du = lp[u] - (ap.offset?.[0] ?? 0);
5978
+ const dv = lp[v] - (ap.offset?.[1] ?? 0);
5979
+ if (Math.abs(du) > ap.size[0] / 2 || Math.abs(dv) > ap.size[1] / 2) return false;
5980
+ if (!ap.bars || ap.bars.spacing <= 0) return true;
5981
+ const along4 = ap.bars.axis === 0 ? du + ap.size[0] / 2 : dv + ap.size[1] / 2;
5982
+ return Math.abs(along4 - Math.round(along4 / ap.bars.spacing) * ap.bars.spacing) > ap.bars.width / 2;
5983
+ });
5984
+ };
5972
5985
  const breachAreaOf = (p, damage, blast3) => damage / (p.mat.hpPerKg * p.mat.density) / Math.max(p.thickness, 5e-3) * (blast3 ? breachBlastFactor : 1);
5973
5986
  const localHolesOf = (p) => p.st.holes.map((h) => ({ point: toLocal(p.pos, p.q, h.point), normal: rotateVec(quat.conjugate(p.q), h.normal), diameter: h.diameter }));
5974
5987
  const unitsOf = (p) => p.spec.units ?? { size: [p.mat.fragmentSize?.[1] ?? 0.2, p.mat.fragmentSize?.[1] ?? 0.2, p.thickness], bond: "stack" };
@@ -7075,7 +7088,7 @@ var GameTestRoom = (() => {
7075
7088
  const path = Math.min(r.t1, L) - t0;
7076
7089
  if (path < shelter.minPath) continue;
7077
7090
  const mid = vec.madd(point, d, t0 + path / 2);
7078
- const opening = p.st.opening && insideOpening(o, p, mid);
7091
+ const opening = p.st.opening && insideOpening(o, p, objLocal(o, mid));
7079
7092
  if (opening && was & FLAG_OPEN) continue;
7080
7093
  if (p.st.stripped && was & FLAG_OPEN) continue;
7081
7094
  const resistance = p.mat.hpPerKg * p.mat.density * path * (p.mat.damageScale?.shelter ?? 1);
@@ -28692,7 +28705,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
28692
28705
  if ((kind === "dust" || kind === "chips") && def?.visual?.innerColor !== void 0) return { color: def.visual.innerColor };
28693
28706
  if (kind === "fibers" || kind === "leaves") {
28694
28707
  if (def?.visual?.innerColor !== void 0) return { color: def.visual.innerColor };
28695
- const c = pv ? this.visuals.baseColorHex(pv.meshes[0] ?? {}) : -1;
28708
+ const c = pv && pv.meshes[0] ? this.visuals.baseColorHex(pv.meshes[0]) : -1;
28696
28709
  return c >= 0 ? { color: c } : void 0;
28697
28710
  }
28698
28711
  if (kind === "dust" || kind === "chips") {