@adatechnology/game-weapons-three 0.20.1 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/weapon-references.json +11 -10
- package/dist/{chunk-FOW6RIBT.js → chunk-7WOQSHOL.js} +105 -48
- package/dist/chunk-7WOQSHOL.js.map +1 -0
- package/dist/index.global.js +1295 -134
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/testing.js +1 -1
- package/package.json +9 -9
- package/dist/chunk-FOW6RIBT.js.map +0 -1
package/dist/index.global.js
CHANGED
|
@@ -18344,9 +18344,9 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18344
18344
|
}
|
|
18345
18345
|
return points;
|
|
18346
18346
|
}
|
|
18347
|
-
function extrudeOf(
|
|
18348
|
-
if (Array.isArray(
|
|
18349
|
-
const shape =
|
|
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: (
|
|
18398
|
-
const buffers =
|
|
18399
|
-
if (!buffers) return new THREE.ExtrudeGeometry(
|
|
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
|
};
|
|
@@ -22354,21 +22354,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22354
22354
|
for (const row of rows.values()) for (const i of row) if (!held.has(i)) loose.push(i);
|
|
22355
22355
|
return loose;
|
|
22356
22356
|
};
|
|
22357
|
-
var
|
|
22357
|
+
var clumpUnits = (cells, thin, unit, cap) => {
|
|
22358
22358
|
if (cells.length <= cap) return [...cells];
|
|
22359
22359
|
const [u, v] = planeAxes(thin);
|
|
22360
|
-
let lo0 = Infinity, lo1 = Infinity
|
|
22360
|
+
let lo0 = Infinity, lo1 = Infinity;
|
|
22361
22361
|
for (const cell of cells) {
|
|
22362
22362
|
lo0 = Math.min(lo0, cell.center[u] - cell.size[u] / 2);
|
|
22363
|
-
hi0 = Math.max(hi0, cell.center[u] + cell.size[u] / 2);
|
|
22364
22363
|
lo1 = Math.min(lo1, cell.center[v] - cell.size[v] / 2);
|
|
22365
|
-
hi1 = Math.max(hi1, cell.center[v] + cell.size[v] / 2);
|
|
22366
22364
|
}
|
|
22367
|
-
let
|
|
22368
|
-
for (; ; ) {
|
|
22365
|
+
let along = 1, up = 1;
|
|
22366
|
+
for (let grow = 0; ; grow++) {
|
|
22369
22367
|
const bins = /* @__PURE__ */ new Map();
|
|
22370
22368
|
for (const cell of cells) {
|
|
22371
|
-
const key2 = `${Math.floor((cell.center[u] - lo0) /
|
|
22369
|
+
const key2 = `${Math.floor((cell.center[u] - lo0) / (along * unit[0]))}:${Math.floor((cell.center[v] - lo1) / (up * unit[1]))}`;
|
|
22372
22370
|
const bin = bins.get(key2) ?? { lo: [Infinity, Infinity, Infinity], hi: [-Infinity, -Infinity, -Infinity] };
|
|
22373
22371
|
for (let k = 0; k < 3; k++) {
|
|
22374
22372
|
bin.lo[k] = Math.min(bin.lo[k], cell.center[k] - cell.size[k] / 2);
|
|
@@ -22379,7 +22377,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22379
22377
|
if (bins.size <= cap) {
|
|
22380
22378
|
return [...bins.values()].map(({ lo, hi }) => ({ center: [(lo[0] + hi[0]) / 2, (lo[1] + hi[1]) / 2, (lo[2] + hi[2]) / 2], size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]] }));
|
|
22381
22379
|
}
|
|
22382
|
-
|
|
22380
|
+
if (grow % 2 === 0) up++;
|
|
22381
|
+
else along++;
|
|
22383
22382
|
}
|
|
22384
22383
|
};
|
|
22385
22384
|
var MAX_SPALLS = 64;
|
|
@@ -22448,6 +22447,39 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22448
22447
|
for (const x of spread(dims[u], COVER, spacing, MAX_BARS_PER_DIRECTION)) out.push(bar(v, dims[v] / 2 - 0.02, [[u, x], [thin, 0]]));
|
|
22449
22448
|
return out;
|
|
22450
22449
|
};
|
|
22450
|
+
var STIRRUP_SPACING = 0.15;
|
|
22451
|
+
var memberStirrups = (dims, spacing = STIRRUP_SPACING) => {
|
|
22452
|
+
if (!isMember(dims)) return [];
|
|
22453
|
+
const long = dims.indexOf(Math.max(...dims));
|
|
22454
|
+
const [u = 0, v = 0] = [0, 1, 2].filter((i) => i !== long);
|
|
22455
|
+
const hu = dims[u] / 2 - COVER, hv = dims[v] / 2 - COVER;
|
|
22456
|
+
const out = [];
|
|
22457
|
+
for (const s of spread(dims[long], 0.05, spacing, 200)) {
|
|
22458
|
+
const corner = (x, y) => {
|
|
22459
|
+
const c = [0, 0, 0];
|
|
22460
|
+
c[long] = s;
|
|
22461
|
+
c[u] = x;
|
|
22462
|
+
c[v] = y;
|
|
22463
|
+
return c;
|
|
22464
|
+
};
|
|
22465
|
+
out.push([corner(-hu, -hv), corner(hu, -hv)], [corner(hu, -hv), corner(hu, hv)], [corner(hu, hv), corner(-hu, hv)], [corner(-hu, hv), corner(-hu, -hv)]);
|
|
22466
|
+
}
|
|
22467
|
+
return out;
|
|
22468
|
+
};
|
|
22469
|
+
var clipBarsToVolume = (bars, center, size) => {
|
|
22470
|
+
const out = [];
|
|
22471
|
+
for (const [a, b] of bars) {
|
|
22472
|
+
const axis2 = [0, 1, 2].find((k) => a[k] !== b[k]) ?? 0;
|
|
22473
|
+
if ([0, 1, 2].some((k) => k !== axis2 && Math.abs(a[k] - center[k]) > size[k] / 2 + 1e-6)) continue;
|
|
22474
|
+
const lo = Math.max(Math.min(a[axis2], b[axis2]), center[axis2] - size[axis2] / 2), hi = Math.min(Math.max(a[axis2], b[axis2]), center[axis2] + size[axis2] / 2);
|
|
22475
|
+
if (hi - lo < 1e-6) continue;
|
|
22476
|
+
const p = [a[0], a[1], a[2]], q = [b[0], b[1], b[2]];
|
|
22477
|
+
p[axis2] = lo;
|
|
22478
|
+
q[axis2] = hi;
|
|
22479
|
+
out.push([p, q]);
|
|
22480
|
+
}
|
|
22481
|
+
return out;
|
|
22482
|
+
};
|
|
22451
22483
|
var clipBarsToBox = (bars, u, v, center, size) => {
|
|
22452
22484
|
const out = [];
|
|
22453
22485
|
for (const [a, b] of bars) {
|
|
@@ -22861,6 +22893,220 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22861
22893
|
const stable = converged && cholesky3(ev.Jt, [0, 0, 0]) !== null;
|
|
22862
22894
|
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
22895
|
};
|
|
22896
|
+
function voidRuns(flags, step) {
|
|
22897
|
+
const runs = [];
|
|
22898
|
+
let start = -1;
|
|
22899
|
+
for (let i = 0; i <= flags.length; i++) {
|
|
22900
|
+
if (i < flags.length && flags[i]) {
|
|
22901
|
+
if (start < 0) start = i;
|
|
22902
|
+
continue;
|
|
22903
|
+
}
|
|
22904
|
+
if (start >= 0) runs.push({ start: start * step, end: i * step });
|
|
22905
|
+
start = -1;
|
|
22906
|
+
}
|
|
22907
|
+
return runs;
|
|
22908
|
+
}
|
|
22909
|
+
var PILLAR_REACH = 0.15;
|
|
22910
|
+
var pillarNear = (pillars, at4) => pillars.some((p) => Math.abs(p - at4) <= PILLAR_REACH);
|
|
22911
|
+
function splitAtPillars(runs, pillars) {
|
|
22912
|
+
const out = [];
|
|
22913
|
+
for (const run of runs) {
|
|
22914
|
+
const inside2 = pillars.filter((p) => p > run.start + PILLAR_REACH && p < run.end - PILLAR_REACH).sort((a, b) => a - b);
|
|
22915
|
+
let from = run.start;
|
|
22916
|
+
for (const p of inside2) {
|
|
22917
|
+
out.push({ start: from, end: p });
|
|
22918
|
+
from = p;
|
|
22919
|
+
}
|
|
22920
|
+
out.push({ start: from, end: run.end });
|
|
22921
|
+
}
|
|
22922
|
+
return out;
|
|
22923
|
+
}
|
|
22924
|
+
function mergeRuns(runs, check2) {
|
|
22925
|
+
let list2 = [...runs];
|
|
22926
|
+
for (let changed = true; changed; ) {
|
|
22927
|
+
changed = false;
|
|
22928
|
+
for (let k = 0; k <= list2.length && !changed; k++) {
|
|
22929
|
+
const before = list2[k - 1];
|
|
22930
|
+
const after2 = list2[k];
|
|
22931
|
+
const from = before ? before.end : 0;
|
|
22932
|
+
const to = after2 ? after2.start : check2.length;
|
|
22933
|
+
const soil = to - from;
|
|
22934
|
+
if (soil <= 0 || !before && !after2) continue;
|
|
22935
|
+
if (check2.pillars.some((p) => p >= from - PILLAR_REACH && p <= to + PILLAR_REACH)) continue;
|
|
22936
|
+
if (!before && check2.continuous?.[0] || !after2 && check2.continuous?.[1]) continue;
|
|
22937
|
+
const reaction = (before ? (before.end - before.start) / 2 : 0) + (after2 ? (after2.end - after2.start) / 2 : 0);
|
|
22938
|
+
const narrow = soil < check2.depth;
|
|
22939
|
+
const weak = reaction > (check2.soilSafety - 1) * soil;
|
|
22940
|
+
if (!narrow && !weak) continue;
|
|
22941
|
+
const merged2 = { start: before ? before.start : 0, end: after2 ? after2.end : check2.length };
|
|
22942
|
+
list2 = [...list2.slice(0, Math.max(0, k - 1)), merged2, ...list2.slice(after2 ? k + 1 : k)];
|
|
22943
|
+
changed = true;
|
|
22944
|
+
}
|
|
22945
|
+
}
|
|
22946
|
+
return list2;
|
|
22947
|
+
}
|
|
22948
|
+
function judgeBeam(flags, step, check2) {
|
|
22949
|
+
const merged2 = mergeRuns(voidRuns(flags, step), check2);
|
|
22950
|
+
const runs = splitAtPillars(merged2, check2.pillars);
|
|
22951
|
+
const behind = (run, fromStart) => fromStart ? (merged2.find((m) => m.start >= run.end - 1e-9)?.start ?? check2.length) - run.end : run.start - ([...merged2].reverse().find((m) => m.end <= run.start + 1e-9)?.end ?? 0);
|
|
22952
|
+
const verdicts = [];
|
|
22953
|
+
let tips = false;
|
|
22954
|
+
for (const run of runs) {
|
|
22955
|
+
const span = run.end - run.start;
|
|
22956
|
+
const freeStart = run.start <= 1e-9 && !pillarNear(check2.pillars, 0) && !check2.continuous?.[0];
|
|
22957
|
+
const freeEnd = run.end >= check2.length - 1e-9 && !pillarNear(check2.pillars, check2.length) && !check2.continuous?.[1];
|
|
22958
|
+
if (freeStart && freeEnd) {
|
|
22959
|
+
verdicts.push({ ...run, kind: "cantilever", span, moment: Infinity, holds: false, cracks: true });
|
|
22960
|
+
tips = true;
|
|
22961
|
+
continue;
|
|
22962
|
+
}
|
|
22963
|
+
const cantilever = freeStart || freeEnd;
|
|
22964
|
+
const moment = (cantilever ? check2.load * span * span / 2 : check2.load * span * span / 8) * check2.loadFactor;
|
|
22965
|
+
const reach = cantilever ? check2.spanDepth * check2.depth / 2 : check2.spanDepth * check2.depth;
|
|
22966
|
+
const balanced = !cantilever || span <= behind(run, freeStart);
|
|
22967
|
+
const rooted = cantilever && pillarNear(check2.pillars, freeStart ? run.end : run.start);
|
|
22968
|
+
const held = cantilever && !!check2.continuous?.[freeStart ? 1 : 0];
|
|
22969
|
+
const holds3 = span <= reach && moment <= check2.resists && (balanced || rooted);
|
|
22970
|
+
verdicts.push({ ...run, kind: cantilever ? "cantilever" : "span", span, moment, holds: holds3, cracks: moment > check2.cracking });
|
|
22971
|
+
if (cantilever && !holds3 && !balanced && !rooted && !held) tips = true;
|
|
22972
|
+
}
|
|
22973
|
+
return { runs: verdicts, tips };
|
|
22974
|
+
}
|
|
22975
|
+
function judgePlate(check2) {
|
|
22976
|
+
const a = check2.across;
|
|
22977
|
+
const moment = (check2.load * a * a / 8 + check2.points.reduce((sum2, p) => sum2 + p.weight * a / 4, 0)) * check2.loadFactor;
|
|
22978
|
+
const d = Math.max(0.01, check2.effectiveDepth);
|
|
22979
|
+
const punched = check2.points.some((p) => p.weight * check2.loadFactor / (4 * (p.side + d) * d) > check2.punching);
|
|
22980
|
+
return { holds: moment <= check2.resists && !punched, cracks: moment > check2.cracking, moment, punched };
|
|
22981
|
+
}
|
|
22982
|
+
var cross2 = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
|
|
22983
|
+
function convexHull(points) {
|
|
22984
|
+
const sorted = [...points].sort((a, b) => a[0] - b[0] || a[1] - b[1]);
|
|
22985
|
+
if (sorted.length < 3) return sorted;
|
|
22986
|
+
const lower = [];
|
|
22987
|
+
for (const p of sorted) {
|
|
22988
|
+
while (lower.length >= 2 && cross2(lower[lower.length - 2], lower[lower.length - 1], p) <= 0) lower.pop();
|
|
22989
|
+
lower.push(p);
|
|
22990
|
+
}
|
|
22991
|
+
const upper = [];
|
|
22992
|
+
for (let i = sorted.length - 1; i >= 0; i--) {
|
|
22993
|
+
const p = sorted[i];
|
|
22994
|
+
while (upper.length >= 2 && cross2(upper[upper.length - 2], upper[upper.length - 1], p) <= 0) upper.pop();
|
|
22995
|
+
upper.push(p);
|
|
22996
|
+
}
|
|
22997
|
+
return [...lower.slice(0, -1), ...upper.slice(0, -1)];
|
|
22998
|
+
}
|
|
22999
|
+
function restsOver(point, contacts, margin) {
|
|
23000
|
+
const hull = convexHull(contacts);
|
|
23001
|
+
if (hull.length < 3) return false;
|
|
23002
|
+
for (let i = 0; i < hull.length; i++) {
|
|
23003
|
+
const a = hull[i];
|
|
23004
|
+
const b = hull[(i + 1) % hull.length];
|
|
23005
|
+
const length2 = Math.hypot(b[0] - a[0], b[1] - a[1]) || 1;
|
|
23006
|
+
if (cross2(a, b, point) / length2 < margin) return false;
|
|
23007
|
+
}
|
|
23008
|
+
return true;
|
|
23009
|
+
}
|
|
23010
|
+
var GROUND_LOSS_DEFAULTS = {
|
|
23011
|
+
footingDepth: 0.5,
|
|
23012
|
+
spread: 1,
|
|
23013
|
+
voidDepth: 0.05,
|
|
23014
|
+
maxSettlement: 0.05,
|
|
23015
|
+
crackDistortion: 1 / 300,
|
|
23016
|
+
damageDistortion: 1 / 150,
|
|
23017
|
+
bearingCrackDistortion: 1 / 500,
|
|
23018
|
+
bearingDamageDistortion: 1 / 300,
|
|
23019
|
+
distortionDamage: 0.3,
|
|
23020
|
+
bridgeSpanDepth: 10,
|
|
23021
|
+
beamRebarRatio: 4e-3
|
|
23022
|
+
};
|
|
23023
|
+
var DISTORTION_BASE = 1;
|
|
23024
|
+
var FOOTPRINT_STEP = 0.1;
|
|
23025
|
+
var FOOTPRINT_MAX_SAMPLES = 40;
|
|
23026
|
+
var resolveGroundLoss = (options = {}) => ({
|
|
23027
|
+
...GROUND_LOSS_DEFAULTS,
|
|
23028
|
+
...Object.fromEntries(Object.entries(options).filter(([, value]) => value !== void 0))
|
|
23029
|
+
});
|
|
23030
|
+
var bowlDepth = (loss, r) => r >= loss.radius ? 0 : loss.depth * (1 - (r / loss.radius) ** 2);
|
|
23031
|
+
var undercutAt = (loss, r, embed, spread2) => {
|
|
23032
|
+
if (loss.depth <= embed || loss.radius <= 0) return 0;
|
|
23033
|
+
const reach = Math.min(r, loss.radius);
|
|
23034
|
+
const cut = (t) => bowlDepth(loss, t) - Math.max(0, r - t) / spread2 - embed;
|
|
23035
|
+
const steepest = loss.radius * loss.radius / (2 * loss.depth * spread2);
|
|
23036
|
+
return Math.max(0, cut(reach), cut(Math.min(reach, steepest)), cut(0));
|
|
23037
|
+
};
|
|
23038
|
+
var relativeToChord = (drops) => {
|
|
23039
|
+
const n = drops.length;
|
|
23040
|
+
if (n < 2) return drops.map(() => 0);
|
|
23041
|
+
const first = drops[0];
|
|
23042
|
+
const last = drops[n - 1];
|
|
23043
|
+
return drops.map((v, k) => v - (first + (last - first) * k / (n - 1)));
|
|
23044
|
+
};
|
|
23045
|
+
var distortionOf = (drops, step) => {
|
|
23046
|
+
const span = Math.max(1, Math.round(DISTORTION_BASE / step));
|
|
23047
|
+
let value = 0;
|
|
23048
|
+
let at4 = 0;
|
|
23049
|
+
let down = 1;
|
|
23050
|
+
for (let i = 0; i < drops.length; i++) {
|
|
23051
|
+
const j = Math.min(drops.length - 1, i + span);
|
|
23052
|
+
if (j === i) continue;
|
|
23053
|
+
const change = drops[j] - drops[i];
|
|
23054
|
+
const beta = Math.abs(change) / Math.max((j - i) * step, DISTORTION_BASE);
|
|
23055
|
+
if (beta > value) {
|
|
23056
|
+
value = beta;
|
|
23057
|
+
at4 = (i + j) / 2;
|
|
23058
|
+
down = change >= 0 ? 1 : -1;
|
|
23059
|
+
}
|
|
23060
|
+
}
|
|
23061
|
+
return { value, at: at4, down };
|
|
23062
|
+
};
|
|
23063
|
+
var smoothProfile = (drops, step, window2) => {
|
|
23064
|
+
const half = Math.max(0, Math.round(window2 / step / 2));
|
|
23065
|
+
return drops.map((_, k) => {
|
|
23066
|
+
let sum2 = 0;
|
|
23067
|
+
let count = 0;
|
|
23068
|
+
for (let i = Math.max(0, k - half); i <= Math.min(drops.length - 1, k + half); i++) {
|
|
23069
|
+
sum2 += drops[i];
|
|
23070
|
+
count++;
|
|
23071
|
+
}
|
|
23072
|
+
return sum2 / count;
|
|
23073
|
+
});
|
|
23074
|
+
};
|
|
23075
|
+
var BEAM_SPREAD = 1;
|
|
23076
|
+
var SETTLEMENT_POINTS = 24;
|
|
23077
|
+
var settlementProfile = (drops, step) => {
|
|
23078
|
+
const n = drops.length;
|
|
23079
|
+
if (n === 0) return [0, 0];
|
|
23080
|
+
const length2 = n * step;
|
|
23081
|
+
const count = Math.max(2, Math.min(SETTLEMENT_POINTS, n + 1));
|
|
23082
|
+
const out = [];
|
|
23083
|
+
for (let k = 0; k < count; k++) {
|
|
23084
|
+
const at4 = clampNumber(k / (count - 1) * length2 / step - 0.5, 0, n - 1);
|
|
23085
|
+
const i = Math.floor(at4);
|
|
23086
|
+
const j = Math.min(n - 1, i + 1);
|
|
23087
|
+
out.push(drops[i] + (drops[j] - drops[i]) * (at4 - i));
|
|
23088
|
+
}
|
|
23089
|
+
return out;
|
|
23090
|
+
};
|
|
23091
|
+
var clampNumber = (v, a, b) => Math.max(a, Math.min(b, v));
|
|
23092
|
+
var settlementAt = (settlement, point) => {
|
|
23093
|
+
const d = [settlement.to[0] - settlement.from[0], settlement.to[1] - settlement.from[1], settlement.to[2] - settlement.from[2]];
|
|
23094
|
+
const length2 = d[0] * d[0] + d[1] * d[1] + d[2] * d[2];
|
|
23095
|
+
const t = length2 > 0 ? clampNumber(((point[0] - settlement.from[0]) * d[0] + (point[1] - settlement.from[1]) * d[1] + (point[2] - settlement.from[2]) * d[2]) / length2, 0, 1) : 0;
|
|
23096
|
+
const drops = settlement.drop;
|
|
23097
|
+
if (drops.length === 0) return 0;
|
|
23098
|
+
const at4 = t * (drops.length - 1);
|
|
23099
|
+
const i = Math.floor(at4);
|
|
23100
|
+
const j = Math.min(drops.length - 1, i + 1);
|
|
23101
|
+
return drops[i] + (drops[j] - drops[i]) * (at4 - i);
|
|
23102
|
+
};
|
|
23103
|
+
var mergeSettlement = (old, next) => {
|
|
23104
|
+
if (!old) return next;
|
|
23105
|
+
const same = old.from.every((v, k) => Math.abs(v - next.from[k]) < 1e-6) && old.to.every((v, k) => Math.abs(v - next.to[k]) < 1e-6);
|
|
23106
|
+
if (same && old.drop.length === next.drop.length) return { from: old.from, to: old.to, drop: old.drop.map((v, k) => Math.max(v, next.drop[k])) };
|
|
23107
|
+
const mean = (line) => line.drop.reduce((sum2, v) => sum2 + v, 0) / Math.max(1, line.drop.length);
|
|
23108
|
+
return mean(old) >= mean(next) ? old : next;
|
|
23109
|
+
};
|
|
22864
23110
|
var wind_terrain_default = [
|
|
22865
23111
|
{ 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
23112
|
{ id: "II", zg: 300, b: { A: 1, B: 1, C: 1 }, p: { A: 0.085, B: 0.09, C: 0.1 }, z0: 0.05 },
|
|
@@ -24656,12 +24902,34 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24656
24902
|
var SUPPORT_TOLERANCE = 0.05;
|
|
24657
24903
|
var UNIT_FRAGMENT_FACTOR = 4;
|
|
24658
24904
|
var BREACH_GRID_CAP = 4096;
|
|
24905
|
+
var MASONRY_CRUMBLE_SPEED = 0.6;
|
|
24906
|
+
var TILE_CLUMPS = 160;
|
|
24907
|
+
var PANEL_EDGE_PILLAR = 2;
|
|
24908
|
+
var PANEL_EDGE_BASE = 4;
|
|
24909
|
+
var PANEL_EDGE_BEAM = 3;
|
|
24910
|
+
var PLASTER_FLAKE_AREA = 0.25;
|
|
24911
|
+
var MAX_PLASTER_FLAKES = 24;
|
|
24659
24912
|
var CHIP_ENERGY = 200;
|
|
24660
24913
|
var CHIP_SPLASH = 0.5;
|
|
24661
24914
|
var CRATER_SPENT = 0.6;
|
|
24662
24915
|
var EDGE_REACH = 1.5;
|
|
24663
24916
|
var BAR_BOW = 0.08;
|
|
24664
24917
|
var BULLET_JOINT_SPAN = 0.3;
|
|
24918
|
+
var SUBSIDE_MIN = 1e-3;
|
|
24919
|
+
var DISTORTION_GROWTH = 1.2;
|
|
24920
|
+
var MAX_SETTLEMENT_CRACKS = 4;
|
|
24921
|
+
var SETTLEMENT_CRACK_LENGTH = 0.3;
|
|
24922
|
+
var SETTLEMENT_CRACK_SPACING = 0.4;
|
|
24923
|
+
var SETTLEMENT_CRACK_OPENING = 0.3;
|
|
24924
|
+
var MIN_CRACK_WIDTH = 5e-4;
|
|
24925
|
+
var MAX_CRACK_WIDTH = 0.02;
|
|
24926
|
+
var BESIDE_CRACK_OFFSET = 0.8;
|
|
24927
|
+
var BRICK_STEP = [0.2, 0.1];
|
|
24928
|
+
var SETTLEMENT_FOLLOW_DEPTH = 2;
|
|
24929
|
+
var CRACKED_STIFFNESS = 0.4;
|
|
24930
|
+
var PILLAR_SEAT = 0.05;
|
|
24931
|
+
var PUNCHING_SHARE = 0.5;
|
|
24932
|
+
var ARCH_ANGLE = Math.PI / 3;
|
|
24665
24933
|
var CUT_SLICE = 1;
|
|
24666
24934
|
var cutFactorOf = (shape) => clamp2(Math.max(...shapeDims(shape)) / CUT_SLICE, 1, 50);
|
|
24667
24935
|
var clamp2 = (v, a, b) => Math.max(a, Math.min(b, v));
|
|
@@ -24737,6 +25005,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24737
25005
|
for (const m of options.materials ?? []) materials.set(m.id, m);
|
|
24738
25006
|
const ambient = options.ambientC ?? 20;
|
|
24739
25007
|
const maxFragments = options.maxFragments ?? 24;
|
|
25008
|
+
const unitClumps = maxFragments * UNIT_FRAGMENT_FACTOR;
|
|
25009
|
+
const fallenClumps = Math.max(2, Math.round(unitClumps / 4));
|
|
24740
25010
|
const maxDents = options.maxDents ?? 24;
|
|
24741
25011
|
const maxHoles = options.maxHoles ?? 32;
|
|
24742
25012
|
const fireSpread = options.fireSpread ?? 0.6;
|
|
@@ -24851,6 +25121,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24851
25121
|
dirty: false,
|
|
24852
25122
|
maxStress: 0,
|
|
24853
25123
|
collapsed: new Set(carry?.collapsed ?? []),
|
|
25124
|
+
unanchored: new Set(carry?.unanchored ?? []),
|
|
24854
25125
|
unsup: [],
|
|
24855
25126
|
anyAnchor: false,
|
|
24856
25127
|
order: ++orderCounter,
|
|
@@ -24946,6 +25217,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24946
25217
|
o.byPart.get(r.b).push(j);
|
|
24947
25218
|
o.st.joints.push(jst);
|
|
24948
25219
|
}
|
|
25220
|
+
for (const id2 of o.unanchored) {
|
|
25221
|
+
const p = o.byId.get(id2);
|
|
25222
|
+
if (p) p.anchored = false;
|
|
25223
|
+
}
|
|
24949
25224
|
for (const [jid, c] of carry?.joints ?? []) if (c.st.open && !o.jointMap.has(jid)) o.st.joints.push(c.st);
|
|
24950
25225
|
updateBound(o);
|
|
24951
25226
|
o.anyAnchor = o.parts.some((p) => p.anchored);
|
|
@@ -25042,6 +25317,61 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25042
25317
|
return (above2 + p.st.mass * share) / load;
|
|
25043
25318
|
};
|
|
25044
25319
|
};
|
|
25320
|
+
const contactsOf = (p, support) => {
|
|
25321
|
+
const box5 = contactBox(p, support);
|
|
25322
|
+
const broken = support.rt.broken;
|
|
25323
|
+
if (!broken?.length) return [box5];
|
|
25324
|
+
let pieces = [box5];
|
|
25325
|
+
for (const [axis2, from, to] of broken) {
|
|
25326
|
+
const a = [p.pos[0], p.pos[1], p.pos[2]];
|
|
25327
|
+
const b = [p.pos[0], p.pos[1], p.pos[2]];
|
|
25328
|
+
a[axis2] = from;
|
|
25329
|
+
b[axis2] = to;
|
|
25330
|
+
const la = toLocal(p.pos, p.q, a);
|
|
25331
|
+
const lb = toLocal(p.pos, p.q, b);
|
|
25332
|
+
const k = [0, 1, 2].reduce((best, c) => Math.abs(lb[c] - la[c]) > Math.abs(lb[best] - la[best]) ? c : best, 0);
|
|
25333
|
+
const lo = Math.min(la[k], lb[k]);
|
|
25334
|
+
const hi = Math.max(la[k], lb[k]);
|
|
25335
|
+
pieces = pieces.flatMap(([min2, max2]) => {
|
|
25336
|
+
if (hi <= min2[k] || lo >= max2[k]) return [[min2, max2]];
|
|
25337
|
+
const out = [];
|
|
25338
|
+
if (lo > min2[k]) {
|
|
25339
|
+
const end3 = [max2[0], max2[1], max2[2]];
|
|
25340
|
+
end3[k] = lo;
|
|
25341
|
+
out.push([min2, end3]);
|
|
25342
|
+
}
|
|
25343
|
+
if (hi < max2[k]) {
|
|
25344
|
+
const start = [min2[0], min2[1], min2[2]];
|
|
25345
|
+
start[k] = hi;
|
|
25346
|
+
out.push([start, max2]);
|
|
25347
|
+
}
|
|
25348
|
+
return out;
|
|
25349
|
+
});
|
|
25350
|
+
}
|
|
25351
|
+
return pieces;
|
|
25352
|
+
};
|
|
25353
|
+
const fixedJoint = (j) => j.spec.kind === "rebar" || j.spec.kind === "fused" || j.spec.kind === "weld";
|
|
25354
|
+
const standsOver = (o, p, lower) => {
|
|
25355
|
+
const role = p.spec.structure?.role;
|
|
25356
|
+
if (role !== "slab" && role !== "roof" || p.spec.shape.kind !== "box" || lower.length === 0) return true;
|
|
25357
|
+
if (Math.abs(rotateVec(p.q, [0, 0, 0].map((_, k) => k === p.thin ? 1 : 0))[1]) < 0.9) return true;
|
|
25358
|
+
const i = o.idx.get(p.spec.id);
|
|
25359
|
+
for (const j of o.byPart.get(p.spec.id) ?? []) {
|
|
25360
|
+
if (j.st.open) continue;
|
|
25361
|
+
if (fixedJoint(j) && lower.includes(restsOn(o, j, i)) || j.spec.kind === "tie") return true;
|
|
25362
|
+
}
|
|
25363
|
+
const corners = [];
|
|
25364
|
+
for (const k of lower) {
|
|
25365
|
+
for (const [lo, hi] of contactsOf(p, o.parts[k])) {
|
|
25366
|
+
for (let c = 0; c < 4; c++) {
|
|
25367
|
+
const local2 = [c & 1 ? hi[0] : lo[0], (lo[1] + hi[1]) / 2, c & 2 ? hi[2] : lo[2]];
|
|
25368
|
+
const at4 = toWorld(p.pos, p.q, local2);
|
|
25369
|
+
corners.push([at4[0], at4[2]]);
|
|
25370
|
+
}
|
|
25371
|
+
}
|
|
25372
|
+
}
|
|
25373
|
+
return restsOver([p.pos[0], p.pos[2]], corners, 0);
|
|
25374
|
+
};
|
|
25045
25375
|
const borneOn = (p, supports) => {
|
|
25046
25376
|
if (supports.length === 0) return void 0;
|
|
25047
25377
|
const boxes = supports.map((support) => contactBox(p, support));
|
|
@@ -25097,7 +25427,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25097
25427
|
const key2 = lower.join(",");
|
|
25098
25428
|
if (key2 !== p.spanKey) {
|
|
25099
25429
|
p.spanKey = key2;
|
|
25100
|
-
p.span = spanOf(g, lower.
|
|
25430
|
+
p.span = spanOf(g, lower.flatMap((k) => contactsOf(p, o.parts[k])));
|
|
25101
25431
|
}
|
|
25102
25432
|
p.restMoment = 0;
|
|
25103
25433
|
if (g.gravity < 0 || p.span <= 0) return 0;
|
|
@@ -25163,9 +25493,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25163
25493
|
};
|
|
25164
25494
|
const freeSpan = (p, supports) => {
|
|
25165
25495
|
if (supports.length === 0) return Infinity;
|
|
25496
|
+
if (p.spec.shape.kind === "box") {
|
|
25497
|
+
const g = bendGeometry(p.spec);
|
|
25498
|
+
if (!g.member) return spanOf(g, supports.flatMap((k) => contactsOf(p, k)));
|
|
25499
|
+
}
|
|
25166
25500
|
const d = p.dims;
|
|
25167
25501
|
const L = [0, 1, 2].sort((a, b) => d[b] - d[a])[0];
|
|
25168
|
-
const spans = supports.
|
|
25502
|
+
const spans = supports.flatMap((k) => contactsOf(p, k)).map(([lo, hi]) => [lo[L], hi[L]]);
|
|
25169
25503
|
let far = 0;
|
|
25170
25504
|
for (let i = 0; i <= 16; i++) {
|
|
25171
25505
|
const x = (i / 16 - 0.5) * d[L];
|
|
@@ -25215,7 +25549,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25215
25549
|
}
|
|
25216
25550
|
lowerOf.set(i, lower);
|
|
25217
25551
|
const max2 = parts[i].spec.structure?.maxSpan;
|
|
25218
|
-
|
|
25552
|
+
const tooLong = max2 !== void 0 && freeSpan(parts[i], lower.map((k) => parts[k])) > max2;
|
|
25553
|
+
const standing = parts[i].heldAsDesigned || standsOver(o, parts[i], lower);
|
|
25554
|
+
if (o.seeding && !standing) parts[i].heldAsDesigned = true;
|
|
25555
|
+
if (!parts[i].anchored && (tooLong || !(standing || parts[i].heldAsDesigned))) {
|
|
25219
25556
|
out.add(i);
|
|
25220
25557
|
dropped = true;
|
|
25221
25558
|
}
|
|
@@ -25669,20 +26006,561 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25669
26006
|
if (!o.hasStructure || !o.parts.some((p) => p.anchored)) return;
|
|
25670
26007
|
if (!pendingCollapse.has(o)) pendingCollapse.set(o, src);
|
|
25671
26008
|
};
|
|
26009
|
+
const isLaidMasonry = (p) => !!p.spec.units && p.spec.units.mortar !== p.spec.material && !p.spec.reinforcement && !p.st.stripped;
|
|
26010
|
+
const isTiledCover = (p) => p.spec.structure?.role === "roof" && p.mat.fracture === "shatter" && !p.spec.reinforcement && !p.spec.units;
|
|
26011
|
+
const crumbleMasonry = (o, p, src) => {
|
|
26012
|
+
if (isLost(p)) return;
|
|
26013
|
+
const [u, v] = planeAxes(p.thin);
|
|
26014
|
+
const grid = gridOf(p);
|
|
26015
|
+
const worn = p.rt.chips ?? {};
|
|
26016
|
+
const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
|
|
26017
|
+
const cells = grid.filter((cell, i) => worn[i] !== -1 && !(op && p.st.opening && Math.hypot(cell.center[u] - op[u], cell.center[v] - op[v]) <= p.st.opening.radius));
|
|
26018
|
+
const { c } = partXf(o, p);
|
|
26019
|
+
const fragments = cells.length > 0 ? [
|
|
26020
|
+
...cellFragments(o, p, clumpUnits(cells, p.thin, unitSpan(p), isTiledCover(p) ? TILE_CLUMPS : unitClumps), vec.add(c, [0, 1, 0]), null, MASONRY_CRUMBLE_SPEED, p.st.mass, "m_", true),
|
|
26021
|
+
...plasterFlakes(o, p, cells, vec.add(c, [0, 1, 0]), MASONRY_CRUMBLE_SPEED, "mp_")
|
|
26022
|
+
] : [];
|
|
26023
|
+
p.st.status = "broken";
|
|
26024
|
+
p.st.hp = 0;
|
|
26025
|
+
p.st.mass = 0;
|
|
26026
|
+
emit2({ ...base(o, src), type: "fracture", part: p.spec.id, style: "crumble", fragments, point: c });
|
|
26027
|
+
debris2(o, p, p.mat.breakDebris, c, [0, 1, 0], clamp2(Math.round(Math.cbrt(partVolume(p.spec.shape)) * 30), 3, 20), 2, src);
|
|
26028
|
+
setStage(o, p, 3, {}, src);
|
|
26029
|
+
partLost(o, p, src);
|
|
26030
|
+
};
|
|
25672
26031
|
const flushCollapse = () => {
|
|
25673
26032
|
for (const [o, src] of [...pendingCollapse]) {
|
|
25674
26033
|
pendingCollapse.delete(o);
|
|
25675
26034
|
if (!objects.has(o.id) || objects.get(o.id) !== o) continue;
|
|
25676
|
-
|
|
26035
|
+
const crumbling = [];
|
|
26036
|
+
for (const g of [...o.st.groups]) {
|
|
25677
26037
|
const ps = g.map((id) => o.byId.get(id)).filter((p) => !isLost(p) && !o.collapsed.has(p.spec.id));
|
|
25678
26038
|
if (ps.length === 0 || g.some((id) => o.byId.get(id).anchored) || !ps.some((p) => p.structural)) continue;
|
|
25679
|
-
|
|
26039
|
+
const whole2 = ps.filter((p) => !isLaidMasonry(p) && !isTiledCover(p));
|
|
26040
|
+
crumbling.push(...ps.filter((p) => isLaidMasonry(p) || isTiledCover(p)));
|
|
26041
|
+
for (const p of whole2) {
|
|
25680
26042
|
o.collapsed.add(p.spec.id);
|
|
25681
26043
|
p.st.status = "collapsed";
|
|
25682
26044
|
setStage(o, p, 3, {}, src);
|
|
25683
26045
|
}
|
|
25684
|
-
emit2({ ...base(o, src), type: "collapse", parts:
|
|
26046
|
+
if (whole2.length > 0) emit2({ ...base(o, src), type: "collapse", parts: whole2.map((p) => p.spec.id), mass: whole2.reduce((sum2, p) => sum2 + p.st.mass, 0) });
|
|
25685
26047
|
}
|
|
26048
|
+
for (const p of crumbling) crumbleMasonry(o, p, src);
|
|
26049
|
+
}
|
|
26050
|
+
};
|
|
26051
|
+
const groundCfg = resolveGroundLoss(options.groundLoss);
|
|
26052
|
+
const pendingLosses = [];
|
|
26053
|
+
const bearersOf = (o) => {
|
|
26054
|
+
const terrain = /* @__PURE__ */ new Set();
|
|
26055
|
+
o.parts.forEach((p, i) => {
|
|
26056
|
+
if (isTerrain(p) && !isLost(p)) terrain.add(i);
|
|
26057
|
+
});
|
|
26058
|
+
const tops = [...terrain].map((i) => aabbOf(o.parts[i].spec.shape, o.parts[i].pos, o.parts[i].q).max[1]);
|
|
26059
|
+
const out = [];
|
|
26060
|
+
o.parts.forEach((p, i) => {
|
|
26061
|
+
if (terrain.has(i) || isLost(p) || o.collapsed.has(p.spec.id) || p.spec.structure?.pile) return;
|
|
26062
|
+
const ground = (o.byPart.get(p.spec.id) ?? []).filter((j) => !j.st.open && terrain.has(restsOn(o, j, i)));
|
|
26063
|
+
if (!p.anchored && ground.length === 0) return;
|
|
26064
|
+
const bottom = aabbOf(p.spec.shape, p.pos, p.q).min[1];
|
|
26065
|
+
const depth = Math.max(0, (tops.length ? Math.max(...tops) : bottom) - bottom);
|
|
26066
|
+
const footed = p.spec.structure?.role === "wall" || p.spec.structure?.role === "column";
|
|
26067
|
+
out.push({ p, i, ground, embed: footed ? Math.max(depth, groundCfg.footingDepth) : depth });
|
|
26068
|
+
});
|
|
26069
|
+
return out;
|
|
26070
|
+
};
|
|
26071
|
+
const nearLoss = (o, p, loss) => {
|
|
26072
|
+
const box5 = partWorldAabb(o, p);
|
|
26073
|
+
const dx = Math.max(box5.min[0] - loss.x, 0, loss.x - box5.max[0]);
|
|
26074
|
+
const dz = Math.max(box5.min[2] - loss.z, 0, loss.z - box5.max[2]);
|
|
26075
|
+
return Math.hypot(dx, dz) < loss.radius + loss.depth * groundCfg.spread;
|
|
26076
|
+
};
|
|
26077
|
+
const footprintOf = (o, b, loss) => {
|
|
26078
|
+
const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
26079
|
+
const long = box5.max[0] - box5.min[0] >= box5.max[2] - box5.min[2] ? 0 : 2;
|
|
26080
|
+
const across2 = long === 0 ? 2 : 0;
|
|
26081
|
+
const n = clamp2(Math.ceil((box5.max[long] - box5.min[long]) / FOOTPRINT_STEP), 1, FOOTPRINT_MAX_SAMPLES);
|
|
26082
|
+
const m = clamp2(Math.ceil((box5.max[across2] - box5.min[across2]) / FOOTPRINT_STEP), 1, FOOTPRINT_MAX_SAMPLES);
|
|
26083
|
+
const step = (box5.max[long] - box5.min[long]) / n;
|
|
26084
|
+
const slices = [];
|
|
26085
|
+
let voids = 0;
|
|
26086
|
+
let sum2 = 0;
|
|
26087
|
+
let worst = -1;
|
|
26088
|
+
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]);
|
|
26089
|
+
let voidBox = null;
|
|
26090
|
+
for (let k = 0; k < n; k++) {
|
|
26091
|
+
let open = 0;
|
|
26092
|
+
let drop = 0;
|
|
26093
|
+
let cutSum = 0;
|
|
26094
|
+
for (let c = 0; c < m; c++) {
|
|
26095
|
+
const local2 = [0, box5.min[1], 0];
|
|
26096
|
+
local2[long] = box5.min[long] + (k + 0.5) * step;
|
|
26097
|
+
local2[across2] = box5.min[across2] + (c + 0.5) * (box5.max[across2] - box5.min[across2]) / m;
|
|
26098
|
+
const world2 = toWorld(o.st.position, o.st.rotation, local2);
|
|
26099
|
+
const cut = undercutAt(loss, Math.hypot(world2[0] - loss.x, world2[2] - loss.z), b.embed, groundCfg.spread);
|
|
26100
|
+
if (cut >= groundCfg.voidDepth) {
|
|
26101
|
+
open++;
|
|
26102
|
+
const along = local2[long] - box5.min[long];
|
|
26103
|
+
const side = local2[across2] - box5.min[across2];
|
|
26104
|
+
voidBox ?? (voidBox = { long: [along, along], across: [side, side] });
|
|
26105
|
+
voidBox.long = [Math.min(voidBox.long[0], along - step / 2), Math.max(voidBox.long[1], along + step / 2)];
|
|
26106
|
+
voidBox.across = [Math.min(voidBox.across[0], side), Math.max(voidBox.across[1], side)];
|
|
26107
|
+
}
|
|
26108
|
+
drop += Math.min(cut, groundCfg.maxSettlement);
|
|
26109
|
+
cutSum += cut;
|
|
26110
|
+
if (cut > worst) {
|
|
26111
|
+
worst = cut;
|
|
26112
|
+
deepest = world2;
|
|
26113
|
+
}
|
|
26114
|
+
}
|
|
26115
|
+
voids += open;
|
|
26116
|
+
sum2 += drop;
|
|
26117
|
+
slices.push({ void: open * 2 > m, drop: drop / m, cut: cutSum / m });
|
|
26118
|
+
}
|
|
26119
|
+
return { long, step, slices, voidBox, share: voids / (n * m), drop: sum2 / (n * m), deepest };
|
|
26120
|
+
};
|
|
26121
|
+
const sectionOfBearer = (p) => {
|
|
26122
|
+
if (p.spec.shape.kind !== "box" || !p.mat.strength?.tensileMPa) return null;
|
|
26123
|
+
const g = bendGeometry(p.spec);
|
|
26124
|
+
if (g.gravity < 0) return null;
|
|
26125
|
+
const footing = p.spec.structure?.role === "foundation" && g.member && !isReinforced(p.spec);
|
|
26126
|
+
const spec = footing ? { ...p.spec, structure: { ...p.spec.structure, rebar: { ratio: groundCfg.beamRebarRatio } } } : p.spec;
|
|
26127
|
+
const section = { b: sectionWidth(g, g.gravity), h: g.dims[g.gravity] };
|
|
26128
|
+
const steel = tensionSteel(spec, g.dims, section, flexure);
|
|
26129
|
+
const m = sectionMoments(p.mat, section, steel, flexure);
|
|
26130
|
+
return { g, section, steel, m, resists: p.st.cracked ? m.steel : m.ultimate };
|
|
26131
|
+
};
|
|
26132
|
+
const pillarsUnder = (o, b, fp, standing) => {
|
|
26133
|
+
const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
26134
|
+
const across2 = fp.long === 0 ? 2 : 0;
|
|
26135
|
+
const out = [];
|
|
26136
|
+
for (const i of standing) {
|
|
26137
|
+
const q = o.parts[i];
|
|
26138
|
+
if (q.spec.structure?.role !== "column") continue;
|
|
26139
|
+
const c = aabbOf(q.spec.shape, q.pos, q.q);
|
|
26140
|
+
const overlaps = c.max[across2] > box5.min[across2] && c.min[across2] < box5.max[across2] && c.max[fp.long] > box5.min[fp.long] && c.min[fp.long] < box5.max[fp.long];
|
|
26141
|
+
if (overlaps && Math.abs(c.min[1] - box5.max[1]) < PILLAR_SEAT) out.push((c.min[fp.long] + c.max[fp.long]) / 2 - box5.min[fp.long]);
|
|
26142
|
+
}
|
|
26143
|
+
return out;
|
|
26144
|
+
};
|
|
26145
|
+
const continuationOf = (o, b, fp, standing) => {
|
|
26146
|
+
const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
26147
|
+
const across2 = fp.long === 0 ? 2 : 0;
|
|
26148
|
+
const ends = [false, false];
|
|
26149
|
+
for (const i of standing) {
|
|
26150
|
+
const q = o.parts[i];
|
|
26151
|
+
if (i === b.i || q.spec.structure?.role !== "foundation" || isTerrain(q)) continue;
|
|
26152
|
+
const c = aabbOf(q.spec.shape, q.pos, q.q);
|
|
26153
|
+
const inLine = Math.abs((c.min[across2] + c.max[across2]) / 2 - (box5.min[across2] + box5.max[across2]) / 2) < PILLAR_SEAT && c.max[1] > box5.min[1] && c.min[1] < box5.max[1];
|
|
26154
|
+
if (!inLine) continue;
|
|
26155
|
+
if (Math.abs(c.max[fp.long] - box5.min[fp.long]) < PILLAR_SEAT) ends[0] = true;
|
|
26156
|
+
if (Math.abs(c.min[fp.long] - box5.max[fp.long]) < PILLAR_SEAT) ends[1] = true;
|
|
26157
|
+
}
|
|
26158
|
+
return ends;
|
|
26159
|
+
};
|
|
26160
|
+
const bearBeam = (o, b, fp, standing, sec) => {
|
|
26161
|
+
const length2 = fp.slices.length * fp.step;
|
|
26162
|
+
const load = lineLoad(sec.g, b.p.st.load ?? b.p.st.mass);
|
|
26163
|
+
const verdict = judgeBeam(fp.slices.map((slice) => slice.void), fp.step, {
|
|
26164
|
+
length: length2,
|
|
26165
|
+
depth: sec.section.h,
|
|
26166
|
+
load,
|
|
26167
|
+
resists: sec.resists,
|
|
26168
|
+
cracking: sec.m.cracking,
|
|
26169
|
+
spanDepth: groundCfg.bridgeSpanDepth,
|
|
26170
|
+
soilSafety: soilCfg.safety,
|
|
26171
|
+
pillars: pillarsUnder(o, b, fp, standing),
|
|
26172
|
+
loadFactor: structureSafety,
|
|
26173
|
+
continuous: continuationOf(o, b, fp, standing)
|
|
26174
|
+
});
|
|
26175
|
+
if (verdict.runs.length === 0) return { status: fp.share <= 1 - 1 / soilCfg.safety ? "settled" : "unsupported", failed: [], cracks: [] };
|
|
26176
|
+
if (verdict.tips) return { status: "unsupported", failed: [], cracks: [] };
|
|
26177
|
+
const cracks = [];
|
|
26178
|
+
const failed = [];
|
|
26179
|
+
const EI = (b.p.mat.strength.elasticGPa ?? 0) * 1e9 * sec.section.b * sec.section.h ** 3 / 12;
|
|
26180
|
+
for (const run2 of verdict.runs) {
|
|
26181
|
+
const k0 = Math.round(run2.start / fp.step);
|
|
26182
|
+
const k1 = Math.round(run2.end / fp.step);
|
|
26183
|
+
if (!run2.holds) {
|
|
26184
|
+
const free = run2.kind !== "cantilever" ? void 0 : run2.start <= 1e-9 ? "start" : "end";
|
|
26185
|
+
failed.push({ start: run2.start, end: run2.end, ...free ? { free } : {} });
|
|
26186
|
+
if (free !== "start") cracks.push({ at: run2.start, top: true });
|
|
26187
|
+
if (free !== "end") cracks.push({ at: run2.end, top: true });
|
|
26188
|
+
for (let k = k0; k < k1; k++) fp.slices[k].drop = Math.min(fp.slices[k].cut, run2.span / 2);
|
|
26189
|
+
continue;
|
|
26190
|
+
}
|
|
26191
|
+
if (run2.cracks) cracks.push(run2.kind === "cantilever" ? { at: run2.start <= 1e-9 ? run2.end : run2.start, top: true } : { at: (run2.start + run2.end) / 2, top: false });
|
|
26192
|
+
const stiffness = EI * (run2.cracks || b.p.st.cracked ? CRACKED_STIFFNESS : 1);
|
|
26193
|
+
const sag = stiffness > 0 ? load * run2.span ** 4 / (run2.kind === "cantilever" ? 8 * stiffness : 384 / 5 * stiffness) : groundCfg.maxSettlement;
|
|
26194
|
+
for (let k = k0; k < k1; k++) fp.slices[k].drop = Math.min(fp.slices[k].drop, sag);
|
|
26195
|
+
}
|
|
26196
|
+
return { status: failed.length ? "opened" : "bridged", failed, cracks };
|
|
26197
|
+
};
|
|
26198
|
+
const standingOver = (o, b, fp) => {
|
|
26199
|
+
const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
26200
|
+
const vb = fp.voidBox;
|
|
26201
|
+
if (!vb) return [];
|
|
26202
|
+
const across2 = fp.long === 0 ? 2 : 0;
|
|
26203
|
+
const out = [];
|
|
26204
|
+
for (const j of o.byPart.get(b.p.spec.id) ?? []) {
|
|
26205
|
+
const k = j.ia === b.i ? j.ib : j.ia;
|
|
26206
|
+
if (j.st.open || restsOn(o, j, k) !== b.i) continue;
|
|
26207
|
+
const q = o.parts[k];
|
|
26208
|
+
const c = aabbOf(q.spec.shape, q.pos, q.q);
|
|
26209
|
+
const along = (c.min[fp.long] + c.max[fp.long]) / 2 - box5.min[fp.long];
|
|
26210
|
+
const side = (c.min[across2] + c.max[across2]) / 2 - box5.min[across2];
|
|
26211
|
+
if (along >= vb.long[0] && along <= vb.long[1] && side >= vb.across[0] && side <= vb.across[1]) out.push({ q, j });
|
|
26212
|
+
}
|
|
26213
|
+
return out;
|
|
26214
|
+
};
|
|
26215
|
+
const bearPlate = (o, b, fp, sec) => {
|
|
26216
|
+
const vb = fp.voidBox;
|
|
26217
|
+
if (!vb) return { status: "settled", failed: [], cracks: [] };
|
|
26218
|
+
const across2 = Math.max(vb.long[1] - vb.long[0], vb.across[1] - vb.across[0]);
|
|
26219
|
+
const over = standingOver(o, b, fp);
|
|
26220
|
+
const verdict = judgePlate({
|
|
26221
|
+
across: across2,
|
|
26222
|
+
load: lineLoad(sec.g, b.p.st.mass),
|
|
26223
|
+
resists: sec.resists,
|
|
26224
|
+
cracking: sec.m.cracking,
|
|
26225
|
+
effectiveDepth: sec.steel.d,
|
|
26226
|
+
punching: PUNCHING_SHARE * (b.p.mat.strength.tensileMPa ?? 0) * 1e6,
|
|
26227
|
+
loadFactor: structureSafety,
|
|
26228
|
+
points: over.map(({ q }) => {
|
|
26229
|
+
const c = aabbOf(q.spec.shape, q.pos, q.q);
|
|
26230
|
+
return { weight: (q.st.load ?? q.st.mass) * GRAVITY, side: Math.min(c.max[0] - c.min[0], c.max[2] - c.min[2]) };
|
|
26231
|
+
})
|
|
26232
|
+
});
|
|
26233
|
+
if (fp.share > 1 - 1 / soilCfg.safety) return { status: "unsupported", failed: [], cracks: [] };
|
|
26234
|
+
const cracks = verdict.cracks || !verdict.holds ? [{ at: vb.long[0], top: true }, { at: vb.long[1], top: true }] : [];
|
|
26235
|
+
if (verdict.holds) return { status: "bridged", failed: [], cracks };
|
|
26236
|
+
const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
26237
|
+
const crossing = fp.long === 0 ? 2 : 0;
|
|
26238
|
+
const center = [(box5.min[0] + box5.max[0]) / 2, (box5.min[1] + box5.max[1]) / 2, (box5.min[2] + box5.max[2]) / 2];
|
|
26239
|
+
center[fp.long] = box5.min[fp.long] + (vb.long[0] + vb.long[1]) / 2;
|
|
26240
|
+
center[crossing] = box5.min[crossing] + (vb.across[0] + vb.across[1]) / 2;
|
|
26241
|
+
const radius = Math.max(vb.long[1] - vb.long[0], vb.across[1] - vb.across[0]) / 2;
|
|
26242
|
+
if (2 * radius >= Math.min(box5.max[0] - box5.min[0], box5.max[2] - box5.min[2])) return { status: "unsupported", failed: [], cracks: [] };
|
|
26243
|
+
return { status: "opened", failed: [{ start: vb.long[0], end: vb.long[1] }], cracks, hole: { center, radius } };
|
|
26244
|
+
};
|
|
26245
|
+
const bearLoss = (o, b, fp, standing) => {
|
|
26246
|
+
const sec = sectionOfBearer(b.p);
|
|
26247
|
+
if (sec?.g.member) return bearBeam(o, b, fp, standing, sec);
|
|
26248
|
+
if (sec && fp.voidBox) return bearPlate(o, b, fp, sec);
|
|
26249
|
+
return { status: fp.share <= 1 - 1 / soilCfg.safety ? "settled" : "unsupported", failed: [], cracks: [] };
|
|
26250
|
+
};
|
|
26251
|
+
const crackBearer = (o, b, fp, bearing2, src) => {
|
|
26252
|
+
if (bearing2.cracks.length === 0) return;
|
|
26253
|
+
b.p.st.cracked = true;
|
|
26254
|
+
const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
26255
|
+
for (const crack of bearing2.cracks) {
|
|
26256
|
+
const local2 = [(box5.min[0] + box5.max[0]) / 2, crack.top ? box5.max[1] : box5.min[1], (box5.min[2] + box5.max[2]) / 2];
|
|
26257
|
+
local2[fp.long] = box5.min[fp.long] + crack.at;
|
|
26258
|
+
addCrack(o, b.p, toWorld(o.st.position, o.st.rotation, local2), rotateVec(o.st.rotation, [0, crack.top ? 1 : -1, 0]), box5.max[1] - box5.min[1], src);
|
|
26259
|
+
}
|
|
26260
|
+
};
|
|
26261
|
+
const openOver = (o, b, fp, failed, opened, src) => {
|
|
26262
|
+
const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
26263
|
+
let lost = false;
|
|
26264
|
+
for (const j of o.byPart.get(b.p.spec.id) ?? []) {
|
|
26265
|
+
const k = j.ia === b.i ? j.ib : j.ia;
|
|
26266
|
+
if (j.st.open || restsOn(o, j, k) !== b.i) continue;
|
|
26267
|
+
const q = o.parts[k];
|
|
26268
|
+
if (isLost(q)) continue;
|
|
26269
|
+
const c = aabbOf(q.spec.shape, q.pos, q.q);
|
|
26270
|
+
const from = c.min[fp.long] - box5.min[fp.long];
|
|
26271
|
+
const to = c.max[fp.long] - box5.min[fp.long];
|
|
26272
|
+
const run2 = failed.find((r) => to > r.start && from < r.end);
|
|
26273
|
+
if (!run2) continue;
|
|
26274
|
+
if (from >= run2.start - fp.step && to <= run2.end + fp.step) {
|
|
26275
|
+
j.st.open = true;
|
|
26276
|
+
j.st.hp = 0;
|
|
26277
|
+
j.st.openedBy = "break";
|
|
26278
|
+
opened.push(j);
|
|
26279
|
+
lost = true;
|
|
26280
|
+
continue;
|
|
26281
|
+
}
|
|
26282
|
+
if (isSlender(q.spec, q.mat) && archOver(o, q, fp.long, [box5.min[fp.long] + run2.start, box5.min[fp.long] + run2.end], run2.free, opened, src)) lost = true;
|
|
26283
|
+
}
|
|
26284
|
+
return lost;
|
|
26285
|
+
};
|
|
26286
|
+
const archOver = (o, q, axis2, span, free, opened, src) => {
|
|
26287
|
+
var _a;
|
|
26288
|
+
const grid = gridOf(q);
|
|
26289
|
+
const worn = (_a = q.rt).chips ?? (_a.chips = {});
|
|
26290
|
+
const bottom = aabbOf(q.spec.shape, q.pos, q.q).min[1];
|
|
26291
|
+
const half = (span[1] - span[0]) / 2;
|
|
26292
|
+
const middle = (span[0] + span[1]) / 2;
|
|
26293
|
+
const out = [];
|
|
26294
|
+
grid.forEach((cell, i) => {
|
|
26295
|
+
if (worn[i] === -1) return;
|
|
26296
|
+
const at4 = toWorld(q.pos, q.q, cell.center);
|
|
26297
|
+
const height2 = at4[1] - bottom;
|
|
26298
|
+
const reach = height2 / Math.tan(ARCH_ANGLE);
|
|
26299
|
+
const under = free === "start" ? at4[axis2] <= span[1] - reach : free === "end" ? at4[axis2] >= span[0] + reach : Math.abs(at4[axis2] - middle) <= half - reach;
|
|
26300
|
+
if (under) out.push(i);
|
|
26301
|
+
});
|
|
26302
|
+
if (out.length === 0) return false;
|
|
26303
|
+
const centre = [0, bottom, 0];
|
|
26304
|
+
centre[axis2] = middle;
|
|
26305
|
+
const other = axis2 === 0 ? 2 : 0;
|
|
26306
|
+
centre[other] = q.pos[other];
|
|
26307
|
+
knockOutUnits(o, q, toWorld(o.st.position, o.st.rotation, centre), 0, out, src);
|
|
26308
|
+
const height = aabbOf(q.spec.shape, q.pos, q.q).max[1] - bottom;
|
|
26309
|
+
const corbel = height / Math.tan(ARCH_ANGLE);
|
|
26310
|
+
const opening = free === "start" ? [span[0], span[1] - corbel] : free === "end" ? [span[0] + corbel, span[1]] : [span[0] + corbel, span[1] - corbel];
|
|
26311
|
+
return opening[1] > opening[0] && spanOpening(o, q, axis2, opening, !!free, opened, src);
|
|
26312
|
+
};
|
|
26313
|
+
const spanOpening = (o, q, axis2, opening, overhang, opened, src) => {
|
|
26314
|
+
const qi = o.idx.get(q.spec.id);
|
|
26315
|
+
const length2 = opening[1] - opening[0];
|
|
26316
|
+
let lost = false;
|
|
26317
|
+
for (const j of [...o.byPart.get(q.spec.id) ?? []]) {
|
|
26318
|
+
const ri = j.ia === qi ? j.ib : j.ia;
|
|
26319
|
+
const r = o.parts[ri];
|
|
26320
|
+
if (j.st.open || isLost(r) || restsOn(o, j, ri) !== qi || !r.structural) continue;
|
|
26321
|
+
const sec = sectionOfBearer(r);
|
|
26322
|
+
if (sec && !sec.g.member && !restsOnlyOn(o, ri, qi)) continue;
|
|
26323
|
+
const load = sec ? lineLoad(sec.g, r.st.load ?? r.st.mass) : 0;
|
|
26324
|
+
const moment = load * length2 * length2 / (overhang ? 2 : 8) * structureSafety;
|
|
26325
|
+
const reach = (overhang ? 0.5 : 1) * groundCfg.bridgeSpanDepth * (sec?.section.h ?? 0);
|
|
26326
|
+
if (sec && length2 <= reach && moment <= sec.resists) {
|
|
26327
|
+
if (moment > sec.m.cracking && !r.st.cracked) {
|
|
26328
|
+
r.st.cracked = true;
|
|
26329
|
+
addCrack(o, r, partXf(o, r).c, rotateVec(o.st.rotation, [0, -1, 0]), sec.section.h, src);
|
|
26330
|
+
}
|
|
26331
|
+
continue;
|
|
26332
|
+
}
|
|
26333
|
+
if (sec?.g.member) {
|
|
26334
|
+
if (breakOver(o, r, axis2, opening, opened, src)) lost = true;
|
|
26335
|
+
continue;
|
|
26336
|
+
}
|
|
26337
|
+
hingeDrop(o, r, src);
|
|
26338
|
+
lost = true;
|
|
26339
|
+
}
|
|
26340
|
+
return lost;
|
|
26341
|
+
};
|
|
26342
|
+
const breakOver = (o, r, axis2, stretch, opened, src) => {
|
|
26343
|
+
var _a;
|
|
26344
|
+
const ri = o.idx.get(r.spec.id);
|
|
26345
|
+
((_a = r.rt).broken ?? (_a.broken = [])).push([axis2, stretch[0], stretch[1]]);
|
|
26346
|
+
r.st.cracked = true;
|
|
26347
|
+
const box5 = aabbOf(r.spec.shape, r.pos, r.q);
|
|
26348
|
+
for (const edge of stretch) {
|
|
26349
|
+
const at4 = [(box5.min[0] + box5.max[0]) / 2, box5.max[1], (box5.min[2] + box5.max[2]) / 2];
|
|
26350
|
+
at4[axis2] = edge;
|
|
26351
|
+
addCrack(o, r, toWorld(o.st.position, o.st.rotation, at4), rotateVec(o.st.rotation, [0, 1, 0]), box5.max[1] - box5.min[1], src);
|
|
26352
|
+
}
|
|
26353
|
+
const from = [(box5.min[0] + box5.max[0]) / 2, box5.min[1], (box5.min[2] + box5.max[2]) / 2];
|
|
26354
|
+
const to = [from[0], from[1], from[2]];
|
|
26355
|
+
from[axis2] = box5.min[axis2];
|
|
26356
|
+
to[axis2] = box5.max[axis2];
|
|
26357
|
+
const count = SETTLEMENT_POINTS;
|
|
26358
|
+
const drop = Array.from({ length: count }, (_, k) => {
|
|
26359
|
+
const x = box5.min[axis2] + (box5.max[axis2] - box5.min[axis2]) * k / (count - 1);
|
|
26360
|
+
return x <= stretch[0] || x >= stretch[1] ? 0 : Math.min(x - stretch[0], stretch[1] - x, Math.max(0, box5.min[1]));
|
|
26361
|
+
});
|
|
26362
|
+
r.st.settlement = mergeSettlement(r.st.settlement, { from, to, drop });
|
|
26363
|
+
r.st.subsidence = Math.max(r.st.subsidence ?? 0, drop.reduce((sum2, v) => sum2 + v, 0) / count);
|
|
26364
|
+
const middle = [from[0], from[1], from[2]];
|
|
26365
|
+
middle[axis2] = (stretch[0] + stretch[1]) / 2;
|
|
26366
|
+
emit2({ ...base(o, src), type: "subside", part: r.spec.id, drop: r.st.subsidence, share: (stretch[1] - stretch[0]) / Math.max(1e-6, box5.max[axis2] - box5.min[axis2]), point: toWorld(o.st.position, o.st.rotation, middle), status: "opened" });
|
|
26367
|
+
let lost = false;
|
|
26368
|
+
for (const j of [...o.byPart.get(r.spec.id) ?? []]) {
|
|
26369
|
+
const ki = j.ia === ri ? j.ib : j.ia;
|
|
26370
|
+
const k = o.parts[ki];
|
|
26371
|
+
if (j.st.open || isLost(k) || restsOn(o, j, ki) !== ri) continue;
|
|
26372
|
+
const c = aabbOf(k.spec.shape, k.pos, k.q);
|
|
26373
|
+
const within = c.min[axis2] >= stretch[0] - SUPPORT_TOLERANCE && c.max[axis2] <= stretch[1] + SUPPORT_TOLERANCE;
|
|
26374
|
+
const sec = within ? null : sectionOfBearer(k);
|
|
26375
|
+
const plate3 = sec && !sec.g.member;
|
|
26376
|
+
const length2 = stretch[1] - stretch[0];
|
|
26377
|
+
const spans = plate3 && lineLoad(sec.g, k.st.load ?? k.st.mass) * length2 * length2 / 8 * structureSafety <= sec.resists;
|
|
26378
|
+
if (!within && (!plate3 || spans)) continue;
|
|
26379
|
+
j.st.open = true;
|
|
26380
|
+
j.st.hp = 0;
|
|
26381
|
+
j.st.openedBy = "break";
|
|
26382
|
+
opened.push(j);
|
|
26383
|
+
lost = true;
|
|
26384
|
+
}
|
|
26385
|
+
return lost;
|
|
26386
|
+
};
|
|
26387
|
+
const breakOut = (o, p, hole, src) => {
|
|
26388
|
+
if (p.st.opening) return;
|
|
26389
|
+
const lc = toLocal(p.pos, p.q, hole.center);
|
|
26390
|
+
lc[p.thin] = 0;
|
|
26391
|
+
const worldCenter = toWorld(o.st.position, o.st.rotation, toWorld(p.pos, p.q, lc));
|
|
26392
|
+
const [u, v] = planeAxes(p.thin);
|
|
26393
|
+
const worn = p.rt.chips;
|
|
26394
|
+
const cells = cellsWithin(gridOf(p).filter((_, i) => worn?.[i] !== -1), p.thin, lc, hole.radius);
|
|
26395
|
+
const removed = Math.min(p.st.mass, p.st.mass * Math.PI * hole.radius * hole.radius / (p.dims[u] * p.dims[v]));
|
|
26396
|
+
const fragments = cellFragments(o, p, cells, worldCenter, [0, -1, 0], 0.5, removed, "g");
|
|
26397
|
+
p.st.mass = Math.max(0, p.st.mass - removed);
|
|
26398
|
+
p.rt.removed = (p.rt.removed ?? 0) + removed;
|
|
26399
|
+
p.st.opening = { center: objLocal(o, worldCenter), radius: hole.radius };
|
|
26400
|
+
markDamaged(p);
|
|
26401
|
+
if (p.staged) {
|
|
26402
|
+
setStage(o, p, 1, {}, src);
|
|
26403
|
+
setStage(o, p, 2, { opening: { center: worldCenter, radius: hole.radius }, fragments }, src);
|
|
26404
|
+
} else emit2({ ...base(o, src), type: "stage", part: p.spec.id, stage: 2, opening: { center: worldCenter, radius: hole.radius }, fragments });
|
|
26405
|
+
debris2(o, p, p.mat.breakDebris, worldCenter, [0, 1, 0], 14, 2, src);
|
|
26406
|
+
if (p.spec.reinforcement) exposeRebar(o, p, src);
|
|
26407
|
+
};
|
|
26408
|
+
const distort = (o, q, beta, at4, toward2, src) => {
|
|
26409
|
+
const prior = q.rt.distortion ?? 0;
|
|
26410
|
+
const bearing2 = q.spec.structure?.role === "wall";
|
|
26411
|
+
const crackAt = bearing2 ? groundCfg.bearingCrackDistortion : groundCfg.crackDistortion;
|
|
26412
|
+
const damageAt = bearing2 ? groundCfg.bearingDamageDistortion : groundCfg.damageDistortion;
|
|
26413
|
+
if (beta < crackAt || beta <= prior * DISTORTION_GROWTH) return;
|
|
26414
|
+
q.rt.distortion = beta;
|
|
26415
|
+
const box5 = aabbOf(q.spec.shape, q.pos, q.q);
|
|
26416
|
+
const height = box5.max[1] - box5.min[1];
|
|
26417
|
+
const cracks = (d) => d < crackAt ? 0 : Math.min(MAX_SETTLEMENT_CRACKS, 1 + Math.floor(Math.log2(d / crackAt)));
|
|
26418
|
+
const count = Math.max(1, cracks(beta) - cracks(prior));
|
|
26419
|
+
const axis2 = [0, 0, 0];
|
|
26420
|
+
axis2[q.thin] = 1;
|
|
26421
|
+
const normal = rotateVec(quat.mul(o.st.rotation, q.q), axis2);
|
|
26422
|
+
const length2 = Math.min(height * 0.6, SETTLEMENT_CRACK_LENGTH * Math.sqrt(beta / crackAt));
|
|
26423
|
+
const units = q.spec.units?.size;
|
|
26424
|
+
const step = units ? [Math.max(units[0], units[2]), units[1]] : [BRICK_STEP[0], BRICK_STEP[1]];
|
|
26425
|
+
const reach = Math.hypot(toward2[0], toward2[2]) || 1;
|
|
26426
|
+
const along = vec.normalize([toward2[0] / reach, 1, toward2[2] / reach]);
|
|
26427
|
+
const width = clamp2(beta * SETTLEMENT_CRACK_OPENING, MIN_CRACK_WIDTH, MAX_CRACK_WIDTH);
|
|
26428
|
+
const through = q.dims[q.thin];
|
|
26429
|
+
for (let c = 0; c < count; c++) {
|
|
26430
|
+
const back = c * SETTLEMENT_CRACK_SPACING;
|
|
26431
|
+
const local2 = [clamp2(at4[0] - toward2[0] / reach * back, box5.min[0], box5.max[0]), box5.min[1] + height * (0.2 + 0.12 * c), clamp2(at4[2] - toward2[2] / reach * back, box5.min[2], box5.max[2])];
|
|
26432
|
+
const face = toLocal(q.pos, q.q, local2);
|
|
26433
|
+
face[q.thin] = through / 2;
|
|
26434
|
+
addCrack(o, q, toWorld(o.st.position, o.st.rotation, toWorld(q.pos, q.q, face)), normal, length2, src, { along, step, width, through });
|
|
26435
|
+
}
|
|
26436
|
+
if (beta >= damageAt && prior < damageAt) {
|
|
26437
|
+
q.st.hp = Math.max(1, q.st.hp - q.st.maxHp * groundCfg.distortionDamage);
|
|
26438
|
+
markDamaged(q);
|
|
26439
|
+
}
|
|
26440
|
+
};
|
|
26441
|
+
const crackOver = (o, b, fp, src) => {
|
|
26442
|
+
const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
26443
|
+
const drops = fp.slices.map((slice) => slice.drop);
|
|
26444
|
+
for (const j of o.byPart.get(b.p.spec.id) ?? []) {
|
|
26445
|
+
if (j.st.open) continue;
|
|
26446
|
+
const qi = j.ia === b.i ? j.ib : j.ia;
|
|
26447
|
+
const q = o.parts[qi];
|
|
26448
|
+
if (isLost(q) || isTerrain(q) || o.collapsed.has(q.spec.id) || !isSlender(q.spec, q.mat)) continue;
|
|
26449
|
+
if (restsOn(o, j, qi) !== b.i) {
|
|
26450
|
+
const side = [j.pos[0] - q.pos[0], 0, j.pos[2] - q.pos[2]];
|
|
26451
|
+
const own = q.st.settlement ? settlementAt(q.st.settlement, j.pos) : 0;
|
|
26452
|
+
const reach = Math.hypot(side[0], side[2]) || 1;
|
|
26453
|
+
const from = [j.pos[0] - side[0] / reach * BESIDE_CRACK_OFFSET, j.pos[1], j.pos[2] - side[2] / reach * BESIDE_CRACK_OFFSET];
|
|
26454
|
+
distort(o, q, Math.abs((b.p.st.subsidence ?? 0) - own) / DISTORTION_BASE, from, side, src);
|
|
26455
|
+
continue;
|
|
26456
|
+
}
|
|
26457
|
+
const over = aabbOf(q.spec.shape, q.pos, q.q);
|
|
26458
|
+
const k0 = clamp2(Math.floor((over.min[fp.long] - box5.min[fp.long]) / fp.step), 0, drops.length - 1);
|
|
26459
|
+
const k1 = clamp2(Math.ceil((over.max[fp.long] - box5.min[fp.long]) / fp.step), k0 + 1, drops.length);
|
|
26460
|
+
const { value, at: at4, down } = distortionOf(relativeToChord(drops.slice(k0, k1)), fp.step);
|
|
26461
|
+
const point = [(over.min[0] + over.max[0]) / 2, over.min[1], (over.min[2] + over.max[2]) / 2];
|
|
26462
|
+
point[fp.long] = box5.min[fp.long] + (k0 + at4 + 0.5) * fp.step;
|
|
26463
|
+
const toward2 = [0, 0, 0];
|
|
26464
|
+
toward2[fp.long] = down;
|
|
26465
|
+
distort(o, q, value, point, toward2, src);
|
|
26466
|
+
}
|
|
26467
|
+
};
|
|
26468
|
+
const settle = (o, b, fp) => {
|
|
26469
|
+
const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
26470
|
+
const from = [(box5.min[0] + box5.max[0]) / 2, box5.min[1], (box5.min[2] + box5.max[2]) / 2];
|
|
26471
|
+
const to = [from[0], from[1], from[2]];
|
|
26472
|
+
from[fp.long] = box5.min[fp.long];
|
|
26473
|
+
to[fp.long] = box5.max[fp.long];
|
|
26474
|
+
const line = { from, to, drop: settlementProfile(fp.slices.map((slice) => slice.drop), fp.step) };
|
|
26475
|
+
const follows = { from, to, drop: line.drop.map((v) => Math.min(v, groundCfg.maxSettlement)) };
|
|
26476
|
+
const moved = /* @__PURE__ */ new Set([b.i]);
|
|
26477
|
+
let ring3 = [b.i];
|
|
26478
|
+
for (let depth = 0; depth <= SETTLEMENT_FOLLOW_DEPTH && ring3.length; depth++) {
|
|
26479
|
+
const next = [];
|
|
26480
|
+
for (const i of ring3) {
|
|
26481
|
+
const p = o.parts[i];
|
|
26482
|
+
p.st.settlement = mergeSettlement(p.st.settlement, i === b.i ? line : follows);
|
|
26483
|
+
if (i !== b.i) p.st.subsidence = Math.max(p.st.subsidence ?? 0, settlementAt(p.st.settlement, p.pos));
|
|
26484
|
+
for (const j of o.byPart.get(p.spec.id) ?? []) {
|
|
26485
|
+
const k = j.ia === i ? j.ib : j.ia;
|
|
26486
|
+
const q = o.parts[k];
|
|
26487
|
+
if (j.st.open || moved.has(k) || isLost(q) || isTerrain(q) || q.anchored) continue;
|
|
26488
|
+
if (q.structural && (i !== b.i || restsOn(o, j, k) !== i || !restsOnlyOn(o, k, i))) continue;
|
|
26489
|
+
moved.add(k);
|
|
26490
|
+
next.push(k);
|
|
26491
|
+
}
|
|
26492
|
+
}
|
|
26493
|
+
ring3 = next;
|
|
26494
|
+
}
|
|
26495
|
+
};
|
|
26496
|
+
const restsOnlyOn = (o, k, i) => (o.byPart.get(o.parts[k].spec.id) ?? []).every((j) => j.st.open || restsOn(o, j, k) < 0 || restsOn(o, j, k) === i);
|
|
26497
|
+
const loseGround = (o, b, opened) => {
|
|
26498
|
+
if (b.p.anchored) {
|
|
26499
|
+
b.p.anchored = false;
|
|
26500
|
+
o.unanchored.add(b.p.spec.id);
|
|
26501
|
+
}
|
|
26502
|
+
for (const j of b.ground) {
|
|
26503
|
+
if (j.st.open) continue;
|
|
26504
|
+
j.st.open = true;
|
|
26505
|
+
j.st.hp = 0;
|
|
26506
|
+
j.st.openedBy = "break";
|
|
26507
|
+
opened.push(j);
|
|
26508
|
+
}
|
|
26509
|
+
};
|
|
26510
|
+
const undermine = (o, loss) => {
|
|
26511
|
+
if (!o.hasStructure || !o.anyAnchor || o.st.soil?.status === "toppled") return;
|
|
26512
|
+
const src = loss.source ?? "ground";
|
|
26513
|
+
const opened = [];
|
|
26514
|
+
const settled = [];
|
|
26515
|
+
let lost = false;
|
|
26516
|
+
const touched = bearersOf(o).filter((b) => nearLoss(o, b.p, loss)).map((b) => ({ b, fp: footprintOf(o, b, loss) })).filter(({ fp }) => fp.share > 0 || fp.drop >= SUBSIDE_MIN);
|
|
26517
|
+
const bearers = bearersOf(o);
|
|
26518
|
+
const pillarFirst = (b) => b.p.spec.structure?.role === "column" ? 0 : 1;
|
|
26519
|
+
const order = [...touched].sort((x, y) => pillarFirst(x.b) - pillarFirst(y.b));
|
|
26520
|
+
const standing = new Set(bearers.map((b) => b.i));
|
|
26521
|
+
for (const { b, fp } of order) {
|
|
26522
|
+
const bearing2 = bearLoss(o, b, fp, standing);
|
|
26523
|
+
if (bearing2.status === "unsupported") standing.delete(b.i);
|
|
26524
|
+
if (bearing2.status !== "unsupported" && !bendGeometry(b.p.spec).member) {
|
|
26525
|
+
const kept = fp.slices.filter((slice) => !slice.void);
|
|
26526
|
+
const flat2 = kept.length ? kept.reduce((sum2, slice) => sum2 + slice.drop, 0) / kept.length : 0;
|
|
26527
|
+
fp.slices.forEach((slice) => slice.drop = flat2);
|
|
26528
|
+
fp.drop = flat2;
|
|
26529
|
+
}
|
|
26530
|
+
if (bearing2.status !== "unsupported" && bendGeometry(b.p.spec).member) {
|
|
26531
|
+
const smooth2 = smoothProfile(fp.slices.map((slice) => slice.drop), fp.step, BEAM_SPREAD);
|
|
26532
|
+
fp.slices.forEach((slice, k) => slice.drop = bearing2.failed.some((r) => (k + 0.5) * fp.step > r.start && (k + 0.5) * fp.step < r.end) ? slice.drop : smooth2[k]);
|
|
26533
|
+
fp.drop = fp.slices.reduce((sum2, slice) => sum2 + slice.drop, 0) / Math.max(1, fp.slices.length);
|
|
26534
|
+
}
|
|
26535
|
+
const before = b.p.st.subsidence ?? 0;
|
|
26536
|
+
const drop = Math.max(before, fp.drop);
|
|
26537
|
+
const peak = () => Math.max(0, ...b.p.st.settlement?.drop ?? []);
|
|
26538
|
+
const peakBefore = peak();
|
|
26539
|
+
if (bearing2.status === "unsupported") {
|
|
26540
|
+
loseGround(o, b, opened);
|
|
26541
|
+
lost = true;
|
|
26542
|
+
} else {
|
|
26543
|
+
crackBearer(o, b, fp, bearing2, src);
|
|
26544
|
+
if (bearing2.failed.length && openOver(o, b, fp, bearing2.failed, opened, src)) lost = true;
|
|
26545
|
+
if (bearing2.hole) breakOut(o, b.p, bearing2.hole, src);
|
|
26546
|
+
settled.push({ b, fp });
|
|
26547
|
+
settle(o, b, fp);
|
|
26548
|
+
}
|
|
26549
|
+
if (bearing2.status === "settled" && drop - before < SUBSIDE_MIN && peak() - peakBefore < SUBSIDE_MIN) continue;
|
|
26550
|
+
b.p.st.subsidence = drop;
|
|
26551
|
+
emit2({ ...base(o, src), type: "subside", part: b.p.spec.id, drop, share: fp.share, point: fp.deepest, status: bearing2.status });
|
|
26552
|
+
}
|
|
26553
|
+
for (const { b, fp } of settled) crackOver(o, b, fp, src);
|
|
26554
|
+
o.active = true;
|
|
26555
|
+
if (!lost) return;
|
|
26556
|
+
solveStructure(o);
|
|
26557
|
+
recomputeGroups(o);
|
|
26558
|
+
detachEvents(o, opened, "break", src);
|
|
26559
|
+
collapseCheck(o, src);
|
|
26560
|
+
};
|
|
26561
|
+
const applyGroundLosses = () => {
|
|
26562
|
+
for (let loss = pendingLosses.shift(); loss; loss = pendingLosses.shift()) {
|
|
26563
|
+
for (const o of [...objects.values()]) if (objects.get(o.id) === o) undermine(o, loss);
|
|
25686
26564
|
}
|
|
25687
26565
|
};
|
|
25688
26566
|
const getObj = (id) => {
|
|
@@ -25715,6 +26593,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25715
26593
|
return r ? { t0: r.t0, t1: r.t1, n: rotateVec(q, r.n0) } : null;
|
|
25716
26594
|
};
|
|
25717
26595
|
const rayPart = (o, p, origin, d) => rayPartRaw(o.st.position, o.st.rotation, p.spec, p.q, origin, d, p.pos);
|
|
26596
|
+
const PART_BOUND_SLACK = 1e-6;
|
|
25718
26597
|
const raySphereMiss = (origin, d, c, r, maxDist) => {
|
|
25719
26598
|
const oc = vec.sub(origin, c);
|
|
25720
26599
|
const b = vec.dot(oc, d);
|
|
@@ -25724,13 +26603,27 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25724
26603
|
if (disc < 0) return true;
|
|
25725
26604
|
return -b - Math.sqrt(disc) > maxDist;
|
|
25726
26605
|
};
|
|
26606
|
+
const partSphereMiss = (o, d, p, maxDist) => {
|
|
26607
|
+
const x = o[0] - p.pos[0], y = o[1] - p.pos[1], z = o[2] - p.pos[2];
|
|
26608
|
+
const r = p.bound + PART_BOUND_SLACK;
|
|
26609
|
+
const b = x * d[0] + y * d[1] + z * d[2];
|
|
26610
|
+
const cc = x * x + y * y + z * z - r * r;
|
|
26611
|
+
if (cc > 0 && b > 0) return true;
|
|
26612
|
+
const disc = b * b - cc;
|
|
26613
|
+
if (disc < 0) return true;
|
|
26614
|
+
return -b - Math.sqrt(disc) > maxDist;
|
|
26615
|
+
};
|
|
25727
26616
|
const raycastInternal = (origin, dir, maxDist, ignore, worldOnly = false, precise = false) => {
|
|
25728
26617
|
const d = vec.normalize(dir);
|
|
25729
26618
|
let best = null;
|
|
25730
26619
|
for (const o of objects.values()) {
|
|
25731
26620
|
if (raySphereMiss(origin, d, toWorld(o.st.position, o.st.rotation, o.bc), o.br, best ? Math.min(maxDist, best.distance) : maxDist)) continue;
|
|
26621
|
+
const qi = quat.conjugate(o.st.rotation);
|
|
26622
|
+
const lo = rotateVec(qi, vec.sub(origin, o.st.position));
|
|
26623
|
+
const ld = rotateVec(qi, d);
|
|
25732
26624
|
for (const p of o.parts) {
|
|
25733
26625
|
if (isLost(p) || ignore?.has(`${o.id}\0${p.spec.id}`)) continue;
|
|
26626
|
+
if (partSphereMiss(lo, ld, p, maxDist)) continue;
|
|
25734
26627
|
const r = rayPart(o, p, origin, d);
|
|
25735
26628
|
if (!r || r.t0 < 0 || r.t0 > maxDist) continue;
|
|
25736
26629
|
if (p.st.opening && insideOpening(o, p, vec.madd(origin, d, r.t0))) continue;
|
|
@@ -25858,8 +26751,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25858
26751
|
setStage(o, p, 1, {}, src);
|
|
25859
26752
|
return hole;
|
|
25860
26753
|
};
|
|
25861
|
-
const addCrack = (o, p, wp, wn, length2, src) => {
|
|
25862
|
-
const crack = { point: objLocal(o, wp), normal: objLocalDir(o, wn), length: Math.min(length2, Math.max(p.bound, 0.05)), rays: 5 + Math.floor(rnd2() * 5) };
|
|
26754
|
+
const addCrack = (o, p, wp, wn, length2, src, stair) => {
|
|
26755
|
+
const crack = { point: objLocal(o, wp), normal: objLocalDir(o, wn), length: Math.min(length2, Math.max(p.bound, 0.05)), rays: 5 + Math.floor(rnd2() * 5), ...stair ? { stair } : {} };
|
|
25863
26756
|
p.st.cracks.push(crack);
|
|
25864
26757
|
if (p.st.cracks.length > 16) p.st.cracks.shift();
|
|
25865
26758
|
markDamaged(p);
|
|
@@ -25986,6 +26879,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25986
26879
|
const breachAreaOf = (p, damage, blast) => damage / (p.mat.hpPerKg * p.mat.density) / Math.max(p.thickness, 5e-3) * (blast ? breachBlastFactor : 1);
|
|
25987
26880
|
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 }));
|
|
25988
26881
|
const unitsOf2 = (p) => p.spec.units ?? { size: [p.mat.fragmentSize?.[1] ?? 0.2, p.mat.fragmentSize?.[1] ?? 0.2, p.thickness], bond: "stack" };
|
|
26882
|
+
const unitSpan = (p) => {
|
|
26883
|
+
const [u, v] = planeAxes(p.thin);
|
|
26884
|
+
const first = gridOf(p)[0];
|
|
26885
|
+
const size = unitsOf2(p).size;
|
|
26886
|
+
return first && first.size[u] > size[0] + 1e-6 ? [first.size[u], first.size[v]] : [Math.min(size[0], p.dims[u]), Math.min(size[1], p.dims[v])];
|
|
26887
|
+
};
|
|
25989
26888
|
const FRAGMENT_SHAPE = { shatter: "shard", splinter: "splinter", tear: "scrap" };
|
|
25990
26889
|
const cellFragments = (o, p, cells, hitW, dir, speed, mass, tag, inner = false) => {
|
|
25991
26890
|
const { c, q } = partXf(o, p);
|
|
@@ -26016,6 +26915,44 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26016
26915
|
};
|
|
26017
26916
|
});
|
|
26018
26917
|
};
|
|
26918
|
+
const plasterFlakes = (o, p, cells, hitW, speed, tag) => {
|
|
26919
|
+
const layer3 = p.layers.find((l) => l.mat.fracture === "crumble");
|
|
26920
|
+
if (!layer3 || cells.length === 0) return [];
|
|
26921
|
+
const { c, q } = partXf(o, p);
|
|
26922
|
+
const [u, v] = planeAxes(p.thin);
|
|
26923
|
+
const faces = layer3.def.faces === "both" ? [1, -1] : [layer3.def.faces === "+" ? 1 : -1];
|
|
26924
|
+
const area3 = cells.reduce((sum2, cell) => sum2 + cell.size[u] * cell.size[v], 0) * faces.length;
|
|
26925
|
+
const count = Math.min(MAX_PLASTER_FLAKES, Math.ceil(area3 / PLASTER_FLAKE_AREA));
|
|
26926
|
+
const out = [];
|
|
26927
|
+
for (let i = 0; i < count; i++) {
|
|
26928
|
+
const cell = cells[Math.floor(rnd2() * cells.length)];
|
|
26929
|
+
const face = faces[i % faces.length];
|
|
26930
|
+
const local2 = [cell.center[0], cell.center[1], cell.center[2]];
|
|
26931
|
+
local2[u] += (rnd2() - 0.5) * cell.size[u];
|
|
26932
|
+
local2[v] += (rnd2() - 0.5) * cell.size[v];
|
|
26933
|
+
local2[p.thin] = cell.center[p.thin] + face * (cell.size[p.thin] / 2 - layer3.def.thickness / 2);
|
|
26934
|
+
const size = [0, 0, 0];
|
|
26935
|
+
size[u] = 0.04 + 0.12 * rnd2();
|
|
26936
|
+
size[v] = 0.03 + 0.09 * rnd2();
|
|
26937
|
+
size[p.thin] = layer3.def.thickness;
|
|
26938
|
+
const cw = toWorld(c, q, local2);
|
|
26939
|
+
const out0 = vec.normalize(vec.sub(cw, hitW), [0, 1, 0]);
|
|
26940
|
+
const k = speed * (0.4 + 0.9 * rnd2());
|
|
26941
|
+
out.push({
|
|
26942
|
+
id: `${p.spec.id}#${tag}${i}`,
|
|
26943
|
+
part: p.spec.id,
|
|
26944
|
+
material: layer3.def.material,
|
|
26945
|
+
shape: "scrap",
|
|
26946
|
+
center: cw,
|
|
26947
|
+
size,
|
|
26948
|
+
rotation: q,
|
|
26949
|
+
velocity: [out0[0] * k, out0[1] * k + 0.5 * rnd2(), out0[2] * k],
|
|
26950
|
+
angularVelocity: [(rnd2() - 0.5) * 12, (rnd2() - 0.5) * 12, (rnd2() - 0.5) * 12],
|
|
26951
|
+
mass: layer3.mat.density * size[0] * size[1] * size[2]
|
|
26952
|
+
});
|
|
26953
|
+
}
|
|
26954
|
+
return out;
|
|
26955
|
+
};
|
|
26019
26956
|
const worldBars = (o, p, bars) => {
|
|
26020
26957
|
const { c, q } = partXf(o, p);
|
|
26021
26958
|
return bars.map(([a, b]) => [toWorld(c, q, a), toWorld(c, q, b)]);
|
|
@@ -26253,6 +27190,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26253
27190
|
}
|
|
26254
27191
|
const bow2 = clamp2(((p.st.stress ?? 0) - 1) / 0.5, 0, 1);
|
|
26255
27192
|
if (bow2 > 0) bars = bars.flatMap((bar2, i) => bendBar(bar2, p.thin, bow2 * BAR_BOW, i));
|
|
27193
|
+
const stirrups = memberStirrups(p.dims);
|
|
27194
|
+
if (stirrups.length > 0 && bars.length > 0) {
|
|
27195
|
+
if (p.st.stripped) bars = [...bars, ...stirrups];
|
|
27196
|
+
else for (const box5 of [...p.st.chipped ?? [], ...p.rt.bared ?? []]) bars.push(...clipBarsToVolume(stirrups, box5.center, box5.size));
|
|
27197
|
+
}
|
|
26256
27198
|
emit2({ ...base(o, src), type: "expose", part: p.spec.id, bars: worldBars(o, p, bars) });
|
|
26257
27199
|
};
|
|
26258
27200
|
const openBreach = (o, p, center, total, energy, dir, src) => {
|
|
@@ -26323,6 +27265,33 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26323
27265
|
if (out.length === 0) return false;
|
|
26324
27266
|
return knockOutUnits(o, p, wp, energy, out, src);
|
|
26325
27267
|
};
|
|
27268
|
+
const wedgedUnder = (o, p, loose) => {
|
|
27269
|
+
if (loose.length === 0) return loose;
|
|
27270
|
+
const beam = (o.byPart.get(p.spec.id) ?? []).some((j) => j.bears === "a_on_b" && j.spec.b === p.spec.id && !j.st.open && !!o.byId.get(j.spec.a)?.spec.reinforcement);
|
|
27271
|
+
if (!beam) return loose;
|
|
27272
|
+
const [, v] = planeAxes(p.thin);
|
|
27273
|
+
const grid = gridOf(p);
|
|
27274
|
+
const top = p.dims[v] / 2, course = unitSpan(p)[1];
|
|
27275
|
+
return loose.filter((i) => grid[i].center[v] + grid[i].size[v] / 2 < top - PANEL_EDGE_BEAM * course + 1e-4);
|
|
27276
|
+
};
|
|
27277
|
+
const panelEdge = (p, faces, seed) => {
|
|
27278
|
+
const [u, v] = planeAxes(p.thin);
|
|
27279
|
+
const [unitU, unitV] = unitSpan(p);
|
|
27280
|
+
const bottom = -p.dims[v] / 2, top = p.dims[v] / 2;
|
|
27281
|
+
const depth = (key2, most) => {
|
|
27282
|
+
const r = createRng2(seed ^ Math.imul(key2 + 1, 2654435761)).next();
|
|
27283
|
+
return Math.floor(r * r * (most + 1));
|
|
27284
|
+
};
|
|
27285
|
+
return (cell) => {
|
|
27286
|
+
const course = Math.round((cell.center[v] - bottom) / unitV - 0.5);
|
|
27287
|
+
const column = Math.round((cell.center[u] - faces.fromFace) / unitU - 0.5);
|
|
27288
|
+
const keyed = course % 2 === 0 ? 0.5 : 0;
|
|
27289
|
+
const side = Math.min(cell.center[u] - faces.fromFace, faces.toFace - cell.center[u]) / unitU;
|
|
27290
|
+
if (side < depth(course * 2, PANEL_EDGE_PILLAR) + keyed + 0.5) return true;
|
|
27291
|
+
if ((cell.center[v] - bottom) / unitV < depth(1e5 + column, PANEL_EDGE_BASE) + 1) return true;
|
|
27292
|
+
return (top - cell.center[v]) / unitV < Math.floor(createRng2(seed ^ Math.imul(200001 + column, 2654435761)).next() * (PANEL_EDGE_BEAM + 1));
|
|
27293
|
+
};
|
|
27294
|
+
};
|
|
26326
27295
|
const blastPanel = (o, p, point, energy, src) => {
|
|
26327
27296
|
var _a;
|
|
26328
27297
|
if (!p.staged || p.st.stripped || isLost(p) || !p.spec.units || p.spec.units.mortar === p.spec.material || p.spec.reinforcement) return false;
|
|
@@ -26334,12 +27303,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26334
27303
|
if (m === p || !m.spec.reinforcement || isLost(m) || m.spec.shape.kind !== "box") continue;
|
|
26335
27304
|
const mp = toLocal(p.pos, p.q, m.pos);
|
|
26336
27305
|
if (Math.abs(mp[p.thin]) > p.dims[p.thin] + 0.15 || Math.abs(mp[u]) > half + 0.15 || m.dims[v] < p.dims[v] * 0.5) continue;
|
|
26337
|
-
posts.push(mp[u]);
|
|
27306
|
+
posts.push({ x: mp[u], half: m.dims[u] / 2 });
|
|
26338
27307
|
}
|
|
26339
|
-
let from = -half, to = half;
|
|
26340
|
-
for (const x of posts) {
|
|
26341
|
-
if (x <= lp[u] && x > from)
|
|
26342
|
-
|
|
27308
|
+
let from = -half, to = half, fromFace = -half, toFace = half;
|
|
27309
|
+
for (const { x, half: w } of posts) {
|
|
27310
|
+
if (x <= lp[u] && x > from) {
|
|
27311
|
+
from = x;
|
|
27312
|
+
fromFace = x + w;
|
|
27313
|
+
}
|
|
27314
|
+
if (x >= lp[u] && x < to) {
|
|
27315
|
+
to = x;
|
|
27316
|
+
toFace = x - w;
|
|
27317
|
+
}
|
|
26343
27318
|
}
|
|
26344
27319
|
if (to - from < 0.2) return false;
|
|
26345
27320
|
const tnt = energy * DEFAULT_BLAST_IMPULSE.tntPerJoule;
|
|
@@ -26361,10 +27336,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26361
27336
|
const grid = gridOf(p);
|
|
26362
27337
|
const worn = (_a = p.rt).chips ?? (_a.chips = {});
|
|
26363
27338
|
const out = [];
|
|
27339
|
+
const edge = panelEdge(p, { fromFace, toFace }, seedOf2(...Array.from(`${o.id}|${p.spec.id}`, (char) => char.charCodeAt(0) / 1e3), from));
|
|
26364
27340
|
for (let i = 0; i < grid.length; i++) {
|
|
26365
27341
|
const cell = grid[i];
|
|
26366
27342
|
if (worn[i] === -1) continue;
|
|
26367
|
-
if (cell.center[u] - cell.size[u] / 2 >= from - 1e-6 && cell.center[u] + cell.size[u] / 2 <= to + 1e-6) out.push(i);
|
|
27343
|
+
if (cell.center[u] - cell.size[u] / 2 >= from - 1e-6 && cell.center[u] + cell.size[u] / 2 <= to + 1e-6 && !edge(cell)) out.push(i);
|
|
26368
27344
|
}
|
|
26369
27345
|
if (out.length === 0) return false;
|
|
26370
27346
|
for (const i of out) worn[i] = -1;
|
|
@@ -26377,7 +27353,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26377
27353
|
const grid = gridOf(p);
|
|
26378
27354
|
const worn = (_a = p.rt).chips ?? (_a.chips = {});
|
|
26379
27355
|
for (const i of out) worn[i] = -1;
|
|
26380
|
-
const
|
|
27356
|
+
const cast = p.spec.units?.mortar === p.spec.material;
|
|
27357
|
+
const loose = cast ? [] : wedgedUnder(o, p, unsupportedCells(grid, p.thin, p.dims, (i) => worn[i] !== -1 && !(op && p.st.opening && Math.hypot(grid[i].center[u] - op[u], grid[i].center[v] - op[v]) <= p.st.opening.radius)));
|
|
26381
27358
|
for (const i of loose) worn[i] = -1;
|
|
26382
27359
|
const blown = out.map((i) => grid[i]), fallen = loose.map((i) => grid[i]);
|
|
26383
27360
|
const volume = (cells2) => cells2.reduce((sum2, cell) => sum2 + cell.size[0] * cell.size[1] * cell.size[2], 0);
|
|
@@ -26388,8 +27365,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26388
27365
|
const chipped = (_b = p.st).chipped ?? (_b.chipped = []);
|
|
26389
27366
|
const tag = `x${chipped.length}_`;
|
|
26390
27367
|
const fragments = [
|
|
26391
|
-
...cellFragments(o, p,
|
|
26392
|
-
...fallen.length > 0 ? cellFragments(o, p,
|
|
27368
|
+
...cellFragments(o, p, clumpUnits(blown, p.thin, unitSpan(p), unitClumps), wp, null, speed, blownMass, tag, true),
|
|
27369
|
+
...fallen.length > 0 ? cellFragments(o, p, clumpUnits(fallen, p.thin, unitSpan(p), fallenClumps), wp, null, 0.3, fallenMass, `${tag}f`, true) : [],
|
|
27370
|
+
...plasterFlakes(o, p, blown, wp, speed, `${tag}p`)
|
|
26393
27371
|
];
|
|
26394
27372
|
const cells = [...blown, ...fallen];
|
|
26395
27373
|
const holes = localHolesOf(p);
|
|
@@ -26425,7 +27403,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26425
27403
|
const worn = (_a = p.rt).chips ?? (_a.chips = {});
|
|
26426
27404
|
const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
|
|
26427
27405
|
const opened = (cell) => !!op && !!p.st.opening && Math.hypot(cell.center[u] - op[u], cell.center[v] - op[v]) <= p.st.opening.radius;
|
|
26428
|
-
const loose = unsupportedCells(grid, p.thin, p.dims, (i) => worn[i] !== -1 && !opened(grid[i]));
|
|
27406
|
+
const loose = wedgedUnder(o, p, unsupportedCells(grid, p.thin, p.dims, (i) => worn[i] !== -1 && !opened(grid[i])));
|
|
26429
27407
|
if (loose.length === 0) return 0;
|
|
26430
27408
|
for (const i of loose) worn[i] = -1;
|
|
26431
27409
|
const fallen = loose.map((i) => grid[i]);
|
|
@@ -26440,7 +27418,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26440
27418
|
}
|
|
26441
27419
|
}
|
|
26442
27420
|
const center = toWorld(c, q, [(lo[0] + hi[0]) / 2, (lo[1] + hi[1]) / 2, (lo[2] + hi[2]) / 2]);
|
|
26443
|
-
const fragments = cellFragments(o, p,
|
|
27421
|
+
const fragments = cellFragments(o, p, clumpUnits(fallen, p.thin, unitSpan(p), fallenClumps), vec.add(center, [0, 1, 0]), null, 0.3, mass, `u${chipped.length}_`, true);
|
|
26444
27422
|
const holes = localHolesOf(p);
|
|
26445
27423
|
p.st.holes = p.st.holes.filter((_, k) => !fallen.some((cell) => marksInBox(cell.center, cell.size, void 0, [holes[k]]).length > 0));
|
|
26446
27424
|
for (const cell of fallen) chipped.push({ center: [cell.center[0], cell.center[1], cell.center[2]], size: [cell.size[0], cell.size[1], cell.size[2]] });
|
|
@@ -26860,14 +27838,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26860
27838
|
}
|
|
26861
27839
|
if (Ein > 20 && p.layers.length > 0) spallOuter(o, p, wp, faceOf(o, p, wn), wn, clamp2(0.05 + Math.sqrt(Ein) * 2e-3, 0.05, 0.4), src);
|
|
26862
27840
|
const breachReach = BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3);
|
|
26863
|
-
const
|
|
26864
|
-
const
|
|
27841
|
+
const caged2 = Boolean(p.spec.reinforcement && p.spec.units);
|
|
27842
|
+
const member = caged2 && (isMember(p.dims) || dist2 > MEMBER_CUT_REACH * breachReach);
|
|
27843
|
+
const dealt = member ? applyDamage(o, p, Math.min(amount, Math.max(0, p.st.hp - p.st.maxHp * FAR_MEMBER_HP_FLOOR)), "explosive", null, null, Ein * 0.3, 40, src) : applyDamage(o, p, amount, "explosive", point, null, Ein * 0.3, 40, src);
|
|
26865
27844
|
res.damage += dealt;
|
|
26866
27845
|
if (p.bend && flexure.enabled) bendByBlast(o, p, point, energy, radius, reach, src);
|
|
26867
27846
|
if (p.spec.units && p.spec.units.mortar !== p.spec.material) {
|
|
26868
27847
|
blastPanel(o, p, point, energy, src);
|
|
26869
27848
|
if (!isLost(p)) blastUnits(o, p, wp, energy, dist2, src);
|
|
26870
|
-
} else if (
|
|
27849
|
+
} else if (member) blastUnits(o, p, wp, energy, dist2, src);
|
|
26871
27850
|
else if (dist2 <= breachReach) addBreach(o, p, wp, breachAreaOf(p, dealt, true), Ein, null, src);
|
|
26872
27851
|
return reach;
|
|
26873
27852
|
};
|
|
@@ -27696,18 +28675,27 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27696
28675
|
blastProbe.partsNear = 0;
|
|
27697
28676
|
return withCollapses(run(() => blastWorld(point, energy, radius, source, blast)));
|
|
27698
28677
|
},
|
|
28678
|
+
groundLoss(loss) {
|
|
28679
|
+
if (!(loss.radius > 0) || !(loss.depth > 0) || !Number.isFinite(loss.x) || !Number.isFinite(loss.z)) return;
|
|
28680
|
+
pendingLosses.push({ ...loss });
|
|
28681
|
+
},
|
|
27699
28682
|
raycast(origin, direction, maxDistance = Infinity) {
|
|
27700
28683
|
const r = raycastInternal(origin, direction, maxDistance, void 0, false, true);
|
|
27701
28684
|
return r ? { object: r.object, part: r.part, point: r.point, normal: r.normal, distance: r.distance } : null;
|
|
27702
28685
|
},
|
|
27703
28686
|
sweepBox(box5, direction, distance4, options2 = {}) {
|
|
27704
28687
|
const d = vec.normalize(direction);
|
|
27705
|
-
const
|
|
27706
|
-
const
|
|
27707
|
-
|
|
28688
|
+
const ignoredIds = options2.ignore === void 0 ? [] : typeof options2.ignore === "string" ? [options2.ignore] : options2.ignore;
|
|
28689
|
+
const ignore = /* @__PURE__ */ new Set();
|
|
28690
|
+
for (const id of ignoredIds) {
|
|
28691
|
+
const ignored = objects.get(id);
|
|
28692
|
+
const hosted = ignored ? void 0 : impls.get(id);
|
|
28693
|
+
if (ignored) for (const p of ignored.parts) ignore.add(`${ignored.id}\0${p.spec.id}`);
|
|
28694
|
+
else if (hosted) for (const p of hosted.impl.describe().parts) ignore.add(`${hosted.impl.id}\0${p.id}`);
|
|
28695
|
+
}
|
|
27708
28696
|
let best = null;
|
|
27709
28697
|
for (const origin of sweepOrigins(box5, d, options2.spacing ?? 0.2)) {
|
|
27710
|
-
const r = raycastInternal(origin, d, distance4 + SWEEP_BACK, ignore);
|
|
28698
|
+
const r = raycastInternal(origin, d, distance4 + SWEEP_BACK, ignore.size > 0 ? ignore : void 0);
|
|
27711
28699
|
if (!r || best && r.distance >= best.distance) continue;
|
|
27712
28700
|
best = { object: r.object, part: r.part, point: r.point, normal: r.normal, distance: Math.max(0, r.distance - SWEEP_BACK) };
|
|
27713
28701
|
}
|
|
@@ -27898,6 +28886,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27898
28886
|
if (!(dt > 0)) return [];
|
|
27899
28887
|
return run(() => {
|
|
27900
28888
|
time += dt;
|
|
28889
|
+
applyGroundLosses();
|
|
27901
28890
|
const sources = [];
|
|
27902
28891
|
for (const o of [...objects.values()]) if (o.active) stepObject(o, dt, sources);
|
|
27903
28892
|
for (const o of [...objects.values()]) if (o.soil && objects.get(o.id) === o) stepSoil(o, dt);
|
|
@@ -27944,7 +28933,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27944
28933
|
rng: rng2.state(),
|
|
27945
28934
|
counter,
|
|
27946
28935
|
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] } : {} };
|
|
28936
|
+
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
28937
|
for (const p of o.parts) runtime.parts[p.spec.id] = clone(p.rt);
|
|
27949
28938
|
for (const j of o.joints) runtime.joints[j.spec.id] = j.step;
|
|
27950
28939
|
return { id: o.id, spec: clone(o.spec), state: clone(o.st), runtime };
|
|
@@ -27966,6 +28955,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27966
28955
|
),
|
|
27967
28956
|
joints: new Map(state.joints.map((st) => [st.id, { st, step: e.runtime?.joints[st.id] ?? 0 }])),
|
|
27968
28957
|
collapsed: e.runtime?.collapsed,
|
|
28958
|
+
...e.runtime?.unanchored ? { unanchored: e.runtime.unanchored } : {},
|
|
27969
28959
|
...e.runtime?.wind ? { wind: e.runtime.wind } : {}
|
|
27970
28960
|
};
|
|
27971
28961
|
let pos = state.position, rot = state.rotation;
|
|
@@ -29120,7 +30110,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29120
30110
|
const alongU = wall.aabb[2] - wall.aabb[0] >= wall.aabb[3] - wall.aabb[1];
|
|
29121
30111
|
const from = alongU ? wall.aabb[0] : wall.aabb[1];
|
|
29122
30112
|
const to = alongU ? wall.aabb[2] : wall.aabb[3];
|
|
29123
|
-
const
|
|
30113
|
+
const cross4 = alongU ? [wall.aabb[1], wall.aabb[3]] : [wall.aabb[0], wall.aabb[2]];
|
|
29124
30114
|
const rows = Math.max(1, Math.round((wall.y1 - wall.y0) / spec.rowHeight));
|
|
29125
30115
|
const rowHeight = (wall.y1 - wall.y0) / rows;
|
|
29126
30116
|
const cells = [];
|
|
@@ -29130,7 +30120,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29130
30120
|
for (const [a, b] of cutAt(from, to, openings.filter((o) => o.wall === wall.id), y0, y1)) for (const [x0, x1] of unitsOf(a, b, row, spec)) cells.push({ from: x0, to: x1, row, y0, y1 });
|
|
29131
30121
|
}
|
|
29132
30122
|
const total = cells.reduce((sum2, cell) => sum2 + (cell.to - cell.from) * (cell.y1 - cell.y0), 0);
|
|
29133
|
-
const box22 = (cell) => alongU ? [cell.from,
|
|
30123
|
+
const box22 = (cell) => alongU ? [cell.from, cross4[0], cell.to, cross4[1]] : [cross4[0], cell.from, cross4[1], cell.to];
|
|
29134
30124
|
const pieces = cells.map((cell, index) => ({
|
|
29135
30125
|
id: `${wall.id}_${spec.unitLength ? "u" : "log"}${cell.row}_${index}`,
|
|
29136
30126
|
role: wall.role,
|
|
@@ -29328,7 +30318,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29328
30318
|
}
|
|
29329
30319
|
return spec;
|
|
29330
30320
|
};
|
|
29331
|
-
var MEMBER_CAGE = { spacing: 0.1, diameter:
|
|
30321
|
+
var MEMBER_CAGE = { spacing: 0.1, diameter: 0.01, unit: 0.1 };
|
|
29332
30322
|
var CAGED_ROLES = /* @__PURE__ */ new Set(["beam", "column"]);
|
|
29333
30323
|
var CAGE_COVER = 0.03;
|
|
29334
30324
|
var CAGE_BUCKLING_SHARE = 0.5;
|
|
@@ -31263,7 +32253,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31263
32253
|
}
|
|
31264
32254
|
var residentialTower = residentialTowerTemplate();
|
|
31265
32255
|
|
|
31266
|
-
// ../game-floorplan-three/dist/chunk-
|
|
32256
|
+
// ../game-floorplan-three/dist/chunk-EWU252NT.js
|
|
31267
32257
|
var __defProp4 = Object.defineProperty;
|
|
31268
32258
|
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
31269
32259
|
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -37659,7 +38649,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37659
38649
|
if (!pc || pc.unit) return sp;
|
|
37660
38650
|
if (pc.role !== "wall" && pc.role !== "partition") {
|
|
37661
38651
|
const def = getAssembly(pc.assembly || (pc.material === "concrete" && ["slab", "beam", "column", "stair"].includes(pc.role) ? "reinforced_concrete" : ""));
|
|
37662
|
-
const
|
|
38652
|
+
const bars = def && def.reinforcement ? pc.role === "column" || pc.role === "beam" ? { ...def.reinforcement, diameter: Math.max(def.reinforcement.diameter, MEMBER_CAGE.diameter) } : def.reinforcement : null;
|
|
38653
|
+
const cage = bars ? pc.role === "column" && sp.shape.kind === "box" ? { ...bars, residualCapacity: cageResidualCapacity(sp.shape.size, bars, sp.structure?.capacity) } : { ...bars } : null;
|
|
37663
38654
|
const out = cage && !sp.reinforcement ? { ...sp, reinforcement: cage } : sp;
|
|
37664
38655
|
if (out.reinforcement && !out.units && pc.material === "concrete" && (pc.role === "beam" || pc.role === "column") && sp.shape.kind === "box") {
|
|
37665
38656
|
return { ...out, units: { size: [MEMBER_CAGE.unit, MEMBER_CAGE.unit, Math.min(...sp.shape.size)], bond: "stack", mortar: "concrete" } };
|
|
@@ -37865,6 +38856,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37865
38856
|
toHouse.value.copy(house.matrixWorld).invert().multiply(mesh3.matrixWorld);
|
|
37866
38857
|
return mesh3;
|
|
37867
38858
|
}
|
|
38859
|
+
const withMask = (material, mask) => {
|
|
38860
|
+
material.userData.breachMask = mask;
|
|
38861
|
+
return material;
|
|
38862
|
+
};
|
|
37868
38863
|
function unitsMaterial(core) {
|
|
37869
38864
|
const material = new THREE.MeshLambertMaterial({ color: 16777215, side: THREE.DoubleSide });
|
|
37870
38865
|
material.onBeforeCompile = (sh) => {
|
|
@@ -37949,13 +38944,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37949
38944
|
if (opening) discs.push({ s: along(opening.center), y: opening.center[1], r: opening.radius });
|
|
37950
38945
|
for (const k of spalls) flakes.push({ s: along(k.center), y: k.center[1], r: k.radius });
|
|
37951
38946
|
const boxes = chips2.map((k) => ({ s0: along(k.center) - k.along, s1: along(k.center) + k.along, y0: k.center[1] - k.up, y1: k.center[1] + k.up }));
|
|
37952
|
-
const gone = (c) =>
|
|
38947
|
+
const gone = (c) => {
|
|
38948
|
+
const over = boxes.filter((k) => k.s1 > c.a && k.s0 < c.b && k.y1 > c.y0 && k.y0 < c.y1);
|
|
38949
|
+
const share = covered(c, over);
|
|
38950
|
+
if (share >= 0.9) return true;
|
|
38951
|
+
const s = (c.a + c.b) / 2, y = (c.y0 + c.y1) / 2;
|
|
38952
|
+
return share >= 0.5 && over.some((k) => s >= k.s0 && s <= k.s1 && y >= k.y0 && y <= k.y1);
|
|
38953
|
+
};
|
|
38954
|
+
const open = (c) => gone(c) || opening !== void 0 && Math.hypot((c.a + c.b) / 2 - along(opening.center), (c.y0 + c.y1) / 2 - opening.center[1]) < opening.radius;
|
|
37953
38955
|
const kept = [];
|
|
37954
|
-
for (const c of all) (
|
|
38956
|
+
for (const c of all) (open(c) ? holes : kept).push(c);
|
|
37955
38957
|
for (const c of kept) shown.push({ c, part, units: units2, thick, mid });
|
|
37956
|
-
for (const
|
|
37957
|
-
if (holes.some((h) =>
|
|
37958
|
-
|
|
38958
|
+
for (const box5 of boxes) {
|
|
38959
|
+
if (holes.some((h) => box5.s0 >= h.a - 1e-4 && box5.s1 <= h.b + 1e-4 && box5.y0 >= h.y0 - 1e-4 && box5.y1 <= h.y1 + 1e-4)) continue;
|
|
38960
|
+
const k = id === view.host ? besidePillars({ a: box5.s0, b: box5.s1, y0: box5.y0, y1: box5.y1 }, pillars)[0] : { a: box5.s0, b: box5.s1, y0: box5.y0, y1: box5.y1 };
|
|
38961
|
+
if (!k) continue;
|
|
38962
|
+
pits.push({ s: (k.a + k.b) / 2, y: (k.y0 + k.y1) / 2, rs: (k.b - k.a) / 2, ry: (k.y1 - k.y0) / 2 });
|
|
37959
38963
|
}
|
|
37960
38964
|
}
|
|
37961
38965
|
const reach = SPALL_MIN + SPALL_RAGGED;
|
|
@@ -37984,6 +38988,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
37984
38988
|
stamp(mask, p.s - p.rs, p.s + p.rs, p.y - p.ry, p.y + p.ry, (s, y) => plaster(Math.max(0, ellipseDistance(s, y, p.s, p.y, p.rs, p.ry)), s, y));
|
|
37985
38989
|
stamp(core, p.s - p.rs, p.s + p.rs, p.y - p.ry, p.y + p.ry, (s, y) => ellipseDistance(s, y, p.s, p.y, p.rs, p.ry) <= -0.35 * Math.min(p.rs, p.ry) * noise2(s * 1.7, y * 1.3, 0.012));
|
|
37986
38990
|
}
|
|
38991
|
+
for (const q of pillars) {
|
|
38992
|
+
const i0 = Math.max(0, Math.floor((q.a + 5e-3) / mask.len * mask.w)), i1 = Math.min(mask.w - 1, Math.floor((q.b - 5e-3) / mask.len * mask.w));
|
|
38993
|
+
const j0 = Math.max(0, Math.floor((q.y0 - mask.y0) / mask.height * mask.h)), j1 = Math.min(mask.h - 1, Math.floor((q.y1 - mask.y0) / mask.height * mask.h));
|
|
38994
|
+
for (let j = j0; j <= j1; j++) if (mask.data[j * mask.w + i0] && mask.data[j * mask.w + i1]) mask.data.fill(255, j * mask.w + i0, j * mask.w + i1 + 1);
|
|
38995
|
+
}
|
|
37987
38996
|
mask.texture.needsUpdate = true;
|
|
37988
38997
|
core.texture.needsUpdate = true;
|
|
37989
38998
|
const near = (c) => holes.some((h) => boxDistance((c.a + c.b) / 2, (c.y0 + c.y1) / 2, h.a - (c.b - c.a) / 2, h.b + (c.b - c.a) / 2, h.y0 - (c.y1 - c.y0) / 2, h.y1 + (c.y1 - c.y0) / 2) <= reach) || discs.some((d) => boxDistance(d.s, d.y, c.a, c.b, c.y0, c.y1) <= d.r + reach) || pits.some((p) => boxDistance(p.s, p.y, c.a, c.b, c.y0, c.y1) <= Math.max(p.rs, p.ry) + reach) || flakes.some((f) => boxDistance(f.s, f.y, c.a, c.b, c.y0, c.y1) <= 2 * f.r);
|
|
@@ -38050,7 +39059,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
38050
39059
|
items,
|
|
38051
39060
|
mask,
|
|
38052
39061
|
core,
|
|
38053
|
-
unitMaterial: unitsMaterial(core),
|
|
39062
|
+
unitMaterial: withMask(unitsMaterial(core), mask),
|
|
38054
39063
|
shells: [],
|
|
38055
39064
|
saved: null,
|
|
38056
39065
|
units: null,
|
|
@@ -41054,15 +42063,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41054
42063
|
found: "commons: GP-25 grenade launcher"
|
|
41055
42064
|
},
|
|
41056
42065
|
ag36: {
|
|
41057
|
-
title: "File:AG36.
|
|
41058
|
-
page: "https://commons.wikimedia.org/wiki/File:
|
|
41059
|
-
url: "https://
|
|
41060
|
-
width:
|
|
41061
|
-
height:
|
|
41062
|
-
author: "
|
|
41063
|
-
license: "CC BY-SA
|
|
41064
|
-
licenseUrl: "https://creativecommons.org/licenses/by-sa/
|
|
41065
|
-
found: "
|
|
42066
|
+
title: "File:HK G36 with AG36.jpg",
|
|
42067
|
+
page: "https://commons.wikimedia.org/wiki/File:HK_G36_with_AG36.jpg",
|
|
42068
|
+
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",
|
|
42069
|
+
width: 1279,
|
|
42070
|
+
height: 344,
|
|
42071
|
+
author: "sonaz",
|
|
42072
|
+
license: "CC BY-SA 2.5",
|
|
42073
|
+
licenseUrl: "https://creativecommons.org/licenses/by-sa/2.5",
|
|
42074
|
+
found: "pinned"
|
|
41066
42075
|
},
|
|
41067
42076
|
flashbang: {
|
|
41068
42077
|
title: "File:M-84-Flash-Bang-Grenade.jpg",
|
|
@@ -41249,7 +42258,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
41249
42258
|
taurus_g2c: "File:Taurus G2C 9mm Sn 1C014003 L DSC0277.jpg",
|
|
41250
42259
|
taurus_pt100: "File:TaurusPT92.jpg",
|
|
41251
42260
|
taurus_smt9: "File:Taurus SMT9 with IA2 crop.jpg",
|
|
41252
|
-
sledgehammer: "File:C&O Railway Heritage Center - Sledgehammer.jpg"
|
|
42261
|
+
sledgehammer: "File:C&O Railway Heritage Center - Sledgehammer.jpg",
|
|
42262
|
+
ag36: "File:HK G36 with AG36.jpg"
|
|
41253
42263
|
}
|
|
41254
42264
|
};
|
|
41255
42265
|
|
|
@@ -46496,7 +47506,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
46496
47506
|
};
|
|
46497
47507
|
var showcaseTextOf = (locale) => TEXT[locale] ?? TEXT.en;
|
|
46498
47508
|
|
|
46499
|
-
// ../game-audio/dist/chunk-
|
|
47509
|
+
// ../game-audio/dist/chunk-TXGRBRE6.js
|
|
46500
47510
|
var SFX_TIERS = { light: 0, medium: 0.34, heavy: 0.67 };
|
|
46501
47511
|
function splitTier(id) {
|
|
46502
47512
|
const match = /^(.*)_(light|medium|heavy)$/.exec(id);
|
|
@@ -46545,14 +47555,48 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
46545
47555
|
...numbers.cutoffK === void 0 ? {} : { cutoffK: numbers.cutoffK },
|
|
46546
47556
|
...numbers.group ? { group: numbers.group } : {},
|
|
46547
47557
|
...numbers.priority === void 0 ? {} : { priority: numbers.priority },
|
|
47558
|
+
...numbers.choke ? { choke: numbers.choke } : {},
|
|
46548
47559
|
...numbers.fallback ? { fallback: numbers.fallback } : {},
|
|
46549
47560
|
sources: files.map((file) => `${file.file}: ${file.source} ${file.author} ${file.license}`)
|
|
46550
47561
|
});
|
|
46551
47562
|
}
|
|
46552
47563
|
return { id: options.id, samples };
|
|
46553
47564
|
}
|
|
47565
|
+
var sample_levels_default = {
|
|
47566
|
+
$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.",
|
|
47567
|
+
casing: {
|
|
47568
|
+
gainDb: -32,
|
|
47569
|
+
pitch: 0.06,
|
|
47570
|
+
cutoffK: 0.03,
|
|
47571
|
+
priority: 1,
|
|
47572
|
+
falloff: { model: "inverse_square", k: 0.08, minGain: 3e-3 },
|
|
47573
|
+
choke: { voices: 3, fade: 0.05 }
|
|
47574
|
+
},
|
|
47575
|
+
magazine: {
|
|
47576
|
+
gainDb: -24,
|
|
47577
|
+
pitch: 0.06,
|
|
47578
|
+
cutoffK: 0.03,
|
|
47579
|
+
priority: 1,
|
|
47580
|
+
falloff: { model: "inverse_square", k: 0.08, minGain: 3e-3 },
|
|
47581
|
+
choke: { voices: 2, fade: 0.05 }
|
|
47582
|
+
}
|
|
47583
|
+
};
|
|
47584
|
+
var SAMPLE_LEVELS = sample_levels_default;
|
|
47585
|
+
var gainOf = (gainDb) => 10 ** (gainDb / 20);
|
|
47586
|
+
var defaultsOf = (entry2) => ({
|
|
47587
|
+
bus: "weapons",
|
|
47588
|
+
gain: gainOf(entry2.gainDb),
|
|
47589
|
+
pitch: entry2.pitch,
|
|
47590
|
+
falloff: entry2.falloff,
|
|
47591
|
+
cutoffK: entry2.cutoffK,
|
|
47592
|
+
priority: entry2.priority,
|
|
47593
|
+
choke: entry2.choke
|
|
47594
|
+
});
|
|
47595
|
+
var CASING_DEFAULTS = defaultsOf(SAMPLE_LEVELS.casing);
|
|
47596
|
+
var MAGAZINE_DROP_DEFAULTS = defaultsOf(SAMPLE_LEVELS.magazine);
|
|
47597
|
+
var droppedPartDefaults = (id) => id.startsWith("casing_drop_") ? CASING_DEFAULTS : id.startsWith("mag_drop_") ? MAGAZINE_DROP_DEFAULTS : void 0;
|
|
46554
47598
|
|
|
46555
|
-
// ../game-audio/dist/chunk-
|
|
47599
|
+
// ../game-audio/dist/chunk-KGYMFUK7.js
|
|
46556
47600
|
var DISTANCE_CURVES = {
|
|
46557
47601
|
/** The game's `sfx`: `vol / (1 + d² × 0.004)`, cutoff `/ (1 + d × 0.01)`, silent below 0.01 (jogo L62091–62092, L62101). */
|
|
46558
47602
|
game_sfx: { model: "inverse_square", k: 4e-3, cutoffK: 0.01, minGain: 0.01 },
|
|
@@ -47256,8 +48300,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
47256
48300
|
const Constructor = scope2.AudioContext ?? scope2.webkitAudioContext;
|
|
47257
48301
|
return Constructor ? new Constructor() : null;
|
|
47258
48302
|
}
|
|
48303
|
+
function isLiveContext(context) {
|
|
48304
|
+
return typeof context.close === "function" && typeof context.resume === "function";
|
|
48305
|
+
}
|
|
47259
48306
|
function unlockContext(context) {
|
|
47260
|
-
if (context.state === "suspended" &&
|
|
48307
|
+
if (context.state === "suspended" && isLiveContext(context)) void context.resume();
|
|
47261
48308
|
}
|
|
47262
48309
|
var TRANSMISSION_LOSS = {
|
|
47263
48310
|
open: { lossDb: 0, thickness: 1 },
|
|
@@ -49145,7 +50192,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
49145
50192
|
for (const loop of [...loops]) loop.stop();
|
|
49146
50193
|
occluders?.clear();
|
|
49147
50194
|
active.clear();
|
|
49148
|
-
void context
|
|
50195
|
+
if (context && isLiveContext(context)) void context.close();
|
|
49149
50196
|
context = null;
|
|
49150
50197
|
chain = null;
|
|
49151
50198
|
busNodes.clear();
|
|
@@ -52371,7 +53418,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52371
53418
|
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
53419
|
var LAUNCH_IDS = /* @__PURE__ */ new Set(["launcher_40mm", "rocket_launch"]);
|
|
52373
53420
|
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
53421
|
var casingSampleId = (sample) => sample.replace(/_(pistol|rifle|shell)$/, "");
|
|
52376
53422
|
var RELOAD_SAMPLE_HITS = reload_sample_hits_default.hits;
|
|
52377
53423
|
var WEIGHT_INTENSITY = { light: 0.1, medium: 0.5, heavy: 0.9 };
|
|
@@ -52379,7 +53425,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52379
53425
|
var isGunshot = (id) => GUNSHOT_SAMPLE_IDS.includes(id);
|
|
52380
53426
|
function weaponSampleDefaults(sound3, overrides = {}) {
|
|
52381
53427
|
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 :
|
|
53428
|
+
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
53429
|
return { ...base, ...overrides[sound3.id] };
|
|
52384
53430
|
}
|
|
52385
53431
|
function weaponSampleBank(options) {
|
|
@@ -53710,7 +54756,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53710
54756
|
rules: { dropCapacity: 400, curbCatch: false, guardBehindWall: false, clipRoadEnd: false, dripStyle: "workshop" }
|
|
53711
54757
|
});
|
|
53712
54758
|
|
|
53713
|
-
// ../game-items-three/dist/chunk-
|
|
54759
|
+
// ../game-items-three/dist/chunk-V4L35AWB.js
|
|
53714
54760
|
var destruction_default = {
|
|
53715
54761
|
families: {
|
|
53716
54762
|
drink_can: {
|
|
@@ -54224,11 +55270,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54224
55270
|
id: "crowbar",
|
|
54225
55271
|
teamId: "pe_cabra",
|
|
54226
55272
|
teamBox: [
|
|
54227
|
-
0.
|
|
54228
|
-
1.
|
|
54229
|
-
0.
|
|
55273
|
+
0.3559,
|
|
55274
|
+
1.6698,
|
|
55275
|
+
0.068
|
|
54230
55276
|
],
|
|
54231
|
-
scale: 0.
|
|
55277
|
+
scale: 0.449156
|
|
54232
55278
|
},
|
|
54233
55279
|
{
|
|
54234
55280
|
id: "hammer",
|
|
@@ -56649,9 +57695,34 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56649
57695
|
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
57696
|
};
|
|
56651
57697
|
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
|
|
56653
|
-
|
|
56654
|
-
|
|
57698
|
+
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]];
|
|
57699
|
+
var BAR_RADIUS = 0.026;
|
|
57700
|
+
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]];
|
|
57701
|
+
var CHISEL_WIDTH = 0.06;
|
|
57702
|
+
var shapes = /* @__PURE__ */ new WeakMap();
|
|
57703
|
+
var shapesOf = (T2, extrude2) => {
|
|
57704
|
+
const cached = shapes.get(T2);
|
|
57705
|
+
if (cached) return cached;
|
|
57706
|
+
const curve = new T2.CatmullRomCurve3(CURVE.map((point) => new T2.Vector3(...point)));
|
|
57707
|
+
const bar2 = new T2.TubeGeometry(curve, 30, BAR_RADIUS, 6);
|
|
57708
|
+
const chisel = extrude2(CHISEL, CHISEL_WIDTH, 4e-3);
|
|
57709
|
+
chisel.translate(0, 0, -CHISEL_WIDTH / 2);
|
|
57710
|
+
markShared(bar2);
|
|
57711
|
+
markShared(chisel);
|
|
57712
|
+
const made = { bar: bar2, chisel };
|
|
57713
|
+
shapes.set(T2, made);
|
|
57714
|
+
return made;
|
|
57715
|
+
};
|
|
57716
|
+
var crowbar = ({ T: T2, mesh: mesh3, bx, extrude: extrude2, G, metal: metal2 }) => {
|
|
57717
|
+
const forged = metal2(7764863);
|
|
57718
|
+
const steel = metal2(9277844);
|
|
57719
|
+
const end3 = CURVE[CURVE.length - 1];
|
|
57720
|
+
const before = CURVE[CURVE.length - 2];
|
|
57721
|
+
const angle = Math.atan2(end3[1] - before[1], end3[0] - before[0]);
|
|
57722
|
+
const along = (distance4) => [end3[0] + Math.cos(angle) * distance4, end3[1] + Math.sin(angle) * distance4, 0];
|
|
57723
|
+
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]));
|
|
57724
|
+
const { bar: bar2, chisel } = shapesOf(T2, extrude2);
|
|
57725
|
+
return G(mesh3(bar2, forged), mesh3(chisel, steel), ...prongs);
|
|
56655
57726
|
};
|
|
56656
57727
|
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
57728
|
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 +62459,93 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61388
62459
|
};
|
|
61389
62460
|
|
|
61390
62461
|
// src/models/attachments/ugl.ts
|
|
61391
|
-
var
|
|
61392
|
-
|
|
61393
|
-
|
|
61394
|
-
|
|
62462
|
+
var PI15 = Math.PI;
|
|
62463
|
+
var clamp3 = (kit, fixed2, from, to) => {
|
|
62464
|
+
const { M, box: box5 } = kit;
|
|
62465
|
+
kit.roundness = 0.15;
|
|
62466
|
+
box5(fixed2, to - from, 0.022, 0.03, M.dark, (from + to) / 2, 9e-3, 0);
|
|
62467
|
+
kit.roundness = null;
|
|
62468
|
+
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
62469
|
};
|
|
61396
|
-
var
|
|
61397
|
-
const { M, box: box5
|
|
61398
|
-
const
|
|
61399
|
-
|
|
61400
|
-
|
|
61401
|
-
box5(
|
|
61402
|
-
|
|
61403
|
-
|
|
61404
|
-
|
|
62470
|
+
var pistolGrip = (kit, fixed2, top, length2) => {
|
|
62471
|
+
const { M, box: box5 } = kit;
|
|
62472
|
+
const grip = kit.pivot(fixed2, top[0], top[1], 0);
|
|
62473
|
+
grip.rotation.z = -0.3;
|
|
62474
|
+
kit.roundness = 0.3;
|
|
62475
|
+
box5(grip, 0.032, length2, 0.03, M.poly, -0.016, -length2 / 2, 0);
|
|
62476
|
+
kit.roundness = null;
|
|
62477
|
+
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);
|
|
62478
|
+
};
|
|
62479
|
+
var triggerGuard = (kit, fixed2, back, front, bottom) => {
|
|
62480
|
+
const { M, box: box5 } = kit;
|
|
62481
|
+
const drop = 0.03;
|
|
62482
|
+
box5(fixed2, front - back, 5e-3, 0.01, M.dark, (back + front) / 2, bottom - drop, 0);
|
|
62483
|
+
box5(fixed2, 5e-3, drop, 0.01, M.dark, front, bottom - drop / 2, 0);
|
|
62484
|
+
box5(fixed2, 5e-3, 0.02, 6e-3, M.metal, back + (front - back) * 0.45, bottom - 0.011, 0, 0.25);
|
|
62485
|
+
};
|
|
62486
|
+
var m203 = (kit, fixed2) => {
|
|
62487
|
+
const { M, box: box5 } = kit;
|
|
62488
|
+
const tube2 = { from: 0, to: 0.305, radius: 0.025, axisY: -0.03 };
|
|
62489
|
+
clamp3(kit, fixed2, -0.075, 0.29);
|
|
62490
|
+
kit.roundness = 0.18;
|
|
62491
|
+
box5(fixed2, 0.078, 0.056, 0.05, M.dark, -0.037, tube2.axisY + 2e-3, 0);
|
|
62492
|
+
kit.roundness = null;
|
|
62493
|
+
box5(fixed2, 0.02, 0.012, 0.052, M.metal, -0.07, tube2.axisY + 0.012, 0);
|
|
62494
|
+
triggerGuard(kit, fixed2, -0.07, -0.012, tube2.axisY - 0.026);
|
|
62495
|
+
return tube2;
|
|
62496
|
+
};
|
|
62497
|
+
var gp25 = (kit, fixed2) => {
|
|
62498
|
+
const { M, box: box5 } = kit;
|
|
62499
|
+
const tube2 = { from: 0.07, to: 0.275, radius: 0.024, axisY: -0.032 };
|
|
62500
|
+
clamp3(kit, fixed2, -0.04, 0.27);
|
|
62501
|
+
kit.roundness = 0.2;
|
|
62502
|
+
box5(fixed2, 0.125, 0.054, 0.046, M.metal, 0.012, tube2.axisY + 1e-3, 0);
|
|
62503
|
+
kit.roundness = null;
|
|
62504
|
+
box5(fixed2, 0.03, 0.026, 6e-3, M.dark, 0.03, tube2.axisY + 6e-3, -0.026);
|
|
62505
|
+
pistolGrip(kit, fixed2, [-0.012, tube2.axisY - 0.022], 0.1);
|
|
62506
|
+
box5(fixed2, 5e-3, 0.022, 6e-3, M.metal, 0.012, tube2.axisY - 0.034, 0, 0.3);
|
|
62507
|
+
box5(fixed2, 0.03, 4e-3, 8e-3, M.dark, 0.016, tube2.axisY - 0.046, 0);
|
|
62508
|
+
return tube2;
|
|
62509
|
+
};
|
|
62510
|
+
var ag36 = (kit, fixed2) => {
|
|
62511
|
+
const { M, box: box5 } = kit;
|
|
62512
|
+
const tube2 = { from: 0.04, to: 0.295, radius: 0.022, axisY: -0.066 };
|
|
62513
|
+
kit.roundness = 0.12;
|
|
62514
|
+
box5(fixed2, 0.315, 0.044, 0.05, M.poly, 0.13, -0.02, 0);
|
|
62515
|
+
box5(fixed2, 0.09, 0.03, 0.046, M.poly, 0.01, -0.054, 0);
|
|
62516
|
+
kit.roundness = null;
|
|
62517
|
+
clamp3(kit, fixed2, -0.02, 0.28);
|
|
62518
|
+
box5(fixed2, 0.24, 4e-3, 0.051, M.dark, 0.16, -0.03, 0);
|
|
62519
|
+
box5(fixed2, 0.04, 0.022, 5e-3, M.dark, 0.02, -8e-3, -0.028);
|
|
62520
|
+
pistolGrip(kit, fixed2, [-0.012, -0.069], 0.105);
|
|
62521
|
+
triggerGuard(kit, fixed2, 0, 0.06, -0.069);
|
|
62522
|
+
return tube2;
|
|
62523
|
+
};
|
|
62524
|
+
var LAUNCHERS = { m203, gp_25: gp25, ag36 };
|
|
62525
|
+
var drawTube = (kit, slide2, tube2, ribbed) => {
|
|
62526
|
+
const { M, box: box5, cylinderX } = kit;
|
|
62527
|
+
const length2 = tube2.to - tube2.from;
|
|
62528
|
+
cylinderX(slide2, tube2.radius, length2, M.metal, tube2.from + length2 / 2, tube2.axisY, 0, 24);
|
|
62529
|
+
if (ribbed) {
|
|
62530
|
+
cylinderX(slide2, tube2.radius * 1.1, length2 * 0.68, M.poly, tube2.from + length2 * 0.42, tube2.axisY, 0, 24);
|
|
62531
|
+
for (let i = 0; i < 9; i++) {
|
|
62532
|
+
for (const angle of [PI15 / 2, -PI15 / 2, PI15]) {
|
|
62533
|
+
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);
|
|
62534
|
+
}
|
|
62535
|
+
}
|
|
61405
62536
|
}
|
|
62537
|
+
cylinderX(slide2, tube2.radius * 1.08, 0.012, M.dark, tube2.to - 6e-3, tube2.axisY, 0, 24);
|
|
62538
|
+
cylinderX(slide2, tube2.radius * 0.8, 4e-3, M.hole, tube2.to + 5e-4, tube2.axisY, 0, 20);
|
|
62539
|
+
const muzzle2 = kit.mark(slide2, tube2.to + 0.01, tube2.axisY, 0);
|
|
62540
|
+
muzzle2.name = "ugl_muzzle";
|
|
62541
|
+
return muzzle2;
|
|
61406
62542
|
};
|
|
61407
62543
|
var buildUnderbarrelLauncher = ({ kit, attachment, slide: slide2 }) => {
|
|
61408
|
-
const
|
|
61409
|
-
if (!
|
|
61410
|
-
const { M, cylinderX } = kit;
|
|
61411
|
-
const length2 = attachment.dims?.length ?? 0.35;
|
|
62544
|
+
const draw2 = LAUNCHERS[attachment.model];
|
|
62545
|
+
if (!draw2 || !slide2) return null;
|
|
61412
62546
|
const fixed2 = kit.group();
|
|
61413
|
-
|
|
61414
|
-
const
|
|
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";
|
|
62547
|
+
const tube2 = draw2(kit, fixed2);
|
|
62548
|
+
const muzzle2 = drawTube(kit, slide2, tube2, attachment.model === "m203");
|
|
61421
62549
|
return {
|
|
61422
62550
|
object: fixed2,
|
|
61423
62551
|
muzzle: muzzle2,
|
|
@@ -63574,7 +64702,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63574
64702
|
var floor = call("floor");
|
|
63575
64703
|
var ceil = call("ceil");
|
|
63576
64704
|
var round4 = call("round");
|
|
63577
|
-
var
|
|
64705
|
+
var clamp4 = call("clamp");
|
|
63578
64706
|
var lerp2 = call("lerp");
|
|
63579
64707
|
var ease3 = call("ease");
|
|
63580
64708
|
var lt = call("lt");
|
|
@@ -64590,7 +65718,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
64590
65718
|
],
|
|
64591
65719
|
tick: [
|
|
64592
65720
|
when(query("cylinder", "live"), [
|
|
64593
|
-
set("jet",
|
|
65721
|
+
set("jet", clamp4(sub(1, div(sub(TIME, PUNCTURE_AT), JET_SECONDS)), 0, 1)),
|
|
64594
65722
|
behavior("cylinder", "step", { dt: DELTA, t: TIME }),
|
|
64595
65723
|
when(not(isOxygen), [
|
|
64596
65724
|
when(gt(jetStrength, 0), [
|
|
@@ -64965,7 +66093,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
64965
66093
|
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
66094
|
]),
|
|
64967
66095
|
when(and(gt(TIME, 3.5), lt(TIME, BOOM_AT)), [
|
|
64968
|
-
set("spread",
|
|
66096
|
+
set("spread", clamp4(div(sub(TIME, 3.5), 2.5), 0, 1)),
|
|
64969
66097
|
set("front", vlerp(POOL, TANK_FLOOR, mul(variable("spread"), 0.8))),
|
|
64970
66098
|
call2("fire_emit", "vz", variable("front"), add(0.6, mul(variable("spread"), 0.4)), 1.1, { smoke: 14 }),
|
|
64971
66099
|
call2("fire_emit", "vz2", POOL, 0.7, 0.8, { smoke: 6 }),
|
|
@@ -65141,7 +66269,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65141
66269
|
tick: [
|
|
65142
66270
|
set("nearest", 99),
|
|
65143
66271
|
repeat(WALKERS2, set("nearest", min(variable("nearest"), vdist(walkerPoint, CAMERA_POSITION)))),
|
|
65144
|
-
set("fear",
|
|
66272
|
+
set("fear", clamp4(div(sub(NEAR, variable("nearest")), RANGE), 0, 1)),
|
|
65145
66273
|
set("bpm", add(RESTING_BPM, mul(BPM_RISE, variable("fear")))),
|
|
65146
66274
|
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
66275
|
post({ tunnel: add(0.1, mul(0.65, variable("fear"))), desat: mul(0.45, variable("fear")) }),
|
|
@@ -65340,7 +66468,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65340
66468
|
timeline: [call2("chips", ORIGIN, UP11, 8, 0.9), call2("rust_at", ORIGIN, 6)]
|
|
65341
66469
|
}
|
|
65342
66470
|
];
|
|
65343
|
-
var
|
|
66471
|
+
var PI16 = Math.PI;
|
|
65344
66472
|
var SMOKE = { color: 9079430, width: 10, height: 8, gravity: -0.08, drag: 2.2, growth: 2.1 };
|
|
65345
66473
|
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
66474
|
var DEFAULT_SPREAD = { drift: 0.1, rise: 0.04, side: 0.06 };
|
|
@@ -65421,11 +66549,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65421
66549
|
],
|
|
65422
66550
|
timeline: [
|
|
65423
66551
|
set("angles", []),
|
|
65424
|
-
repeat(4, append("angles", add(div(mul(INDEX,
|
|
65425
|
-
set("roll", mul(rand(),
|
|
66552
|
+
repeat(4, append("angles", add(div(mul(INDEX, PI16), 2), mul(rand(), 0.6)))),
|
|
66553
|
+
set("roll", mul(rand(), PI16)),
|
|
65426
66554
|
when(gt(FLASH_SCALE, 0), [
|
|
65427
66555
|
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, -
|
|
66556
|
+
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
66557
|
repeat(
|
|
65430
66558
|
4,
|
|
65431
66559
|
set("angle", pick2(variable("angles"), INDEX)),
|
|
@@ -65435,7 +66563,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65435
66563
|
mul(0.04, SIZE, FLASH_SCALE),
|
|
65436
66564
|
6,
|
|
65437
66565
|
[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, -
|
|
66566
|
+
[variable("angle"), 0, -PI16 / 2],
|
|
65439
66567
|
16757575
|
|
65440
66568
|
)
|
|
65441
66569
|
),
|
|
@@ -66795,12 +67923,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66795
67923
|
return bands.scales[3];
|
|
66796
67924
|
}
|
|
66797
67925
|
var BLOOD_LIMIT = 450;
|
|
67926
|
+
var SCRAPE_LIMIT = 400;
|
|
66798
67927
|
var SCORCH_VARIANTS = 3;
|
|
66799
67928
|
var RIM_COLORS = [2829359, 3815478];
|
|
66800
67929
|
function createMarkStore() {
|
|
66801
67930
|
const entries2 = [];
|
|
66802
67931
|
let version = 0;
|
|
66803
67932
|
let bloodCount = 0;
|
|
67933
|
+
let scrapeCount = 0;
|
|
66804
67934
|
const listeners = /* @__PURE__ */ new Set();
|
|
66805
67935
|
return {
|
|
66806
67936
|
entries: entries2,
|
|
@@ -66810,16 +67940,25 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66810
67940
|
get bloodCount() {
|
|
66811
67941
|
return bloodCount;
|
|
66812
67942
|
},
|
|
67943
|
+
get scrapeCount() {
|
|
67944
|
+
return scrapeCount;
|
|
67945
|
+
},
|
|
66813
67946
|
lift: 0,
|
|
66814
67947
|
add(mark) {
|
|
67948
|
+
if (mark.kind === "scrape" && scrapeCount >= SCRAPE_LIMIT) {
|
|
67949
|
+
entries2.splice(entries2.findIndex((m) => m.kind === "scrape"), 1);
|
|
67950
|
+
scrapeCount--;
|
|
67951
|
+
}
|
|
66815
67952
|
entries2.push(mark);
|
|
66816
67953
|
if (mark.kind === "blood") bloodCount++;
|
|
67954
|
+
if (mark.kind === "scrape") scrapeCount++;
|
|
66817
67955
|
version++;
|
|
66818
67956
|
for (const listener of listeners) listener({ type: "add", mark });
|
|
66819
67957
|
},
|
|
66820
67958
|
clear() {
|
|
66821
67959
|
entries2.length = 0;
|
|
66822
67960
|
bloodCount = 0;
|
|
67961
|
+
scrapeCount = 0;
|
|
66823
67962
|
this.lift = 0;
|
|
66824
67963
|
version++;
|
|
66825
67964
|
for (const listener of listeners) listener({ type: "clear" });
|
|
@@ -66879,6 +68018,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66879
68018
|
const scaleZ = spec.radius * random.between(1.2, 2);
|
|
66880
68019
|
store.add({ kind: "blood", x: spec.x, y, z: spec.z, scaleX, scaleZ, rotation: random.next() * 6 });
|
|
66881
68020
|
}
|
|
68021
|
+
function addScrape(store, spec) {
|
|
68022
|
+
store.add({ kind: "scrape", ...spec, y: spec.y + 2e-3 + nextLift(store) * 2e-4 });
|
|
68023
|
+
}
|
|
66882
68024
|
function createRingPool(capacity) {
|
|
66883
68025
|
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
68026
|
}
|
|
@@ -67427,7 +68569,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67427
68569
|
state.beat *= Math.exp(-DECAY.beat * dt);
|
|
67428
68570
|
}
|
|
67429
68571
|
var PAD_OF_SIZE2 = 0.35;
|
|
67430
|
-
var
|
|
68572
|
+
var clamp42 = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
|
|
67431
68573
|
var lerp4 = (a, b, t) => a + (b - a) * t;
|
|
67432
68574
|
function rgb(hex2) {
|
|
67433
68575
|
return [(hex2 >> 16 & 255) / 255, (hex2 >> 8 & 255) / 255, (hex2 & 255) / 255];
|
|
@@ -67634,7 +68776,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67634
68776
|
this.color[i3 + 2] = lerp4(this.rgbStart[i3 + 2], this.rgbEnd[i3 + 2], t);
|
|
67635
68777
|
let envelope2 = t < def.fadeIn ? t / def.fadeIn : 1 - (t - def.fadeIn) / (1 - def.fadeIn);
|
|
67636
68778
|
if (def.flicker) envelope2 *= 1 - def.flicker * (0.5 + 0.5 * Math.sin(age * 38 + this.seed[i] * 50));
|
|
67637
|
-
this.alpha[i] =
|
|
68779
|
+
this.alpha[i] = clamp42(envelope2, 0, 1) * def.alpha * this.alphaMul[i];
|
|
67638
68780
|
top = i + 1;
|
|
67639
68781
|
}
|
|
67640
68782
|
this.high = top;
|
|
@@ -68076,7 +69218,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68076
69218
|
var tangentA = { x: 0, y: 0, z: 0 };
|
|
68077
69219
|
var tangentB = { x: 0, y: 0, z: 0 };
|
|
68078
69220
|
var axis = { x: 0, y: 0, z: 0 };
|
|
68079
|
-
function
|
|
69221
|
+
function cross3(out, a, b) {
|
|
68080
69222
|
const x = a.y * b.z - a.z * b.y;
|
|
68081
69223
|
const y = a.z * b.x - a.x * b.z;
|
|
68082
69224
|
const z = a.x * b.y - a.y * b.x;
|
|
@@ -68101,8 +69243,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68101
69243
|
tangentA.x = 0;
|
|
68102
69244
|
tangentA.y = 1;
|
|
68103
69245
|
}
|
|
68104
|
-
normalize2(
|
|
68105
|
-
normalize2(
|
|
69246
|
+
normalize2(cross3(tangentB, axis, tangentA));
|
|
69247
|
+
normalize2(cross3(tangentA, tangentB, axis));
|
|
68106
69248
|
out.x = dx * cosTilt;
|
|
68107
69249
|
out.y = dy * cosTilt;
|
|
68108
69250
|
out.z = dz * cosTilt;
|
|
@@ -69177,6 +70319,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
69177
70319
|
}),
|
|
69178
70320
|
fires: () => core.fires.items,
|
|
69179
70321
|
onMarks: (listener) => core.marks.subscribe(listener),
|
|
70322
|
+
scrape: (mark) => addScrape(core.marks, mark),
|
|
69180
70323
|
time: () => core.clock.time,
|
|
69181
70324
|
randomState: () => sharedRandom.state,
|
|
69182
70325
|
clear() {
|
|
@@ -69199,7 +70342,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
69199
70342
|
};
|
|
69200
70343
|
}
|
|
69201
70344
|
|
|
69202
|
-
// ../game-vfx-three/dist/chunk-
|
|
70345
|
+
// ../game-vfx-three/dist/chunk-PZ6IVOLZ.js
|
|
69203
70346
|
var GLOW_VERTEX = `attribute vec4 aP;attribute vec4 aC;varying vec2 vU;varying vec4 vC;
|
|
69204
70347
|
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
70348
|
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 +70570,7 @@ void main(){
|
|
|
69427
70570
|
}
|
|
69428
70571
|
};
|
|
69429
70572
|
}
|
|
69430
|
-
function createChunkLayer(THREE, pool,
|
|
70573
|
+
function createChunkLayer(THREE, pool, shapes2, colorOf) {
|
|
69431
70574
|
const capacity = pool.capacity;
|
|
69432
70575
|
const rockMaterial = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.85, flatShading: true });
|
|
69433
70576
|
const plateMaterial = rockMaterial.clone();
|
|
@@ -69441,8 +70584,8 @@ void main(){
|
|
|
69441
70584
|
mesh3.setColorAt(0, new THREE.Color(1, 1, 1));
|
|
69442
70585
|
return mesh3;
|
|
69443
70586
|
};
|
|
69444
|
-
const rocks = make3(
|
|
69445
|
-
const plates = make3(
|
|
70587
|
+
const rocks = make3(shapes2.rock, rockMaterial);
|
|
70588
|
+
const plates = make3(shapes2.plate, plateMaterial);
|
|
69446
70589
|
const matrix = new THREE.Matrix4();
|
|
69447
70590
|
const quaternion2 = new THREE.Quaternion();
|
|
69448
70591
|
const euler = new THREE.Euler();
|
|
@@ -69679,6 +70822,9 @@ void main(){
|
|
|
69679
70822
|
const bloodMaterial = new THREE.MeshStandardMaterial({ color: 6031882, roughness: 0.15, metalness: 0.1, polygonOffset: true, polygonOffsetFactor: -3, polygonOffsetUnits: -3 });
|
|
69680
70823
|
const bloodGeometry = new THREE.CircleGeometry(0.5, 9).rotateX(-Math.PI / 2);
|
|
69681
70824
|
owned.push(bloodMaterial, bloodGeometry);
|
|
70825
|
+
const scrapeMaterial = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.6, transparent: true, opacity: 0.55, depthWrite: false, polygonOffset: true, polygonOffsetFactor: -4, polygonOffsetUnits: -4 });
|
|
70826
|
+
const scrapeGeometry = new THREE.PlaneGeometry(1, 1).rotateX(-Math.PI / 2);
|
|
70827
|
+
owned.push(scrapeMaterial, scrapeGeometry);
|
|
69682
70828
|
const maxGroundMarks = options.maxGroundMarks ?? DEFAULT_MAX_GROUND_MARKS;
|
|
69683
70829
|
const instanced = {};
|
|
69684
70830
|
function rockMaterial() {
|
|
@@ -69691,6 +70837,9 @@ void main(){
|
|
|
69691
70837
|
function bloodMesh() {
|
|
69692
70838
|
return instanced.blood ?? (instanced.blood = attach(createInstanced(bloodGeometry, bloodMaterial, options.maxBlood ?? DEFAULT_MAX_BLOOD)));
|
|
69693
70839
|
}
|
|
70840
|
+
function scrapeMesh() {
|
|
70841
|
+
return instanced.scrape ?? (instanced.scrape = attach(createInstanced(scrapeGeometry, scrapeMaterial, SCRAPE_LIMIT)));
|
|
70842
|
+
}
|
|
69694
70843
|
function rockMesh() {
|
|
69695
70844
|
return instanced.rock ?? (instanced.rock = attach(createInstanced(options.rockGeometry, rockMaterial(), options.maxRocks ?? DEFAULT_MAX_ROCKS), true));
|
|
69696
70845
|
}
|
|
@@ -69706,7 +70855,7 @@ void main(){
|
|
|
69706
70855
|
const groundMarks = [];
|
|
69707
70856
|
const spareGeometries = [];
|
|
69708
70857
|
const blood = [];
|
|
69709
|
-
const placed = { blood: 0, rock: 0, plate: 0 };
|
|
70858
|
+
const placed = { blood: 0, rock: 0, plate: 0, scrape: 0 };
|
|
69710
70859
|
const matrix = new THREE.Matrix4();
|
|
69711
70860
|
const position = new THREE.Vector3();
|
|
69712
70861
|
const quaternion2 = new THREE.Quaternion();
|
|
@@ -69793,10 +70942,21 @@ void main(){
|
|
|
69793
70942
|
writeBlood(index, drawn, BLOOD_START_GROWTH);
|
|
69794
70943
|
bloodMesh().count = Math.min(placed.blood, bloodMesh().instanceMatrix.count);
|
|
69795
70944
|
}
|
|
70945
|
+
function addScrape2(mark) {
|
|
70946
|
+
const mesh3 = scrapeMesh();
|
|
70947
|
+
const index = placed.scrape++ % mesh3.instanceMatrix.count;
|
|
70948
|
+
quaternion2.setFromAxisAngle(up, -mark.rotation);
|
|
70949
|
+
mesh3.setMatrixAt(index, matrix.compose(position.set(mark.x, mark.y, mark.z), quaternion2, scale.set(mark.length, 1, mark.width)));
|
|
70950
|
+
mesh3.setColorAt(index, color2.set(mark.color));
|
|
70951
|
+
mesh3.count = Math.min(placed.scrape, mesh3.instanceMatrix.count);
|
|
70952
|
+
mesh3.instanceMatrix.needsUpdate = true;
|
|
70953
|
+
mesh3.instanceColor.needsUpdate = true;
|
|
70954
|
+
}
|
|
69796
70955
|
function build(mark) {
|
|
69797
70956
|
if (mark.kind === "scorch") conform(mark, scorchMaterials[mark.variant]);
|
|
69798
70957
|
else if (mark.kind === "dirt") conform(mark, dirtMaterial);
|
|
69799
70958
|
else if (mark.kind === "rock") addRock(mark);
|
|
70959
|
+
else if (mark.kind === "scrape") addScrape2(mark);
|
|
69800
70960
|
else addBlood(mark);
|
|
69801
70961
|
}
|
|
69802
70962
|
function clearMarks() {
|
|
@@ -69806,8 +70966,8 @@ void main(){
|
|
|
69806
70966
|
for (const geometry of spareGeometries) geometry.dispose();
|
|
69807
70967
|
spareGeometries.length = 0;
|
|
69808
70968
|
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;
|
|
70969
|
+
placed.blood = placed.rock = placed.plate = placed.scrape = 0;
|
|
70970
|
+
for (const mesh3 of [instanced.blood, instanced.rock, instanced.plate, instanced.scrape]) if (mesh3) mesh3.count = 0;
|
|
69811
70971
|
}
|
|
69812
70972
|
return {
|
|
69813
70973
|
group,
|
|
@@ -69819,6 +70979,7 @@ void main(){
|
|
|
69819
70979
|
bloodMesh();
|
|
69820
70980
|
rockMesh();
|
|
69821
70981
|
plateMesh();
|
|
70982
|
+
scrapeMesh();
|
|
69822
70983
|
},
|
|
69823
70984
|
probes() {
|
|
69824
70985
|
probeGeometry ?? (probeGeometry = new THREE.PlaneGeometry(1e-3, 1e-3).rotateX(-Math.PI / 2));
|
|
@@ -69837,10 +70998,10 @@ void main(){
|
|
|
69837
70998
|
writeBlood(index, drawn, Math.max(BLOOD_START_GROWTH, 1 - Math.pow(1 - Math.min(1, drawn.age), 2.5)));
|
|
69838
70999
|
}
|
|
69839
71000
|
},
|
|
69840
|
-
count: () => groundMarks.length + [instanced.blood, instanced.rock, instanced.plate].filter((mesh3) => mesh3 && mesh3.count > 0).length,
|
|
71001
|
+
count: () => groundMarks.length + [instanced.blood, instanced.rock, instanced.plate, instanced.scrape].filter((mesh3) => mesh3 && mesh3.count > 0).length,
|
|
69841
71002
|
dispose() {
|
|
69842
71003
|
clearMarks();
|
|
69843
|
-
for (const mesh3 of [instanced.blood, instanced.rock, instanced.plate]) mesh3?.dispose();
|
|
71004
|
+
for (const mesh3 of [instanced.blood, instanced.rock, instanced.plate, instanced.scrape]) mesh3?.dispose();
|
|
69844
71005
|
probeGeometry?.dispose();
|
|
69845
71006
|
for (const item of owned) item.dispose();
|
|
69846
71007
|
}
|
|
@@ -70715,7 +71876,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
70715
71876
|
}
|
|
70716
71877
|
|
|
70717
71878
|
// src/fx/heavy.ts
|
|
70718
|
-
var
|
|
71879
|
+
var PI17 = Math.PI;
|
|
70719
71880
|
var ROCKET_LIGHT_NAME = "rocket-light";
|
|
70720
71881
|
var ROCKET_LIGHT_COLOR = 16751168;
|
|
70721
71882
|
var ROCKET_LIGHT_INTENSITY = 3;
|
|
@@ -70760,7 +71921,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
70760
71921
|
rocket.position.copy(muzzle2);
|
|
70761
71922
|
scene.add(rocket);
|
|
70762
71923
|
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 =
|
|
71924
|
+
exhaust.rotation.z = PI17 / 2;
|
|
70764
71925
|
exhaust.position.x = -0.08;
|
|
70765
71926
|
rocket.add(exhaust);
|
|
70766
71927
|
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 +72154,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
70993
72154
|
};
|
|
70994
72155
|
|
|
70995
72156
|
// src/fx/viewmodel-events.ts
|
|
70996
|
-
var
|
|
72157
|
+
var PI18 = Math.PI;
|
|
70997
72158
|
var UGL_FLASH = 1.6;
|
|
70998
72159
|
var restFlat = (object2) => {
|
|
70999
72160
|
object2.rotation.x = 0;
|
|
@@ -71068,14 +72229,14 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
71068
72229
|
root.updateWorldMatrix(true, true);
|
|
71069
72230
|
const copy2 = parts.mag.clone(true);
|
|
71070
72231
|
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,
|
|
72232
|
+
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
72233
|
};
|
|
71073
72234
|
const stuckCase = () => {
|
|
71074
72235
|
if (!session.cartridge || !parts.eject) return;
|
|
71075
72236
|
const casing2 = buildCasing(kit, session.cartridge.dims, session.cartridge.shape);
|
|
71076
72237
|
const at4 = root.worldToLocal(offsetFrom(positionOf3(parts.eject), 0, casing2.length * 0.35, 0));
|
|
71077
72238
|
casing2.group.position.copy(at4);
|
|
71078
|
-
casing2.group.rotation.set(0, 0,
|
|
72239
|
+
casing2.group.rotation.set(0, 0, PI18 / 2 - 0.25);
|
|
71079
72240
|
root.add(casing2.group);
|
|
71080
72241
|
session.stuckCase = casing2.group;
|
|
71081
72242
|
};
|
|
@@ -71640,7 +72801,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
71640
72801
|
}
|
|
71641
72802
|
|
|
71642
72803
|
// src/fx/viewmodel.ts
|
|
71643
|
-
var
|
|
72804
|
+
var PI19 = Math.PI;
|
|
71644
72805
|
var HEAT_DISPLAY_MAX_FALLBACK = 750;
|
|
71645
72806
|
var SMOKE_WISPS_PER_SECOND = 10;
|
|
71646
72807
|
var SMOKE_THICKNESS_GAIN = 1.7;
|
|
@@ -71650,7 +72811,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
71650
72811
|
var fittedOf2 = (parts) => parts.map((part) => ({ id: part.id, mount: part.mount, ...part.integral ? { integral: true } : {}, ...part.on === void 0 ? {} : { on: part.on } }));
|
|
71651
72812
|
var collapsedStockPose = (move2) => {
|
|
71652
72813
|
if (move2.kind === "retract") return { position: [move2.travel, 0, 0] };
|
|
71653
|
-
return { rotation: [move2.axis === "x" ?
|
|
72814
|
+
return { rotation: [move2.axis === "x" ? PI19 : 0, move2.axis === "y" ? PI19 : 0, move2.axis === "z" ? PI19 : 0] };
|
|
71654
72815
|
};
|
|
71655
72816
|
var underbarrelStep = (step, tool2) => tool2.underbarrelActive && step.type === "play" && (step.clip === "shot" || step.clip === "reload") ? { ...step, variant: "ugl" } : step;
|
|
71656
72817
|
var caliberOf = (arsenal, def) => def.action.kind === "firearm" ? arsenal.calibers.get(def.action.caliber) : void 0;
|
|
@@ -71703,7 +72864,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
71703
72864
|
const rocketLight = options.lights ? void 0 : createRocketLight(THREE);
|
|
71704
72865
|
if (rocketLight) scene.add(rocketLight);
|
|
71705
72866
|
const holder = new THREE.Group();
|
|
71706
|
-
holder.quaternion.setFromAxisAngle(new THREE.Vector3(0, 1, 0),
|
|
72867
|
+
holder.quaternion.setFromAxisAngle(new THREE.Vector3(0, 1, 0), PI19 / 2);
|
|
71707
72868
|
hand.add(holder);
|
|
71708
72869
|
let tasks = [];
|
|
71709
72870
|
let stockRig = null;
|
|
@@ -71916,7 +73077,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
71916
73077
|
const liftToKeepInView = () => {
|
|
71917
73078
|
const held = heldHold();
|
|
71918
73079
|
if (!held || !session || !("fov" in camera2)) return 0;
|
|
71919
|
-
const tanHalf = Math.tan((camera2.fov ?? 70) *
|
|
73080
|
+
const tanHalf = Math.tan((camera2.fov ?? 70) * PI19 / 360);
|
|
71920
73081
|
eyeTurn.copy(camera2.quaternion).invert();
|
|
71921
73082
|
const rest2 = targetsOf(THREE, held, session.model.root.getWorldQuaternion(rootQuaternion), 0);
|
|
71922
73083
|
let needed = 0;
|