@adatechnology/game-weapons-three 0.29.10 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/weapon-svg/CREDITS.md +1 -1
- package/assets/weapon-svg/credits.html +1 -1
- package/assets/weapon-svg/generated/beretta_92fs.svg +1 -1
- package/assets/weapon-svg/generated/colt_m1911.svg +1 -1
- package/assets/weapon-svg/generated/colt_python.svg +1 -1
- package/assets/weapon-svg/generated/cz_75.svg +1 -1
- package/assets/weapon-svg/generated/desert_eagle_mark_xix.svg +1 -1
- package/assets/weapon-svg/generated/fists.svg +1 -0
- package/assets/weapon-svg/generated/fn_five_seven.svg +1 -1
- package/assets/weapon-svg/generated/glock_17.svg +1 -1
- package/assets/weapon-svg/generated/glock_18.svg +1 -1
- package/assets/weapon-svg/generated/glock_19.svg +1 -1
- package/assets/weapon-svg/generated/hand.svg +1 -0
- package/assets/weapon-svg/generated/hk_usp.svg +1 -1
- package/assets/weapon-svg/generated/kel_tec_ksg.svg +1 -1
- package/assets/weapon-svg/generated/kick.svg +1 -0
- package/assets/weapon-svg/generated/kriss_vector.svg +1 -1
- package/assets/weapon-svg/generated/makarov_pm.svg +1 -1
- package/assets/weapon-svg/generated/pistol_45.svg +1 -1
- package/assets/weapon-svg/generated/pistol_9mm.svg +1 -1
- package/assets/weapon-svg/generated/revolver_357.svg +1 -1
- package/assets/weapon-svg/generated/revolver_38.svg +1 -1
- package/assets/weapon-svg/generated/shove.svg +1 -0
- package/assets/weapon-svg/generated/sig_sauer_p226.svg +1 -1
- package/assets/weapon-svg/generated/sig_sauer_p320.svg +1 -1
- package/assets/weapon-svg/generated/sw_686.svg +1 -1
- package/assets/weapon-svg/generated/sw_model_29.svg +1 -1
- package/assets/weapon-svg/generated/taurus_82.svg +1 -1
- package/assets/weapon-svg/generated/taurus_g2c.svg +1 -1
- package/assets/weapon-svg/generated/taurus_pt100.svg +1 -1
- package/assets/weapon-svg/generated/taurus_th380.svg +1 -1
- package/assets/weapon-svg/generated/taurus_ts9.svg +1 -1
- package/assets/weapon-svg/generated/walther_p99.svg +1 -1
- package/assets/weapon-svg/manifest.json +16 -0
- package/dist/{chunk-WAZHNY5J.js → chunk-RAWW6JTZ.js} +333 -95
- package/dist/chunk-RAWW6JTZ.js.map +1 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.global.js +1104 -545
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +47 -1
- package/dist/index.js.map +1 -1
- package/dist/{testing-Bk34V-6X.d.ts → testing-44lDo2Cx.d.ts} +34 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +15 -14
- package/dist/chunk-WAZHNY5J.js.map +0 -1
package/dist/index.global.js
CHANGED
|
@@ -62,6 +62,7 @@ var GameWeaponsThree = (() => {
|
|
|
62
62
|
WORLD_EXPLOSIVE_IDS: () => WORLD_EXPLOSIVE_IDS,
|
|
63
63
|
WORLD_EXPLOSIVE_PREFIX: () => WORLD_EXPLOSIVE_PREFIX,
|
|
64
64
|
applyCondition: () => applyCondition,
|
|
65
|
+
buildBodyActionModel: () => buildBodyActionModel,
|
|
65
66
|
buildCartridge: () => buildCartridge,
|
|
66
67
|
buildCasing: () => buildCasing,
|
|
67
68
|
buildExplosiveModel: () => buildExplosiveModel,
|
|
@@ -365,6 +366,7 @@ var GameWeaponsThree = (() => {
|
|
|
365
366
|
return void 0;
|
|
366
367
|
};
|
|
367
368
|
var FIRST_PERSON_LAYER = 9;
|
|
369
|
+
var CARRY_HANDLE_TAG = "carryHandle";
|
|
368
370
|
var TOOL_CLIP = {
|
|
369
371
|
DRAW: "draw",
|
|
370
372
|
SHOT: "shot",
|
|
@@ -19349,28 +19351,29 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19349
19351
|
}
|
|
19350
19352
|
function catenary(a, b, sag, n = 12) {
|
|
19351
19353
|
const count = Math.max(2, Math.floor(n));
|
|
19352
|
-
const span =
|
|
19353
|
-
const depth = Math.max(0, sag);
|
|
19354
|
+
const { span, c } = catenaryOf(a[0], a[1], a[2], b[0], b[1], b[2], sag);
|
|
19354
19355
|
const out = [];
|
|
19355
|
-
let shape = () => 0;
|
|
19356
|
-
if (depth > 1e-6 && span > 1e-6) {
|
|
19357
|
-
let lo = 1e-4;
|
|
19358
|
-
let hi = span * 1e3;
|
|
19359
|
-
for (let i = 0; i < 80; i++) {
|
|
19360
|
-
const c2 = (lo + hi) / 2;
|
|
19361
|
-
const d = c2 * (Math.cosh(span / (2 * c2)) - 1);
|
|
19362
|
-
if (d > depth) lo = c2;
|
|
19363
|
-
else hi = c2;
|
|
19364
|
-
}
|
|
19365
|
-
const c = (lo + hi) / 2;
|
|
19366
|
-
shape = (s) => c * (Math.cosh((s - 0.5) * span / c) - Math.cosh(span / (2 * c)));
|
|
19367
|
-
}
|
|
19368
19356
|
for (let i = 0; i < count; i++) {
|
|
19369
19357
|
const s = i / (count - 1);
|
|
19370
|
-
out.push([a[0] + (b[0] - a[0]) * s, a[1] + (b[1] - a[1]) * s +
|
|
19358
|
+
out.push([a[0] + (b[0] - a[0]) * s, a[1] + (b[1] - a[1]) * s + catenaryDrop(span, c, s), a[2] + (b[2] - a[2]) * s]);
|
|
19371
19359
|
}
|
|
19372
19360
|
return out;
|
|
19373
19361
|
}
|
|
19362
|
+
var catenaryOf = (ax, ay, az, bx, by, bz, sag) => {
|
|
19363
|
+
const span = Math.hypot(bx - ax, bz - az) || Math.hypot(bx - ax, by - ay, bz - az);
|
|
19364
|
+
const depth = Math.max(0, sag);
|
|
19365
|
+
if (depth <= 1e-6 || span <= 1e-6) return { span, c: 0 };
|
|
19366
|
+
let lo = 1e-4;
|
|
19367
|
+
let hi = span * 1e3;
|
|
19368
|
+
for (let i = 0; i < 80; i++) {
|
|
19369
|
+
const c = (lo + hi) / 2;
|
|
19370
|
+
const d = c * (Math.cosh(span / (2 * c)) - 1);
|
|
19371
|
+
if (d > depth) lo = c;
|
|
19372
|
+
else hi = c;
|
|
19373
|
+
}
|
|
19374
|
+
return { span, c: (lo + hi) / 2 };
|
|
19375
|
+
};
|
|
19376
|
+
var catenaryDrop = (span, c, s) => c > 0 ? c * (Math.cosh((s - 0.5) * span / c) - Math.cosh(span / (2 * c))) : 0;
|
|
19374
19377
|
function createCord(THREE, points, radius, material, radialSegments = 5) {
|
|
19375
19378
|
if (points.length < 2) throw new Error("createCord needs at least two points");
|
|
19376
19379
|
const curve = new THREE.CatmullRomCurve3(points.map((p) => new THREE.Vector3(p[0], p[1], p[2])), false, "centripetal");
|
|
@@ -19380,6 +19383,96 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19380
19383
|
mesh3.castShadow = true;
|
|
19381
19384
|
return mesh3;
|
|
19382
19385
|
}
|
|
19386
|
+
function createHangingCord(THREE, options) {
|
|
19387
|
+
const segments = Math.max(1, Math.floor(options.segments));
|
|
19388
|
+
const radial = Math.max(3, Math.floor(options.radialSegments ?? 5));
|
|
19389
|
+
const ring22 = radial + 1;
|
|
19390
|
+
const positions2 = new Float32Array((segments + 1) * ring22 * 3);
|
|
19391
|
+
const normals = new Float32Array((segments + 1) * ring22 * 3);
|
|
19392
|
+
const index = [];
|
|
19393
|
+
for (let i = 0; i < segments; i++) {
|
|
19394
|
+
for (let j = 0; j < radial; j++) {
|
|
19395
|
+
const a = i * ring22 + j;
|
|
19396
|
+
const b = (i + 1) * ring22 + j;
|
|
19397
|
+
index.push(a, b, a + 1, b, b + 1, a + 1);
|
|
19398
|
+
}
|
|
19399
|
+
}
|
|
19400
|
+
const geometry = new THREE.BufferGeometry();
|
|
19401
|
+
const positionAttribute = new THREE.BufferAttribute(positions2, 3);
|
|
19402
|
+
const normalAttribute = new THREE.BufferAttribute(normals, 3);
|
|
19403
|
+
geometry.setAttribute("position", positionAttribute);
|
|
19404
|
+
geometry.setAttribute("normal", normalAttribute);
|
|
19405
|
+
geometry.setIndex(index);
|
|
19406
|
+
const sphere2 = new THREE.Sphere();
|
|
19407
|
+
geometry.boundingSphere = sphere2;
|
|
19408
|
+
const mesh3 = new THREE.Mesh(geometry, options.material);
|
|
19409
|
+
mesh3.name = "cord";
|
|
19410
|
+
mesh3.castShadow = true;
|
|
19411
|
+
const centre = new Float64Array((segments + 1) * 3);
|
|
19412
|
+
const tangent = new THREE.Vector3();
|
|
19413
|
+
const normal = new THREE.Vector3();
|
|
19414
|
+
const binormal = new THREE.Vector3();
|
|
19415
|
+
const previous = new THREE.Vector3();
|
|
19416
|
+
const low = new THREE.Vector3();
|
|
19417
|
+
const high = new THREE.Vector3();
|
|
19418
|
+
const tangentAt = (i) => {
|
|
19419
|
+
const from = Math.max(0, i - 1);
|
|
19420
|
+
const to = Math.min(segments, i + 1);
|
|
19421
|
+
tangent.set(centre[to * 3] - centre[from * 3], centre[to * 3 + 1] - centre[from * 3 + 1], centre[to * 3 + 2] - centre[from * 3 + 2]).normalize();
|
|
19422
|
+
};
|
|
19423
|
+
return {
|
|
19424
|
+
mesh: mesh3,
|
|
19425
|
+
hang(a, b, sag) {
|
|
19426
|
+
const { span, c } = catenaryOf(a.x, a.y, a.z, b.x, b.y, b.z, sag);
|
|
19427
|
+
for (let i = 0; i <= segments; i++) {
|
|
19428
|
+
const s = i / segments;
|
|
19429
|
+
centre[i * 3] = a.x + (b.x - a.x) * s;
|
|
19430
|
+
centre[i * 3 + 1] = a.y + (b.y - a.y) * s + catenaryDrop(span, c, s);
|
|
19431
|
+
centre[i * 3 + 2] = a.z + (b.z - a.z) * s;
|
|
19432
|
+
}
|
|
19433
|
+
low.set(Infinity, Infinity, Infinity);
|
|
19434
|
+
high.set(-Infinity, -Infinity, -Infinity);
|
|
19435
|
+
for (let i = 0; i <= segments; i++) {
|
|
19436
|
+
tangentAt(i);
|
|
19437
|
+
if (i === 0) {
|
|
19438
|
+
const ax = Math.abs(tangent.x);
|
|
19439
|
+
const ay = Math.abs(tangent.y);
|
|
19440
|
+
const az = Math.abs(tangent.z);
|
|
19441
|
+
normal.set(ax <= ay && ax <= az ? 1 : 0, ay < ax && ay <= az ? 1 : 0, az < ax && az < ay ? 1 : 0);
|
|
19442
|
+
normal.sub(binormal.copy(tangent).multiplyScalar(normal.dot(tangent))).normalize();
|
|
19443
|
+
} else {
|
|
19444
|
+
normal.copy(previous).sub(binormal.copy(tangent).multiplyScalar(previous.dot(tangent))).normalize();
|
|
19445
|
+
}
|
|
19446
|
+
previous.copy(normal);
|
|
19447
|
+
binormal.crossVectors(tangent, normal);
|
|
19448
|
+
const px = centre[i * 3];
|
|
19449
|
+
const py = centre[i * 3 + 1];
|
|
19450
|
+
const pz = centre[i * 3 + 2];
|
|
19451
|
+
for (let j = 0; j <= radial; j++) {
|
|
19452
|
+
const angle = j / radial * Math.PI * 2;
|
|
19453
|
+
const cos2 = Math.cos(angle);
|
|
19454
|
+
const sin2 = -Math.sin(angle);
|
|
19455
|
+
const nx = cos2 * normal.x + sin2 * binormal.x;
|
|
19456
|
+
const ny = cos2 * normal.y + sin2 * binormal.y;
|
|
19457
|
+
const nz = cos2 * normal.z + sin2 * binormal.z;
|
|
19458
|
+
const at4 = (i * ring22 + j) * 3;
|
|
19459
|
+
normals[at4] = nx;
|
|
19460
|
+
normals[at4 + 1] = ny;
|
|
19461
|
+
normals[at4 + 2] = nz;
|
|
19462
|
+
positions2[at4] = px + options.radius * nx;
|
|
19463
|
+
positions2[at4 + 1] = py + options.radius * ny;
|
|
19464
|
+
positions2[at4 + 2] = pz + options.radius * nz;
|
|
19465
|
+
}
|
|
19466
|
+
low.set(Math.min(low.x, px), Math.min(low.y, py), Math.min(low.z, pz));
|
|
19467
|
+
high.set(Math.max(high.x, px), Math.max(high.y, py), Math.max(high.z, pz));
|
|
19468
|
+
}
|
|
19469
|
+
positionAttribute.needsUpdate = true;
|
|
19470
|
+
normalAttribute.needsUpdate = true;
|
|
19471
|
+
sphere2.center.addVectors(low, high).multiplyScalar(0.5);
|
|
19472
|
+
sphere2.radius = sphere2.center.distanceTo(high) + options.radius;
|
|
19473
|
+
}
|
|
19474
|
+
};
|
|
19475
|
+
}
|
|
19383
19476
|
var isTexture = (v) => !!v && typeof v === "object" && v.isTexture === true;
|
|
19384
19477
|
function texturesOf(material, out) {
|
|
19385
19478
|
for (const value of Object.values(material)) if (isTexture(value)) out.add(value);
|
|
@@ -21440,63 +21533,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21440
21533
|
}
|
|
21441
21534
|
|
|
21442
21535
|
// ../game-destruction/dist/index.js
|
|
21443
|
-
var AIR_DENSITY = 1.2;
|
|
21444
|
-
var DRAG_AREA_FACTOR = 1.5;
|
|
21445
|
-
var STEEL_DENSITY = 7850;
|
|
21446
|
-
var FRAGMENT_MIN_SPEED = 30;
|
|
21447
|
-
var GLASS_STIFFENING = 2.5;
|
|
21448
|
-
var PLATE_COEFFICIENT = 0.2874;
|
|
21449
|
-
var BEAM_COEFFICIENT = 0.75;
|
|
21450
|
-
var TNT_PER_JOULE = DEFAULT_BLAST_IMPULSE.tntPerJoule;
|
|
21451
|
-
function projectedArea(shape, toward2) {
|
|
21452
|
-
const [dx, dy, dz] = [Math.abs(toward2[0]), Math.abs(toward2[1]), Math.abs(toward2[2])];
|
|
21453
|
-
if (shape.kind === "box") return dx * shape.size[1] * shape.size[2] + dy * shape.size[0] * shape.size[2] + dz * shape.size[0] * shape.size[1];
|
|
21454
|
-
if (shape.kind === "cylinder") return Math.PI * shape.radius ** 2 * dy + 2 * shape.radius * shape.height * Math.sqrt(Math.max(0, 1 - dy * dy));
|
|
21455
|
-
return Math.PI * shape.radius ** 2;
|
|
21456
|
-
}
|
|
21457
|
-
function failureWork(input) {
|
|
21458
|
-
const ratio = input.thickness / Math.max(input.span, input.thickness);
|
|
21459
|
-
const stiffening = input.isGlass ? GLASS_STIFFENING : 1;
|
|
21460
|
-
const pressure = stiffening * input.failureMPa * 1e6 * ratio * ratio / (input.isBeam ? BEAM_COEFFICIENT : PLATE_COEFFICIENT);
|
|
21461
|
-
const deflection = input.thickness * (1 + 25 * input.ductility * input.ductility);
|
|
21462
|
-
return { pressure, work: (0.5 + 0.5 * input.ductility) * pressure * input.loaded * deflection };
|
|
21463
|
-
}
|
|
21464
|
-
function casingFlight(casing2) {
|
|
21465
|
-
const k = casing2.geometry === "cylinder" ? 0.5 : 0.6;
|
|
21466
|
-
return {
|
|
21467
|
-
mottScale: casing2.mass / (2 * Math.max(1, casing2.fragments)),
|
|
21468
|
-
speed: casing2.gurneyVelocity / Math.sqrt(casing2.mass / Math.max(casing2.chargeMass, 1e-6) + k)
|
|
21469
|
-
};
|
|
21470
|
-
}
|
|
21471
|
-
function mottMass(u, scale, fragments) {
|
|
21472
|
-
const lowest = 1 / Math.max(1, fragments);
|
|
21473
|
-
return scale * Math.log(1 / Math.max(u, lowest)) ** 2;
|
|
21474
|
-
}
|
|
21475
|
-
function fragmentCaliberMm(mass) {
|
|
21476
|
-
return 2e3 * Math.cbrt(3 * mass / (4 * Math.PI * STEEL_DENSITY));
|
|
21477
|
-
}
|
|
21478
|
-
function fragmentDrag(mass) {
|
|
21479
|
-
const sphereArea = Math.PI * Math.cbrt(3 * mass / (4 * Math.PI * STEEL_DENSITY)) ** 2;
|
|
21480
|
-
return AIR_DENSITY * DRAG_AREA_FACTOR * sphereArea / (2 * mass);
|
|
21481
|
-
}
|
|
21482
|
-
var BLUNT_FRAGMENT_NOSE = 0.84;
|
|
21483
|
-
var NDRC_CONSTANT = 38e-6;
|
|
21484
|
-
function concretePerforation(input) {
|
|
21485
|
-
const { mass, caliber, speed } = input;
|
|
21486
|
-
if (!(mass > 0) || !(caliber > 0) || !(speed > 0)) return { depth: 0, perforation: 0 };
|
|
21487
|
-
const g = NDRC_CONSTANT * (input.nose ?? BLUNT_FRAGMENT_NOSE) * mass / (caliber * Math.sqrt(input.compressiveMPa * 1e6)) * (speed / caliber) ** 1.8;
|
|
21488
|
-
const relative = g <= 1 ? 2 * Math.sqrt(g) : g + 1;
|
|
21489
|
-
const through = relative <= 1.35 ? 3.19 * relative - 0.718 * relative * relative : 1.32 + 1.24 * relative;
|
|
21490
|
-
return { depth: relative * caliber, perforation: through * caliber };
|
|
21491
|
-
}
|
|
21492
|
-
var FIRE_PRIME_C = 300;
|
|
21493
|
-
var drawChainDelay = (delay, random) => {
|
|
21494
|
-
if (typeof delay === "number") return delay;
|
|
21495
|
-
const [min2, max2] = delay;
|
|
21496
|
-
return min2 + random() * (max2 - min2);
|
|
21497
|
-
};
|
|
21498
|
-
var chainDelayOf = (spec, trigger) => spec.explodes?.chain?.[trigger];
|
|
21499
|
-
var shotDamageFractionOf = (spec) => spec.explodes?.chain?.shotDamageFraction ?? 0;
|
|
21500
21536
|
var EPS4 = 1e-9;
|
|
21501
21537
|
var vec = {
|
|
21502
21538
|
add: (a, b) => [a[0] + b[0], a[1] + b[1], a[2] + b[2]],
|
|
@@ -21778,6 +21814,342 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21778
21814
|
}
|
|
21779
21815
|
};
|
|
21780
21816
|
};
|
|
21817
|
+
var planeAxes = (thin) => thin === 1 ? [0, 2] : [thin === 0 ? 2 : 0, 1];
|
|
21818
|
+
var BREACH_GRID_CAP = 4096;
|
|
21819
|
+
var unitGrid = (dims, thin, units, cap) => {
|
|
21820
|
+
const [u, v] = planeAxes(thin);
|
|
21821
|
+
let unitU = Math.min(units.size[0], dims[u]), unitV = Math.min(units.size[1], dims[v]);
|
|
21822
|
+
const rowsFor = (h) => Math.ceil(dims[v] / h - 1e-9);
|
|
21823
|
+
const colsFor = (w) => Math.ceil(dims[u] / w - 1e-9) + (units.bond === "running" ? 1 : 0);
|
|
21824
|
+
const merge = Math.ceil(Math.sqrt(rowsFor(unitV) * colsFor(unitU) / cap));
|
|
21825
|
+
if (merge > 1) {
|
|
21826
|
+
unitU = Math.min(unitU * merge, dims[u]);
|
|
21827
|
+
unitV = Math.min(unitV * merge, dims[v]);
|
|
21828
|
+
}
|
|
21829
|
+
const cells = [];
|
|
21830
|
+
for (let row = 0; row < rowsFor(unitV); row++) {
|
|
21831
|
+
const v0 = -dims[v] / 2 + row * unitV, v1 = Math.min(v0 + unitV, dims[v] / 2);
|
|
21832
|
+
const shift = units.bond === "running" && row % 2 === 1 ? unitU / 2 : 0;
|
|
21833
|
+
for (let col = 0; col < colsFor(unitU); col++) {
|
|
21834
|
+
const u0 = Math.max(-dims[u] / 2 + col * unitU - shift, -dims[u] / 2), u1 = Math.min(-dims[u] / 2 + (col + 1) * unitU - shift, dims[u] / 2);
|
|
21835
|
+
if (u1 - u0 < 0.01) continue;
|
|
21836
|
+
const center = [0, 0, 0], size = [0, 0, 0];
|
|
21837
|
+
center[u] = (u0 + u1) / 2;
|
|
21838
|
+
center[v] = (v0 + v1) / 2;
|
|
21839
|
+
size[u] = u1 - u0;
|
|
21840
|
+
size[v] = v1 - v0;
|
|
21841
|
+
size[thin] = dims[thin];
|
|
21842
|
+
cells.push({ center, size });
|
|
21843
|
+
}
|
|
21844
|
+
}
|
|
21845
|
+
return cells;
|
|
21846
|
+
};
|
|
21847
|
+
var rowsOfGrid = /* @__PURE__ */ new WeakMap();
|
|
21848
|
+
var unitRowsWithin = (cells, thin, point, radius) => {
|
|
21849
|
+
const [u, v] = planeAxes(thin);
|
|
21850
|
+
if (!Number.isFinite(point[u]) || !Number.isFinite(point[v]) || !Number.isFinite(radius)) return [[0, cells.length]];
|
|
21851
|
+
let rows = rowsOfGrid.get(cells);
|
|
21852
|
+
if (!rows) {
|
|
21853
|
+
const found = [];
|
|
21854
|
+
cells.forEach((cell, i) => {
|
|
21855
|
+
const last = found[found.length - 1];
|
|
21856
|
+
if (last && last.center === cell.center[v] && last.size === cell.size[v]) last.to = i + 1;
|
|
21857
|
+
else found.push({ from: i, to: i + 1, center: cell.center[v], size: cell.size[v] });
|
|
21858
|
+
});
|
|
21859
|
+
rowsOfGrid.set(cells, rows = found);
|
|
21860
|
+
}
|
|
21861
|
+
const ranges = [];
|
|
21862
|
+
for (const row of rows) {
|
|
21863
|
+
if (Math.max(0, Math.abs(point[v] - row.center) - row.size / 2) > radius) continue;
|
|
21864
|
+
const last = ranges[ranges.length - 1];
|
|
21865
|
+
if (last && last[1] === row.from) last[1] = row.to;
|
|
21866
|
+
else ranges.push([row.from, row.to]);
|
|
21867
|
+
}
|
|
21868
|
+
return ranges;
|
|
21869
|
+
};
|
|
21870
|
+
var planeDistance = (cell, thin, point) => {
|
|
21871
|
+
const [u, v] = planeAxes(thin);
|
|
21872
|
+
const du = cell.center[u] - point[u], dv = cell.center[v] - point[v];
|
|
21873
|
+
return Math.sqrt(du * du + dv * dv);
|
|
21874
|
+
};
|
|
21875
|
+
var cellsWithin = (cells, thin, point, radius) => {
|
|
21876
|
+
const inside3 = cells.filter((c) => planeDistance(c, thin, point) <= radius);
|
|
21877
|
+
if (inside3.length > 0 || cells.length === 0) return inside3;
|
|
21878
|
+
return [cells.reduce((best, c) => planeDistance(c, thin, point) < planeDistance(best, thin, point) ? c : best)];
|
|
21879
|
+
};
|
|
21880
|
+
var cellsOutside = (cells, thin, point, radius) => cells.filter((c) => planeDistance(c, thin, point) > radius);
|
|
21881
|
+
var MAX_MARKS_PER_FRAGMENT = 12;
|
|
21882
|
+
var marksInBox = (center, size, rotation2, holes) => {
|
|
21883
|
+
const inverse = rotation2 ? quat.conjugate(rotation2) : void 0;
|
|
21884
|
+
const marks = [];
|
|
21885
|
+
for (const hole of holes) {
|
|
21886
|
+
const offset = [hole.point[0] - center[0], hole.point[1] - center[1], hole.point[2] - center[2]];
|
|
21887
|
+
const point = inverse ? rotateVec(inverse, offset) : offset;
|
|
21888
|
+
const inside3 = point.every((value, k) => Math.abs(value) <= size[k] / 2 + hole.diameter / 2);
|
|
21889
|
+
if (!inside3) continue;
|
|
21890
|
+
marks.push({ point, normal: inverse ? rotateVec(inverse, hole.normal) : hole.normal, diameter: hole.diameter });
|
|
21891
|
+
if (marks.length >= MAX_MARKS_PER_FRAGMENT) break;
|
|
21892
|
+
}
|
|
21893
|
+
return marks;
|
|
21894
|
+
};
|
|
21895
|
+
var rowLayouts = /* @__PURE__ */ new WeakMap();
|
|
21896
|
+
var rowLayoutOf = (cells, thin, bottom) => {
|
|
21897
|
+
const known = rowLayouts.get(cells);
|
|
21898
|
+
if (known && known.thin === thin && known.bottom === bottom && known.count === cells.length) return known;
|
|
21899
|
+
const [u, v] = planeAxes(thin);
|
|
21900
|
+
const keys = cells.map((cell) => Math.round((cell.center[v] - cell.size[v] / 2 - bottom) * 1e4));
|
|
21901
|
+
const alongOrder = cells.map((_, i) => i).sort((a, b) => cells[a].center[u] - cells[b].center[u]);
|
|
21902
|
+
const layout = { thin, bottom, count: cells.length, keys, alongOrder };
|
|
21903
|
+
rowLayouts.set(cells, layout);
|
|
21904
|
+
return layout;
|
|
21905
|
+
};
|
|
21906
|
+
var holeInBox = (center, size, hole) => {
|
|
21907
|
+
for (let k = 0; k < 3; k++) if (!(Math.abs(hole.point[k] - center[k]) <= size[k] / 2 + hole.diameter / 2)) return false;
|
|
21908
|
+
return true;
|
|
21909
|
+
};
|
|
21910
|
+
var JOINT_GAP = 1e-4;
|
|
21911
|
+
var MIN_BEARING_SHARE = 0.25;
|
|
21912
|
+
var unsupportedCells = (cells, thin, dims, standing) => {
|
|
21913
|
+
if (thin === 1) return unheldSlabCells(cells, dims, standing);
|
|
21914
|
+
const [u, v] = planeAxes(thin);
|
|
21915
|
+
const bottom = -dims[v] / 2;
|
|
21916
|
+
const layout = rowLayoutOf(cells, thin, bottom);
|
|
21917
|
+
const rows = /* @__PURE__ */ new Map();
|
|
21918
|
+
const isStanding = new Uint8Array(cells.length);
|
|
21919
|
+
for (let i = 0; i < cells.length; i++) {
|
|
21920
|
+
if (!standing(i)) continue;
|
|
21921
|
+
isStanding[i] = 1;
|
|
21922
|
+
const key2 = layout.keys[i];
|
|
21923
|
+
if (!rows.has(key2)) rows.set(key2, []);
|
|
21924
|
+
}
|
|
21925
|
+
for (const i of layout.alongOrder) if (isStanding[i] === 1) rows.get(layout.keys[i]).push(i);
|
|
21926
|
+
const rowOf = (y) => Math.round((y - bottom) * 1e4);
|
|
21927
|
+
const held = /* @__PURE__ */ new Set();
|
|
21928
|
+
const queue = [];
|
|
21929
|
+
for (const i of rows.get(0) ?? []) {
|
|
21930
|
+
held.add(i);
|
|
21931
|
+
queue.push(i);
|
|
21932
|
+
}
|
|
21933
|
+
const overlap = (a, b) => Math.min(a.center[u] + a.size[u] / 2, b.center[u] + b.size[u] / 2) - Math.max(a.center[u] - a.size[u] / 2, b.center[u] - b.size[u] / 2);
|
|
21934
|
+
const climb = () => {
|
|
21935
|
+
while (queue.length > 0) {
|
|
21936
|
+
const cell = cells[queue.pop()];
|
|
21937
|
+
for (const j of rows.get(rowOf(cell.center[v] + cell.size[v] / 2)) ?? []) {
|
|
21938
|
+
const other = cells[j];
|
|
21939
|
+
if (held.has(j) || overlap(cell, other) <= Math.max(JOINT_GAP, MIN_BEARING_SHARE * Math.min(cell.size[u], other.size[u]))) continue;
|
|
21940
|
+
held.add(j);
|
|
21941
|
+
queue.push(j);
|
|
21942
|
+
}
|
|
21943
|
+
}
|
|
21944
|
+
};
|
|
21945
|
+
const touching = (a, b) => Math.abs(a.center[u] + a.size[u] / 2 - (b.center[u] - b.size[u] / 2)) <= 1e-3;
|
|
21946
|
+
for (let wedged = true; wedged; ) {
|
|
21947
|
+
climb();
|
|
21948
|
+
wedged = false;
|
|
21949
|
+
for (const row of rows.values()) {
|
|
21950
|
+
for (let k = 1; k < row.length - 1; k++) {
|
|
21951
|
+
const i = row[k];
|
|
21952
|
+
if (held.has(i) || !held.has(row[k - 1]) || !held.has(row[k + 1])) continue;
|
|
21953
|
+
if (!touching(cells[row[k - 1]], cells[i]) || !touching(cells[i], cells[row[k + 1]])) continue;
|
|
21954
|
+
held.add(i);
|
|
21955
|
+
queue.push(i);
|
|
21956
|
+
wedged = true;
|
|
21957
|
+
}
|
|
21958
|
+
}
|
|
21959
|
+
}
|
|
21960
|
+
const loose = [];
|
|
21961
|
+
for (const row of rows.values()) for (const i of row) if (!held.has(i)) loose.push(i);
|
|
21962
|
+
return loose;
|
|
21963
|
+
};
|
|
21964
|
+
var slabGrids = /* @__PURE__ */ new WeakMap();
|
|
21965
|
+
function slabGridOf(cells) {
|
|
21966
|
+
const known = slabGrids.get(cells);
|
|
21967
|
+
if (known && known.place.length === cells.length * 2) return known;
|
|
21968
|
+
const [u, v] = planeAxes(1);
|
|
21969
|
+
const round5 = (x) => Math.round(x * 1e4);
|
|
21970
|
+
const columns = [...new Set(cells.map((cell) => round5(cell.center[u])))].sort((a, b) => a - b);
|
|
21971
|
+
const rows = [...new Set(cells.map((cell) => round5(cell.center[v])))].sort((a, b) => a - b);
|
|
21972
|
+
const columnOf = new Map(columns.map((c, k) => [c, k])), rowOf = new Map(rows.map((r, k) => [r, k]));
|
|
21973
|
+
const place = new Int32Array(cells.length * 2);
|
|
21974
|
+
cells.forEach((cell, i) => {
|
|
21975
|
+
place[i * 2] = columnOf.get(round5(cell.center[u]));
|
|
21976
|
+
place[i * 2 + 1] = rowOf.get(round5(cell.center[v]));
|
|
21977
|
+
});
|
|
21978
|
+
const grid = { columns: columns.length, rows: rows.length, place };
|
|
21979
|
+
slabGrids.set(cells, grid);
|
|
21980
|
+
return grid;
|
|
21981
|
+
}
|
|
21982
|
+
var unheldSlabCells = (cells, dims, standing) => {
|
|
21983
|
+
const [u, v] = planeAxes(1);
|
|
21984
|
+
const edge = (cell) => cell.center[u] - cell.size[u] / 2 <= -dims[u] / 2 + JOINT_GAP || cell.center[u] + cell.size[u] / 2 >= dims[u] / 2 - JOINT_GAP || cell.center[v] - cell.size[v] / 2 <= -dims[v] / 2 + JOINT_GAP || cell.center[v] + cell.size[v] / 2 >= dims[v] / 2 - JOINT_GAP;
|
|
21985
|
+
const { columns, rows, place } = slabGridOf(cells);
|
|
21986
|
+
const at4 = /* @__PURE__ */ new Map();
|
|
21987
|
+
for (let i = 0; i < cells.length; i++) if (standing(i)) at4.set(place[i * 2 + 1] * columns + place[i * 2], i);
|
|
21988
|
+
const held = new Uint8Array(cells.length);
|
|
21989
|
+
const queue = [];
|
|
21990
|
+
for (const i of at4.values()) if (edge(cells[i])) {
|
|
21991
|
+
held[i] = 1;
|
|
21992
|
+
queue.push(i);
|
|
21993
|
+
}
|
|
21994
|
+
while (queue.length > 0) {
|
|
21995
|
+
const i = queue.pop();
|
|
21996
|
+
const c = place[i * 2], r = place[i * 2 + 1];
|
|
21997
|
+
for (const [nc, nr] of [[c - 1, r], [c + 1, r], [c, r - 1], [c, r + 1]]) {
|
|
21998
|
+
if (nc < 0 || nr < 0 || nc >= columns || nr >= rows) continue;
|
|
21999
|
+
const j = at4.get(nr * columns + nc);
|
|
22000
|
+
if (j === void 0 || held[j] === 1) continue;
|
|
22001
|
+
held[j] = 1;
|
|
22002
|
+
queue.push(j);
|
|
22003
|
+
}
|
|
22004
|
+
}
|
|
22005
|
+
const loose = [];
|
|
22006
|
+
for (const i of at4.values()) if (held[i] !== 1) loose.push(i);
|
|
22007
|
+
return loose.sort((a, b) => a - b);
|
|
22008
|
+
};
|
|
22009
|
+
var clumpUnits = (cells, thin, unit, cap) => {
|
|
22010
|
+
if (cells.length <= cap) return [...cells];
|
|
22011
|
+
const [u, v] = planeAxes(thin);
|
|
22012
|
+
let lo0 = Infinity, lo1 = Infinity;
|
|
22013
|
+
for (const cell of cells) {
|
|
22014
|
+
lo0 = Math.min(lo0, cell.center[u] - cell.size[u] / 2);
|
|
22015
|
+
lo1 = Math.min(lo1, cell.center[v] - cell.size[v] / 2);
|
|
22016
|
+
}
|
|
22017
|
+
let along3 = 1, up = 1;
|
|
22018
|
+
for (let grow2 = 0; ; grow2++) {
|
|
22019
|
+
const bins = /* @__PURE__ */ new Map();
|
|
22020
|
+
for (const cell of cells) {
|
|
22021
|
+
const key2 = `${Math.floor((cell.center[u] - lo0) / (along3 * unit[0]))}:${Math.floor((cell.center[v] - lo1) / (up * unit[1]))}`;
|
|
22022
|
+
const bin2 = bins.get(key2) ?? { lo: [Infinity, Infinity, Infinity], hi: [-Infinity, -Infinity, -Infinity] };
|
|
22023
|
+
for (let k = 0; k < 3; k++) {
|
|
22024
|
+
bin2.lo[k] = Math.min(bin2.lo[k], cell.center[k] - cell.size[k] / 2);
|
|
22025
|
+
bin2.hi[k] = Math.max(bin2.hi[k], cell.center[k] + cell.size[k] / 2);
|
|
22026
|
+
}
|
|
22027
|
+
bins.set(key2, bin2);
|
|
22028
|
+
}
|
|
22029
|
+
if (bins.size <= cap) {
|
|
22030
|
+
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]] }));
|
|
22031
|
+
}
|
|
22032
|
+
if (grow2 % 2 === 0) up++;
|
|
22033
|
+
else along3++;
|
|
22034
|
+
}
|
|
22035
|
+
};
|
|
22036
|
+
var MAX_SPALLS = 64;
|
|
22037
|
+
var thinAxisOf = (dims) => dims[0] <= dims[1] && dims[0] <= dims[2] ? 0 : dims[1] <= dims[2] ? 1 : 2;
|
|
22038
|
+
var resolveLayer = (def, index, mat) => ({ index, def, mat, energy: mat.penetration * def.thickness * 1e3 });
|
|
22039
|
+
var faceCode = (thin, axis2, sign2) => {
|
|
22040
|
+
const [u] = planeAxes(thin);
|
|
22041
|
+
return (sign2 >= 0 ? 1 : -1) * (axis2 === thin ? 1 : axis2 === u ? 2 : 3);
|
|
22042
|
+
};
|
|
22043
|
+
var faceAxis = (thin, face) => {
|
|
22044
|
+
const k = Math.abs(face);
|
|
22045
|
+
return k === 1 ? thin : planeAxes(thin)[k - 2];
|
|
22046
|
+
};
|
|
22047
|
+
var faceOfNormal = (layers, thin, localNormal) => {
|
|
22048
|
+
if (!layers.some((l) => l.def.faces === "all")) return localNormal[thin] >= 0 ? 1 : -1;
|
|
22049
|
+
let axis2 = thin;
|
|
22050
|
+
for (let k = 0; k < 3; k++) if (Math.abs(localNormal[k]) > Math.abs(localNormal[axis2])) axis2 = k;
|
|
22051
|
+
return faceCode(thin, axis2, localNormal[axis2]);
|
|
22052
|
+
};
|
|
22053
|
+
var onFace = (layer3, face) => {
|
|
22054
|
+
const faces = layer3.def.faces;
|
|
22055
|
+
if (faces === "all") return true;
|
|
22056
|
+
if (Math.abs(face) !== 1) return false;
|
|
22057
|
+
return faces === "both" || faces === (face > 0 ? "+" : "-");
|
|
22058
|
+
};
|
|
22059
|
+
var thinSidesOf = (def) => def.faces === "both" || def.faces === "all" ? [1, -1] : [def.faces === "+" ? 1 : -1];
|
|
22060
|
+
var isSpalled = (spalls, layer3, face, point) => {
|
|
22061
|
+
for (const s of spalls ?? []) {
|
|
22062
|
+
if (s[0] !== layer3 || s[1] !== face) continue;
|
|
22063
|
+
const dx = s[2] - point[0], dy = s[3] - point[1], dz = s[4] - point[2];
|
|
22064
|
+
if (dx * dx + dy * dy + dz * dz <= s[5] * s[5]) return true;
|
|
22065
|
+
}
|
|
22066
|
+
return false;
|
|
22067
|
+
};
|
|
22068
|
+
var outerLayer = (layers, spalls, face, point) => layers.find((l) => onFace(l, face) && !isSpalled(spalls, l.index, face, point));
|
|
22069
|
+
var layersEnergy = (layers, spalls, face, point) => {
|
|
22070
|
+
let sum2 = 0;
|
|
22071
|
+
for (const l of layers) if (onFace(l, face) && !isSpalled(spalls, l.index, face, point)) sum2 += l.energy;
|
|
22072
|
+
return sum2;
|
|
22073
|
+
};
|
|
22074
|
+
var layersThickness = (layers, face) => {
|
|
22075
|
+
let sum2 = 0;
|
|
22076
|
+
for (const l of layers) if (onFace(l, face)) sum2 += l.def.thickness;
|
|
22077
|
+
return sum2;
|
|
22078
|
+
};
|
|
22079
|
+
var tornPatchAt = (layers, spalls, face, point, radius) => {
|
|
22080
|
+
for (const l of layers) {
|
|
22081
|
+
if (!onFace(l, face)) continue;
|
|
22082
|
+
if (l.mat.fracture === "tear") {
|
|
22083
|
+
let best = -1;
|
|
22084
|
+
(spalls ?? []).forEach((s, i) => {
|
|
22085
|
+
if (s[0] !== l.index || s[1] !== face) return;
|
|
22086
|
+
const dx = s[2] - point[0], dy = s[3] - point[1], dz = s[4] - point[2];
|
|
22087
|
+
const reach2 = s[5] + radius;
|
|
22088
|
+
if (dx * dx + dy * dy + dz * dz <= reach2 * reach2 && (best < 0 || s[5] > spalls[best][5])) best = i;
|
|
22089
|
+
});
|
|
22090
|
+
if (best >= 0) return { layer: l, spall: best };
|
|
22091
|
+
}
|
|
22092
|
+
if (!isSpalled(spalls, l.index, face, point)) return void 0;
|
|
22093
|
+
}
|
|
22094
|
+
return void 0;
|
|
22095
|
+
};
|
|
22096
|
+
var AIR_DENSITY = 1.2;
|
|
22097
|
+
var DRAG_AREA_FACTOR = 1.5;
|
|
22098
|
+
var STEEL_DENSITY = 7850;
|
|
22099
|
+
var FRAGMENT_MIN_SPEED = 30;
|
|
22100
|
+
var GLASS_STIFFENING = 2.5;
|
|
22101
|
+
var PLATE_COEFFICIENT = 0.2874;
|
|
22102
|
+
var BEAM_COEFFICIENT = 0.75;
|
|
22103
|
+
var TNT_PER_JOULE = DEFAULT_BLAST_IMPULSE.tntPerJoule;
|
|
22104
|
+
function projectedArea(shape, toward2) {
|
|
22105
|
+
const [dx, dy, dz] = [Math.abs(toward2[0]), Math.abs(toward2[1]), Math.abs(toward2[2])];
|
|
22106
|
+
if (shape.kind === "box") return dx * shape.size[1] * shape.size[2] + dy * shape.size[0] * shape.size[2] + dz * shape.size[0] * shape.size[1];
|
|
22107
|
+
if (shape.kind === "cylinder") return Math.PI * shape.radius ** 2 * dy + 2 * shape.radius * shape.height * Math.sqrt(Math.max(0, 1 - dy * dy));
|
|
22108
|
+
return Math.PI * shape.radius ** 2;
|
|
22109
|
+
}
|
|
22110
|
+
function failureWork(input) {
|
|
22111
|
+
const ratio = input.thickness / Math.max(input.span, input.thickness);
|
|
22112
|
+
const stiffening = input.isGlass ? GLASS_STIFFENING : 1;
|
|
22113
|
+
const pressure = stiffening * input.failureMPa * 1e6 * ratio * ratio / (input.isBeam ? BEAM_COEFFICIENT : PLATE_COEFFICIENT);
|
|
22114
|
+
const deflection = input.thickness * (1 + 25 * input.ductility * input.ductility);
|
|
22115
|
+
return { pressure, work: (0.5 + 0.5 * input.ductility) * pressure * input.loaded * deflection };
|
|
22116
|
+
}
|
|
22117
|
+
function casingFlight(casing2) {
|
|
22118
|
+
const k = casing2.geometry === "cylinder" ? 0.5 : 0.6;
|
|
22119
|
+
return {
|
|
22120
|
+
mottScale: casing2.mass / (2 * Math.max(1, casing2.fragments)),
|
|
22121
|
+
speed: casing2.gurneyVelocity / Math.sqrt(casing2.mass / Math.max(casing2.chargeMass, 1e-6) + k)
|
|
22122
|
+
};
|
|
22123
|
+
}
|
|
22124
|
+
function mottMass(u, scale, fragments) {
|
|
22125
|
+
const lowest = 1 / Math.max(1, fragments);
|
|
22126
|
+
return scale * Math.log(1 / Math.max(u, lowest)) ** 2;
|
|
22127
|
+
}
|
|
22128
|
+
function fragmentCaliberMm(mass) {
|
|
22129
|
+
return 2e3 * Math.cbrt(3 * mass / (4 * Math.PI * STEEL_DENSITY));
|
|
22130
|
+
}
|
|
22131
|
+
function fragmentDrag(mass) {
|
|
22132
|
+
const sphereArea = Math.PI * Math.cbrt(3 * mass / (4 * Math.PI * STEEL_DENSITY)) ** 2;
|
|
22133
|
+
return AIR_DENSITY * DRAG_AREA_FACTOR * sphereArea / (2 * mass);
|
|
22134
|
+
}
|
|
22135
|
+
var BLUNT_FRAGMENT_NOSE = 0.84;
|
|
22136
|
+
var NDRC_CONSTANT = 38e-6;
|
|
22137
|
+
function concretePerforation(input) {
|
|
22138
|
+
const { mass, caliber, speed } = input;
|
|
22139
|
+
if (!(mass > 0) || !(caliber > 0) || !(speed > 0)) return { depth: 0, perforation: 0 };
|
|
22140
|
+
const g = NDRC_CONSTANT * (input.nose ?? BLUNT_FRAGMENT_NOSE) * mass / (caliber * Math.sqrt(input.compressiveMPa * 1e6)) * (speed / caliber) ** 1.8;
|
|
22141
|
+
const relative = g <= 1 ? 2 * Math.sqrt(g) : g + 1;
|
|
22142
|
+
const through = relative <= 1.35 ? 3.19 * relative - 0.718 * relative * relative : 1.32 + 1.24 * relative;
|
|
22143
|
+
return { depth: relative * caliber, perforation: through * caliber };
|
|
22144
|
+
}
|
|
22145
|
+
var FIRE_PRIME_C = 300;
|
|
22146
|
+
var drawChainDelay = (delay, random) => {
|
|
22147
|
+
if (typeof delay === "number") return delay;
|
|
22148
|
+
const [min2, max2] = delay;
|
|
22149
|
+
return min2 + random() * (max2 - min2);
|
|
22150
|
+
};
|
|
22151
|
+
var chainDelayOf = (spec, trigger) => spec.explodes?.chain?.[trigger];
|
|
22152
|
+
var shotDamageFractionOf = (spec) => spec.explodes?.chain?.shotDamageFraction ?? 0;
|
|
21781
22153
|
var bsp = (root, count, axes, rnd2) => {
|
|
21782
22154
|
const pieces = [root];
|
|
21783
22155
|
const vol = (b) => axes.reduce((v, a) => v * b.s[a], 1);
|
|
@@ -22058,179 +22430,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22058
22430
|
const n = clamp(Math.round(dims[u] * dims[v] / (mean * mean)), 6, maxFragments);
|
|
22059
22431
|
return radialPlates(inp, root, { t, u, v }, n, Math.min(inp.thickness, dims[t]), fmax * 1.5);
|
|
22060
22432
|
};
|
|
22061
|
-
var planeAxes = (thin) => thin === 1 ? [0, 2] : [thin === 0 ? 2 : 0, 1];
|
|
22062
|
-
var unitGrid = (dims, thin, units, cap) => {
|
|
22063
|
-
const [u, v] = planeAxes(thin);
|
|
22064
|
-
let unitU = Math.min(units.size[0], dims[u]), unitV = Math.min(units.size[1], dims[v]);
|
|
22065
|
-
const rowsFor = (h) => Math.ceil(dims[v] / h - 1e-9);
|
|
22066
|
-
const colsFor = (w) => Math.ceil(dims[u] / w - 1e-9) + (units.bond === "running" ? 1 : 0);
|
|
22067
|
-
const merge = Math.ceil(Math.sqrt(rowsFor(unitV) * colsFor(unitU) / cap));
|
|
22068
|
-
if (merge > 1) {
|
|
22069
|
-
unitU = Math.min(unitU * merge, dims[u]);
|
|
22070
|
-
unitV = Math.min(unitV * merge, dims[v]);
|
|
22071
|
-
}
|
|
22072
|
-
const cells = [];
|
|
22073
|
-
for (let row = 0; row < rowsFor(unitV); row++) {
|
|
22074
|
-
const v0 = -dims[v] / 2 + row * unitV, v1 = Math.min(v0 + unitV, dims[v] / 2);
|
|
22075
|
-
const shift = units.bond === "running" && row % 2 === 1 ? unitU / 2 : 0;
|
|
22076
|
-
for (let col = 0; col < colsFor(unitU); col++) {
|
|
22077
|
-
const u0 = Math.max(-dims[u] / 2 + col * unitU - shift, -dims[u] / 2), u1 = Math.min(-dims[u] / 2 + (col + 1) * unitU - shift, dims[u] / 2);
|
|
22078
|
-
if (u1 - u0 < 0.01) continue;
|
|
22079
|
-
const center = [0, 0, 0], size = [0, 0, 0];
|
|
22080
|
-
center[u] = (u0 + u1) / 2;
|
|
22081
|
-
center[v] = (v0 + v1) / 2;
|
|
22082
|
-
size[u] = u1 - u0;
|
|
22083
|
-
size[v] = v1 - v0;
|
|
22084
|
-
size[thin] = dims[thin];
|
|
22085
|
-
cells.push({ center, size });
|
|
22086
|
-
}
|
|
22087
|
-
}
|
|
22088
|
-
return cells;
|
|
22089
|
-
};
|
|
22090
|
-
var rowsOfGrid = /* @__PURE__ */ new WeakMap();
|
|
22091
|
-
var unitRowsWithin = (cells, thin, point, radius) => {
|
|
22092
|
-
const [u, v] = planeAxes(thin);
|
|
22093
|
-
if (!Number.isFinite(point[u]) || !Number.isFinite(point[v]) || !Number.isFinite(radius)) return [[0, cells.length]];
|
|
22094
|
-
let rows = rowsOfGrid.get(cells);
|
|
22095
|
-
if (!rows) {
|
|
22096
|
-
const found = [];
|
|
22097
|
-
cells.forEach((cell, i) => {
|
|
22098
|
-
const last = found[found.length - 1];
|
|
22099
|
-
if (last && last.center === cell.center[v] && last.size === cell.size[v]) last.to = i + 1;
|
|
22100
|
-
else found.push({ from: i, to: i + 1, center: cell.center[v], size: cell.size[v] });
|
|
22101
|
-
});
|
|
22102
|
-
rowsOfGrid.set(cells, rows = found);
|
|
22103
|
-
}
|
|
22104
|
-
const ranges = [];
|
|
22105
|
-
for (const row of rows) {
|
|
22106
|
-
if (Math.max(0, Math.abs(point[v] - row.center) - row.size / 2) > radius) continue;
|
|
22107
|
-
const last = ranges[ranges.length - 1];
|
|
22108
|
-
if (last && last[1] === row.from) last[1] = row.to;
|
|
22109
|
-
else ranges.push([row.from, row.to]);
|
|
22110
|
-
}
|
|
22111
|
-
return ranges;
|
|
22112
|
-
};
|
|
22113
|
-
var planeDistance = (cell, thin, point) => {
|
|
22114
|
-
const [u, v] = planeAxes(thin);
|
|
22115
|
-
const du = cell.center[u] - point[u], dv = cell.center[v] - point[v];
|
|
22116
|
-
return Math.sqrt(du * du + dv * dv);
|
|
22117
|
-
};
|
|
22118
|
-
var cellsWithin = (cells, thin, point, radius) => {
|
|
22119
|
-
const inside3 = cells.filter((c) => planeDistance(c, thin, point) <= radius);
|
|
22120
|
-
if (inside3.length > 0 || cells.length === 0) return inside3;
|
|
22121
|
-
return [cells.reduce((best, c) => planeDistance(c, thin, point) < planeDistance(best, thin, point) ? c : best)];
|
|
22122
|
-
};
|
|
22123
|
-
var cellsOutside = (cells, thin, point, radius) => cells.filter((c) => planeDistance(c, thin, point) > radius);
|
|
22124
|
-
var MAX_MARKS_PER_FRAGMENT = 12;
|
|
22125
|
-
var marksInBox = (center, size, rotation2, holes) => {
|
|
22126
|
-
const inverse = rotation2 ? quat.conjugate(rotation2) : void 0;
|
|
22127
|
-
const marks = [];
|
|
22128
|
-
for (const hole of holes) {
|
|
22129
|
-
const offset = [hole.point[0] - center[0], hole.point[1] - center[1], hole.point[2] - center[2]];
|
|
22130
|
-
const point = inverse ? rotateVec(inverse, offset) : offset;
|
|
22131
|
-
const inside3 = point.every((value, k) => Math.abs(value) <= size[k] / 2 + hole.diameter / 2);
|
|
22132
|
-
if (!inside3) continue;
|
|
22133
|
-
marks.push({ point, normal: inverse ? rotateVec(inverse, hole.normal) : hole.normal, diameter: hole.diameter });
|
|
22134
|
-
if (marks.length >= MAX_MARKS_PER_FRAGMENT) break;
|
|
22135
|
-
}
|
|
22136
|
-
return marks;
|
|
22137
|
-
};
|
|
22138
|
-
var rowLayouts = /* @__PURE__ */ new WeakMap();
|
|
22139
|
-
var rowLayoutOf = (cells, thin, bottom) => {
|
|
22140
|
-
const known = rowLayouts.get(cells);
|
|
22141
|
-
if (known && known.thin === thin && known.bottom === bottom && known.count === cells.length) return known;
|
|
22142
|
-
const [u, v] = planeAxes(thin);
|
|
22143
|
-
const keys = cells.map((cell) => Math.round((cell.center[v] - cell.size[v] / 2 - bottom) * 1e4));
|
|
22144
|
-
const alongOrder = cells.map((_, i) => i).sort((a, b) => cells[a].center[u] - cells[b].center[u]);
|
|
22145
|
-
const layout = { thin, bottom, count: cells.length, keys, alongOrder };
|
|
22146
|
-
rowLayouts.set(cells, layout);
|
|
22147
|
-
return layout;
|
|
22148
|
-
};
|
|
22149
|
-
var holeInBox = (center, size, hole) => {
|
|
22150
|
-
for (let k = 0; k < 3; k++) if (!(Math.abs(hole.point[k] - center[k]) <= size[k] / 2 + hole.diameter / 2)) return false;
|
|
22151
|
-
return true;
|
|
22152
|
-
};
|
|
22153
|
-
var JOINT_GAP = 1e-4;
|
|
22154
|
-
var MIN_BEARING_SHARE = 0.25;
|
|
22155
|
-
var unsupportedCells = (cells, thin, dims, standing) => {
|
|
22156
|
-
if (thin === 1) return [];
|
|
22157
|
-
const [u, v] = planeAxes(thin);
|
|
22158
|
-
const bottom = -dims[v] / 2;
|
|
22159
|
-
const layout = rowLayoutOf(cells, thin, bottom);
|
|
22160
|
-
const rows = /* @__PURE__ */ new Map();
|
|
22161
|
-
const isStanding = new Uint8Array(cells.length);
|
|
22162
|
-
for (let i = 0; i < cells.length; i++) {
|
|
22163
|
-
if (!standing(i)) continue;
|
|
22164
|
-
isStanding[i] = 1;
|
|
22165
|
-
const key2 = layout.keys[i];
|
|
22166
|
-
if (!rows.has(key2)) rows.set(key2, []);
|
|
22167
|
-
}
|
|
22168
|
-
for (const i of layout.alongOrder) if (isStanding[i] === 1) rows.get(layout.keys[i]).push(i);
|
|
22169
|
-
const rowOf = (y) => Math.round((y - bottom) * 1e4);
|
|
22170
|
-
const held = /* @__PURE__ */ new Set();
|
|
22171
|
-
const queue = [];
|
|
22172
|
-
for (const i of rows.get(0) ?? []) {
|
|
22173
|
-
held.add(i);
|
|
22174
|
-
queue.push(i);
|
|
22175
|
-
}
|
|
22176
|
-
const overlap = (a, b) => Math.min(a.center[u] + a.size[u] / 2, b.center[u] + b.size[u] / 2) - Math.max(a.center[u] - a.size[u] / 2, b.center[u] - b.size[u] / 2);
|
|
22177
|
-
const climb = () => {
|
|
22178
|
-
while (queue.length > 0) {
|
|
22179
|
-
const cell = cells[queue.pop()];
|
|
22180
|
-
for (const j of rows.get(rowOf(cell.center[v] + cell.size[v] / 2)) ?? []) {
|
|
22181
|
-
const other = cells[j];
|
|
22182
|
-
if (held.has(j) || overlap(cell, other) <= Math.max(JOINT_GAP, MIN_BEARING_SHARE * Math.min(cell.size[u], other.size[u]))) continue;
|
|
22183
|
-
held.add(j);
|
|
22184
|
-
queue.push(j);
|
|
22185
|
-
}
|
|
22186
|
-
}
|
|
22187
|
-
};
|
|
22188
|
-
const touching = (a, b) => Math.abs(a.center[u] + a.size[u] / 2 - (b.center[u] - b.size[u] / 2)) <= 1e-3;
|
|
22189
|
-
for (let wedged = true; wedged; ) {
|
|
22190
|
-
climb();
|
|
22191
|
-
wedged = false;
|
|
22192
|
-
for (const row of rows.values()) {
|
|
22193
|
-
for (let k = 1; k < row.length - 1; k++) {
|
|
22194
|
-
const i = row[k];
|
|
22195
|
-
if (held.has(i) || !held.has(row[k - 1]) || !held.has(row[k + 1])) continue;
|
|
22196
|
-
if (!touching(cells[row[k - 1]], cells[i]) || !touching(cells[i], cells[row[k + 1]])) continue;
|
|
22197
|
-
held.add(i);
|
|
22198
|
-
queue.push(i);
|
|
22199
|
-
wedged = true;
|
|
22200
|
-
}
|
|
22201
|
-
}
|
|
22202
|
-
}
|
|
22203
|
-
const loose = [];
|
|
22204
|
-
for (const row of rows.values()) for (const i of row) if (!held.has(i)) loose.push(i);
|
|
22205
|
-
return loose;
|
|
22206
|
-
};
|
|
22207
|
-
var clumpUnits = (cells, thin, unit, cap) => {
|
|
22208
|
-
if (cells.length <= cap) return [...cells];
|
|
22209
|
-
const [u, v] = planeAxes(thin);
|
|
22210
|
-
let lo0 = Infinity, lo1 = Infinity;
|
|
22211
|
-
for (const cell of cells) {
|
|
22212
|
-
lo0 = Math.min(lo0, cell.center[u] - cell.size[u] / 2);
|
|
22213
|
-
lo1 = Math.min(lo1, cell.center[v] - cell.size[v] / 2);
|
|
22214
|
-
}
|
|
22215
|
-
let along3 = 1, up = 1;
|
|
22216
|
-
for (let grow2 = 0; ; grow2++) {
|
|
22217
|
-
const bins = /* @__PURE__ */ new Map();
|
|
22218
|
-
for (const cell of cells) {
|
|
22219
|
-
const key2 = `${Math.floor((cell.center[u] - lo0) / (along3 * unit[0]))}:${Math.floor((cell.center[v] - lo1) / (up * unit[1]))}`;
|
|
22220
|
-
const bin2 = bins.get(key2) ?? { lo: [Infinity, Infinity, Infinity], hi: [-Infinity, -Infinity, -Infinity] };
|
|
22221
|
-
for (let k = 0; k < 3; k++) {
|
|
22222
|
-
bin2.lo[k] = Math.min(bin2.lo[k], cell.center[k] - cell.size[k] / 2);
|
|
22223
|
-
bin2.hi[k] = Math.max(bin2.hi[k], cell.center[k] + cell.size[k] / 2);
|
|
22224
|
-
}
|
|
22225
|
-
bins.set(key2, bin2);
|
|
22226
|
-
}
|
|
22227
|
-
if (bins.size <= cap) {
|
|
22228
|
-
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]] }));
|
|
22229
|
-
}
|
|
22230
|
-
if (grow2 % 2 === 0) up++;
|
|
22231
|
-
else along3++;
|
|
22232
|
-
}
|
|
22233
|
-
};
|
|
22234
22433
|
function put(out, at4, value) {
|
|
22235
22434
|
if (at4 < out.length) out[at4] = value;
|
|
22236
22435
|
else out.push(value);
|
|
@@ -22360,66 +22559,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22360
22559
|
}
|
|
22361
22560
|
};
|
|
22362
22561
|
}
|
|
22363
|
-
var MAX_SPALLS = 64;
|
|
22364
|
-
var thinAxisOf = (dims) => dims[0] <= dims[1] && dims[0] <= dims[2] ? 0 : dims[1] <= dims[2] ? 1 : 2;
|
|
22365
|
-
var resolveLayer = (def, index, mat) => ({ index, def, mat, energy: mat.penetration * def.thickness * 1e3 });
|
|
22366
|
-
var faceCode = (thin, axis2, sign2) => {
|
|
22367
|
-
const [u] = planeAxes(thin);
|
|
22368
|
-
return (sign2 >= 0 ? 1 : -1) * (axis2 === thin ? 1 : axis2 === u ? 2 : 3);
|
|
22369
|
-
};
|
|
22370
|
-
var faceAxis = (thin, face) => {
|
|
22371
|
-
const k = Math.abs(face);
|
|
22372
|
-
return k === 1 ? thin : planeAxes(thin)[k - 2];
|
|
22373
|
-
};
|
|
22374
|
-
var faceOfNormal = (layers, thin, localNormal) => {
|
|
22375
|
-
if (!layers.some((l) => l.def.faces === "all")) return localNormal[thin] >= 0 ? 1 : -1;
|
|
22376
|
-
let axis2 = thin;
|
|
22377
|
-
for (let k = 0; k < 3; k++) if (Math.abs(localNormal[k]) > Math.abs(localNormal[axis2])) axis2 = k;
|
|
22378
|
-
return faceCode(thin, axis2, localNormal[axis2]);
|
|
22379
|
-
};
|
|
22380
|
-
var onFace = (layer3, face) => {
|
|
22381
|
-
const faces = layer3.def.faces;
|
|
22382
|
-
if (faces === "all") return true;
|
|
22383
|
-
if (Math.abs(face) !== 1) return false;
|
|
22384
|
-
return faces === "both" || faces === (face > 0 ? "+" : "-");
|
|
22385
|
-
};
|
|
22386
|
-
var thinSidesOf = (def) => def.faces === "both" || def.faces === "all" ? [1, -1] : [def.faces === "+" ? 1 : -1];
|
|
22387
|
-
var isSpalled = (spalls, layer3, face, point) => {
|
|
22388
|
-
for (const s of spalls ?? []) {
|
|
22389
|
-
if (s[0] !== layer3 || s[1] !== face) continue;
|
|
22390
|
-
const dx = s[2] - point[0], dy = s[3] - point[1], dz = s[4] - point[2];
|
|
22391
|
-
if (dx * dx + dy * dy + dz * dz <= s[5] * s[5]) return true;
|
|
22392
|
-
}
|
|
22393
|
-
return false;
|
|
22394
|
-
};
|
|
22395
|
-
var outerLayer = (layers, spalls, face, point) => layers.find((l) => onFace(l, face) && !isSpalled(spalls, l.index, face, point));
|
|
22396
|
-
var layersEnergy = (layers, spalls, face, point) => {
|
|
22397
|
-
let sum2 = 0;
|
|
22398
|
-
for (const l of layers) if (onFace(l, face) && !isSpalled(spalls, l.index, face, point)) sum2 += l.energy;
|
|
22399
|
-
return sum2;
|
|
22400
|
-
};
|
|
22401
|
-
var layersThickness = (layers, face) => {
|
|
22402
|
-
let sum2 = 0;
|
|
22403
|
-
for (const l of layers) if (onFace(l, face)) sum2 += l.def.thickness;
|
|
22404
|
-
return sum2;
|
|
22405
|
-
};
|
|
22406
|
-
var tornPatchAt = (layers, spalls, face, point, radius) => {
|
|
22407
|
-
for (const l of layers) {
|
|
22408
|
-
if (!onFace(l, face)) continue;
|
|
22409
|
-
if (l.mat.fracture === "tear") {
|
|
22410
|
-
let best = -1;
|
|
22411
|
-
(spalls ?? []).forEach((s, i) => {
|
|
22412
|
-
if (s[0] !== l.index || s[1] !== face) return;
|
|
22413
|
-
const dx = s[2] - point[0], dy = s[3] - point[1], dz = s[4] - point[2];
|
|
22414
|
-
const reach2 = s[5] + radius;
|
|
22415
|
-
if (dx * dx + dy * dy + dz * dz <= reach2 * reach2 && (best < 0 || s[5] > spalls[best][5])) best = i;
|
|
22416
|
-
});
|
|
22417
|
-
if (best >= 0) return { layer: l, spall: best };
|
|
22418
|
-
}
|
|
22419
|
-
if (!isSpalled(spalls, l.index, face, point)) return void 0;
|
|
22420
|
-
}
|
|
22421
|
-
return void 0;
|
|
22422
|
-
};
|
|
22423
22562
|
var REBAR_COVER = 0.03;
|
|
22424
22563
|
var COVER = REBAR_COVER;
|
|
22425
22564
|
var MAX_BARS_PER_DIRECTION = 24;
|
|
@@ -22580,12 +22719,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22580
22719
|
var steelMoment = (area3, yieldMPa, d, b, compressiveMPa, options = {}) => {
|
|
22581
22720
|
if (area3 <= 0 || d <= 0 || b <= 0) return 0;
|
|
22582
22721
|
const T2 = area3 * yieldMPa * MPA;
|
|
22583
|
-
const
|
|
22584
|
-
const x = T2 /
|
|
22722
|
+
const block2 = 0.68 * compressiveMPa * MPA * b;
|
|
22723
|
+
const x = T2 / block2;
|
|
22585
22724
|
const xl = (options.neutralAxisLimit ?? FLEXURE_DEFAULTS.neutralAxisLimit) * d;
|
|
22586
22725
|
if (x <= xl) return T2 * (d - 0.4 * x);
|
|
22587
22726
|
const top = Math.min(d / 2, (options.cover ?? FLEXURE_DEFAULTS.cover) + RATIO_BAR / 2);
|
|
22588
|
-
return
|
|
22727
|
+
return block2 * xl * (d - 0.4 * xl) + (T2 - block2 * xl) * (d - top);
|
|
22589
22728
|
};
|
|
22590
22729
|
var spanStiffness = (EI, span) => 384 * EI / (5 * span ** 3);
|
|
22591
22730
|
var elasticEnergy = (moment, span, EI, loadFactor = FLEXURE_DEFAULTS.loadFactor) => {
|
|
@@ -23533,6 +23672,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23533
23672
|
var materials_default = [
|
|
23534
23673
|
{
|
|
23535
23674
|
id: "steel",
|
|
23675
|
+
splitForm: "sheets",
|
|
23536
23676
|
density: 7850,
|
|
23537
23677
|
hpPerKg: 400,
|
|
23538
23678
|
penetration: 110,
|
|
@@ -23656,6 +23796,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23656
23796
|
},
|
|
23657
23797
|
{
|
|
23658
23798
|
id: "aluminium",
|
|
23799
|
+
splitForm: "sheets",
|
|
23659
23800
|
density: 2700,
|
|
23660
23801
|
hpPerKg: 250,
|
|
23661
23802
|
penetration: 60,
|
|
@@ -23695,6 +23836,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23695
23836
|
},
|
|
23696
23837
|
{
|
|
23697
23838
|
id: "copper",
|
|
23839
|
+
splitForm: "sheets",
|
|
23698
23840
|
density: 8960,
|
|
23699
23841
|
hpPerKg: 300,
|
|
23700
23842
|
penetration: 70,
|
|
@@ -24189,6 +24331,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24189
24331
|
},
|
|
24190
24332
|
{
|
|
24191
24333
|
id: "plastic",
|
|
24334
|
+
splitForm: "plates",
|
|
24192
24335
|
density: 1100,
|
|
24193
24336
|
hpPerKg: 60,
|
|
24194
24337
|
penetration: 8,
|
|
@@ -24223,6 +24366,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24223
24366
|
},
|
|
24224
24367
|
{
|
|
24225
24368
|
id: "rubber",
|
|
24369
|
+
splitForm: "strips",
|
|
24226
24370
|
density: 1100,
|
|
24227
24371
|
hpPerKg: 80,
|
|
24228
24372
|
penetration: 12,
|
|
@@ -24255,6 +24399,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24255
24399
|
},
|
|
24256
24400
|
{
|
|
24257
24401
|
id: "fabric",
|
|
24402
|
+
splitForm: "strips",
|
|
24258
24403
|
density: 400,
|
|
24259
24404
|
hpPerKg: 20,
|
|
24260
24405
|
penetration: 0.8,
|
|
@@ -24352,6 +24497,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24352
24497
|
},
|
|
24353
24498
|
{
|
|
24354
24499
|
id: "leather",
|
|
24500
|
+
splitForm: "strips",
|
|
24355
24501
|
density: 900,
|
|
24356
24502
|
hpPerKg: 50,
|
|
24357
24503
|
penetration: 4,
|
|
@@ -24388,6 +24534,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24388
24534
|
},
|
|
24389
24535
|
{
|
|
24390
24536
|
id: "paper",
|
|
24537
|
+
splitForm: "strips",
|
|
24391
24538
|
density: 700,
|
|
24392
24539
|
hpPerKg: 8,
|
|
24393
24540
|
penetration: 0.3,
|
|
@@ -25316,21 +25463,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25316
25463
|
const r = [x[0], y[0], z[0], x[1], y[1], z[1], x[2], y[2], z[2]];
|
|
25317
25464
|
const half = new Float64Array(n * n);
|
|
25318
25465
|
const out = new Float64Array(n * n);
|
|
25319
|
-
for (let
|
|
25466
|
+
for (let block2 = 0; block2 < n; block2 += 3) {
|
|
25320
25467
|
for (let col = 0; col < n; col++) {
|
|
25321
25468
|
for (let i = 0; i < 3; i++) {
|
|
25322
25469
|
let sum2 = 0;
|
|
25323
|
-
for (let m = 0; m < 3; m++) sum2 += r[i * 3 + m] * k[(
|
|
25324
|
-
half[(
|
|
25470
|
+
for (let m = 0; m < 3; m++) sum2 += r[i * 3 + m] * k[(block2 + m) * n + col];
|
|
25471
|
+
half[(block2 + i) * n + col] = sum2;
|
|
25325
25472
|
}
|
|
25326
25473
|
}
|
|
25327
25474
|
}
|
|
25328
25475
|
for (let row = 0; row < n; row++) {
|
|
25329
|
-
for (let
|
|
25476
|
+
for (let block2 = 0; block2 < n; block2 += 3) {
|
|
25330
25477
|
for (let i = 0; i < 3; i++) {
|
|
25331
25478
|
let sum2 = 0;
|
|
25332
|
-
for (let m = 0; m < 3; m++) sum2 += half[row * n +
|
|
25333
|
-
out[row * n +
|
|
25479
|
+
for (let m = 0; m < 3; m++) sum2 += half[row * n + block2 + m] * r[i * 3 + m];
|
|
25480
|
+
out[row * n + block2 + i] = sum2;
|
|
25334
25481
|
}
|
|
25335
25482
|
}
|
|
25336
25483
|
}
|
|
@@ -25718,7 +25865,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25718
25865
|
const delta = new Float64Array(n);
|
|
25719
25866
|
for (let i = 0; i < n; i++) delta[i] = after2.u[i] - before.u[i];
|
|
25720
25867
|
for (const beam of beams.values()) if (!after2.standing.has(beam.part.id)) for (const node of beam.nodes) for (const dof of dofsOf(node)) delta[dof] = 0;
|
|
25721
|
-
|
|
25868
|
+
const potential = (x) => {
|
|
25869
|
+
let height = 0;
|
|
25870
|
+
for (let i = 0; i < n; i++) height += after2.load[i] * x[i];
|
|
25871
|
+
return frame2.shape.halfQuadratic(after2.structure, x) - height;
|
|
25872
|
+
};
|
|
25873
|
+
const had = new Float64Array(n);
|
|
25874
|
+
for (let i = 0; i < n; i++) had[i] = after2.u[i] - delta[i];
|
|
25875
|
+
released = Math.max(0, potential(had) - potential(after2.u));
|
|
25722
25876
|
spin = spinOf({ frame: frame2, after: after2, delta, released, centre: allCentre, mass: all, floor: floor2, g });
|
|
25723
25877
|
}
|
|
25724
25878
|
return {
|
|
@@ -25941,8 +26095,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25941
26095
|
if (worst > MECHANISM) return null;
|
|
25942
26096
|
const holding = feet.filter((_, index) => holds3[index]);
|
|
25943
26097
|
if (holding.length < 3) return null;
|
|
25944
|
-
|
|
25945
|
-
return { u: u.slice(), k: k.slice(), holding, masses, standing };
|
|
26098
|
+
return { u: u.slice(), structure, load: f, holding, masses, standing };
|
|
25946
26099
|
}
|
|
25947
26100
|
return null;
|
|
25948
26101
|
}
|
|
@@ -26171,7 +26324,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26171
26324
|
var TEAR_JOULES = 150;
|
|
26172
26325
|
var STRIP_THICKNESS = 15e-4;
|
|
26173
26326
|
var UNIT_FRAGMENT_FACTOR = 4;
|
|
26174
|
-
var BREACH_GRID_CAP = 4096;
|
|
26175
26327
|
var MASONRY_CRUMBLE_SPEED = 0.6;
|
|
26176
26328
|
var MASONRY_TOPPLE = 0.4;
|
|
26177
26329
|
var MASONRY_TOPPLE_MIN_HEIGHT = 0.5;
|
|
@@ -29789,7 +29941,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29789
29941
|
for (const i of out) worn[i] = -1;
|
|
29790
29942
|
return knockOutUnits(o, p, point, energy, out, src);
|
|
29791
29943
|
};
|
|
29792
|
-
const knockOutUnits = (o, p, wp, energy, out, src, d, drive = CHIP_DRIVE) => {
|
|
29944
|
+
const knockOutUnits = (o, p, wp, energy, out, src, d, drive = CHIP_DRIVE, severed) => {
|
|
29793
29945
|
var _a, _b;
|
|
29794
29946
|
const [u, v] = planeAxes(p.thin);
|
|
29795
29947
|
const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
|
|
@@ -29834,7 +29986,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29834
29986
|
setStage(o, p, 1, {}, src);
|
|
29835
29987
|
const center = toWorld(c, q, [(lo[0] + hi[0]) / 2, (lo[1] + hi[1]) / 2, (lo[2] + hi[2]) / 2]);
|
|
29836
29988
|
const units = cells.map((cell) => ({ center: toWorld(c, q, cell.center), size: [cell.size[0], cell.size[1], cell.size[2]] }));
|
|
29837
|
-
emit2({ ...base2(o, src), type: "chip", part: p.spec.id, center, size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]], rotation: q, fragments, units });
|
|
29989
|
+
emit2({ ...base2(o, src), type: "chip", part: p.spec.id, center, size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]], rotation: q, fragments, units, ...severed ? { severed } : {} });
|
|
29838
29990
|
debris2(o, p, p.mat.breakDebris, center, vec.normalize(vec.sub(center, wp), [0, 1, 0]), 14, 3, src);
|
|
29839
29991
|
const cut = wornLocally(p) && cutBandsGone(o, p, cells, d ?? vec.normalize(vec.sub(partXf(o, p).c, wp), [1, 0, 0]), src);
|
|
29840
29992
|
if (p.spec.reinforcement && !cut) exposeRebar(o, p, src);
|
|
@@ -29854,12 +30006,25 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29854
30006
|
const grid = gridOf(p);
|
|
29855
30007
|
const gone = p.rt.chips ?? {};
|
|
29856
30008
|
const worn = (_a = p.rt).bands ?? (_a.bands = {});
|
|
30009
|
+
const [u, v] = [0, 1, 2].filter((k) => k !== along3);
|
|
30010
|
+
const standing = (band) => grid.filter((cell, i) => gone[i] !== -1 && bandOf2(cell.center[along3]) === band);
|
|
30011
|
+
const bearOn = (a, b) => Math.abs(a.center[u] - b.center[u]) < (a.size[u] + b.size[u]) / 2 - 1e-6 && Math.abs(a.center[v] - b.center[v]) < (a.size[v] + b.size[v]) / 2 - 1e-6;
|
|
29857
30012
|
for (const band of new Set(cells.map((cell) => bandOf2(cell.center[along3])))) {
|
|
29858
30013
|
if ((worn[band] ?? 0) >= 1) continue;
|
|
30014
|
+
const left = standing(band);
|
|
29859
30015
|
const center = -p.dims[along3] / 2 + (band + 0.5) * height;
|
|
29860
|
-
if (
|
|
29861
|
-
|
|
29862
|
-
|
|
30016
|
+
if (left.length === 0) {
|
|
30017
|
+
worn[band] = 1;
|
|
30018
|
+
return giveAtCut(o, p, src, { at: alongAt(along3, center), d });
|
|
30019
|
+
}
|
|
30020
|
+
for (const next of [band - 1, band + 1]) {
|
|
30021
|
+
if (next < 0 || next >= bands || (worn[next] ?? 0) >= 1) continue;
|
|
30022
|
+
const beyond = standing(next);
|
|
30023
|
+
if (beyond.length === 0 || left.some((a) => beyond.some((b) => bearOn(a, b)))) continue;
|
|
30024
|
+
worn[band] = 1;
|
|
30025
|
+
worn[next] = 1;
|
|
30026
|
+
return giveAtCut(o, p, src, { at: alongAt(along3, (center + (-p.dims[along3] / 2 + (next + 0.5) * height)) / 2), d });
|
|
30027
|
+
}
|
|
29863
30028
|
}
|
|
29864
30029
|
return false;
|
|
29865
30030
|
};
|
|
@@ -30022,7 +30187,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30022
30187
|
const at4 = vec.madd(origin, d, s * vec.length(d));
|
|
30023
30188
|
debris2(o, p, "sparks", at4, vec.scale(d, -1), 6, 3, src);
|
|
30024
30189
|
});
|
|
30025
|
-
if (severed
|
|
30190
|
+
if (severed === 0) return;
|
|
30191
|
+
reyield(o, p, barsMoment(p), src);
|
|
30192
|
+
if (barsMoment(p) <= 0) dropAboveCut(o, p, origin, src);
|
|
30193
|
+
};
|
|
30194
|
+
const dropAboveCut = (o, p, wp, src) => {
|
|
30195
|
+
const cut = p.rt.hinges?.reduce((low, h) => Math.min(low, h.point[1]), Infinity) ?? Infinity;
|
|
30196
|
+
if (!Number.isFinite(cut)) return;
|
|
30197
|
+
const gone = p.rt.chips ?? {};
|
|
30198
|
+
const grid = gridOf(p);
|
|
30199
|
+
const above2 = grid.flatMap((cell, i) => gone[i] !== -1 && vec.add(p.pos, rotateVec(p.q, cell.center))[1] > cut ? [i] : []);
|
|
30200
|
+
if (above2.length === 0) return;
|
|
30201
|
+
const ax = [rotateVec(p.q, [1, 0, 0])[1], rotateVec(p.q, [0, 1, 0])[1], rotateVec(p.q, [0, 0, 1])[1]];
|
|
30202
|
+
const floor2 = Math.min(...above2.map((i) => {
|
|
30203
|
+
const cell = grid[i];
|
|
30204
|
+
return vec.add(p.pos, rotateVec(p.q, cell.center))[1] - (Math.abs(ax[0]) * cell.size[0] + Math.abs(ax[1]) * cell.size[1] + Math.abs(ax[2]) * cell.size[2]) / 2;
|
|
30205
|
+
}));
|
|
30206
|
+
knockOutUnits(o, p, wp, 0, above2, src, [0, -1, 0], 0, { point: [p.pos[0], floor2, p.pos[2]], normal: [0, 1, 0] });
|
|
30026
30207
|
};
|
|
30027
30208
|
const giveAtCut = (o, p, src, cut) => {
|
|
30028
30209
|
if (!p.spec.reinforcement || !p.spec.units || !p.st.chipped?.length || sectionLoss(p) <= 0) return false;
|
|
@@ -30116,7 +30297,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30116
30297
|
const unitPlan = p.spec.units ? unitFragmentPlan(p, maxFragments * UNIT_FRAGMENT_FACTOR) : [];
|
|
30117
30298
|
const axis2 = style === "splinter" || style === "snap" ? severAxis(p) : -1;
|
|
30118
30299
|
const cutAt3 = axis2 < 0 ? void 0 : p.rt.cutAt ?? (origin ? hitLocal[axis2] : void 0);
|
|
30119
|
-
const
|
|
30300
|
+
const woodForm = p.mat.splitForm === "slivers" || p.mat.splitForm === "plies" || p.mat.splitForm === "granules" ? p.mat.splitForm : void 0;
|
|
30301
|
+
const planRnd = woodForm ? splitStream(o.id, p.spec.id, hitLocal) : rnd2;
|
|
30120
30302
|
const plan = unitPlan.length > 0 ? unitPlan : planFragments({
|
|
30121
30303
|
style,
|
|
30122
30304
|
dims: p.dims,
|
|
@@ -30127,7 +30309,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30127
30309
|
maxFragments,
|
|
30128
30310
|
rnd: planRnd,
|
|
30129
30311
|
sheet: p.mat.sheet,
|
|
30130
|
-
...
|
|
30312
|
+
...woodForm ? { form: woodForm } : {},
|
|
30131
30313
|
...cutAt3 !== void 0 ? { cut: { at: cutAt3, gap: SEVER_BAND } } : {},
|
|
30132
30314
|
...p.spec.solids ? { solids: p.spec.solids } : {}
|
|
30133
30315
|
});
|
|
@@ -30611,18 +30793,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30611
30793
|
const confinementOf = (conf, point, radius) => {
|
|
30612
30794
|
if (conf === null) return 1;
|
|
30613
30795
|
if (typeof conf === "number") return conf;
|
|
30614
|
-
let
|
|
30796
|
+
let hits2 = 0;
|
|
30615
30797
|
let sum2 = 0;
|
|
30616
30798
|
for (const d of raysOf(Math.max(1, Math.round(conf.rays)))) {
|
|
30617
30799
|
const h = raycastInternal(point, d, radius * conf.reach, void 0, true);
|
|
30618
30800
|
if (h) {
|
|
30619
|
-
|
|
30801
|
+
hits2++;
|
|
30620
30802
|
sum2 += h.distance;
|
|
30621
30803
|
}
|
|
30622
30804
|
}
|
|
30623
|
-
if (
|
|
30624
|
-
const closed =
|
|
30625
|
-
const ratio = clamp2(radius / Math.max(sum2 /
|
|
30805
|
+
if (hits2 === 0) return 1;
|
|
30806
|
+
const closed = hits2 / Math.max(1, Math.round(conf.rays));
|
|
30807
|
+
const ratio = clamp2(radius / Math.max(sum2 / hits2, 1e-3), 0, 2);
|
|
30626
30808
|
return Math.min(Math.max(1, conf.max), 1 + conf.gain * closed ** conf.power * ratio);
|
|
30627
30809
|
};
|
|
30628
30810
|
const FLAG_LOST = 1;
|
|
@@ -33368,6 +33550,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33368
33550
|
else slab.y0 = round2(slab.y1 - thickness);
|
|
33369
33551
|
slab.mass = Math.max(1, Math.round((slab.aabb[2] - slab.aabb[0]) * (slab.aabb[3] - slab.aabb[1]) * (slab.y1 - slab.y0) * densityOf(slab.material)));
|
|
33370
33552
|
};
|
|
33553
|
+
function footprintWithin(leaf, footprint) {
|
|
33554
|
+
const out = [];
|
|
33555
|
+
for (const r of footprint) {
|
|
33556
|
+
const cut = [Math.max(leaf[0], r[0]), Math.max(leaf[1], r[1]), Math.min(leaf[2], r[2]), Math.min(leaf[3], r[3])];
|
|
33557
|
+
if (cut[2] - cut[0] > 1e-6 && cut[3] - cut[1] > 1e-6) out.push(cut);
|
|
33558
|
+
}
|
|
33559
|
+
return out;
|
|
33560
|
+
}
|
|
33371
33561
|
function cutSlab(context, slab, wallBoxes) {
|
|
33372
33562
|
const { options } = context;
|
|
33373
33563
|
const roof = slab.cover === true;
|
|
@@ -33396,7 +33586,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33396
33586
|
floor: slab.floor,
|
|
33397
33587
|
...slab.cover ? { cover: true } : {},
|
|
33398
33588
|
slab: slab.id,
|
|
33399
|
-
...slab.footprint ? { footprint: slab.footprint } : {}
|
|
33589
|
+
...slab.footprint ? { footprint: footprintWithin(leaf, slab.footprint) } : {}
|
|
33400
33590
|
})
|
|
33401
33591
|
);
|
|
33402
33592
|
context.parts.splice(context.parts.indexOf(slab), 1, ...panels);
|
|
@@ -33881,7 +34071,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33881
34071
|
return spec;
|
|
33882
34072
|
};
|
|
33883
34073
|
var MEMBER_CAGE = { spacing: 0.1, diameter: 0.01, unit: 0.1 };
|
|
33884
|
-
var CAGED_ROLES = /* @__PURE__ */ new Set(["beam", "column"]);
|
|
34074
|
+
var CAGED_ROLES = /* @__PURE__ */ new Set(["beam", "column", "slab"]);
|
|
33885
34075
|
var CAGE_COVER = 0.03;
|
|
33886
34076
|
var CAGE_BUCKLING_SHARE = 0.5;
|
|
33887
34077
|
var DEFAULT_RESIDUAL = 0.15;
|
|
@@ -46339,7 +46529,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
46339
46529
|
stack: 6,
|
|
46340
46530
|
shape: "cup",
|
|
46341
46531
|
color: 14215408,
|
|
46342
|
-
rarity: "common"
|
|
46532
|
+
rarity: "common",
|
|
46533
|
+
parts: [
|
|
46534
|
+
{
|
|
46535
|
+
id: "body",
|
|
46536
|
+
material: "glass",
|
|
46537
|
+
thickness: 3e-3
|
|
46538
|
+
}
|
|
46539
|
+
]
|
|
46343
46540
|
},
|
|
46344
46541
|
{
|
|
46345
46542
|
id: "cutlery",
|
|
@@ -53038,14 +53235,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53038
53235
|
var ITEM_CONTRACTS = createItemContracts();
|
|
53039
53236
|
var createGoodsKinds = (options = {}) => defineCategories(GOODS_KINDS, options);
|
|
53040
53237
|
var KINDS2 = createGoodsKinds();
|
|
53041
|
-
var
|
|
53238
|
+
var withKind = (item) => {
|
|
53042
53239
|
const kind = item.kind;
|
|
53043
|
-
|
|
53044
|
-
|
|
53240
|
+
if (!kind || !KINDS2.has(kind)) return item;
|
|
53241
|
+
const defaults = KINDS2.defaults(kind);
|
|
53242
|
+
const seal = defaults.seal;
|
|
53243
|
+
const parts2 = defaults.parts;
|
|
53244
|
+
const own = item.parts;
|
|
53245
|
+
return { ...item, ...seal ? { seal: { ...seal, ...item.seal } } : {}, ...!own && parts2 ? { parts: parts2 } : {} };
|
|
53045
53246
|
};
|
|
53046
53247
|
var goodsPack = {
|
|
53047
53248
|
id: "goods",
|
|
53048
|
-
items: GOODS_ITEMS.map(
|
|
53249
|
+
items: GOODS_ITEMS.map(withKind),
|
|
53049
53250
|
categories: GOODS_CATEGORIES,
|
|
53050
53251
|
places: GOODS_PLACES,
|
|
53051
53252
|
containers: GOODS_CONTAINERS,
|
|
@@ -56649,7 +56850,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56649
56850
|
worlds.set(world, info);
|
|
56650
56851
|
return world;
|
|
56651
56852
|
}
|
|
56652
|
-
function
|
|
56853
|
+
function pointOf3(world, fixtureId) {
|
|
56653
56854
|
const info = worlds.get(world);
|
|
56654
56855
|
return info ? info.points.get(fixtureId) : void 0;
|
|
56655
56856
|
}
|
|
@@ -56790,7 +56991,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56790
56991
|
if (info) for (const f of planned.fixtures) info.points.set(f.global, f.point);
|
|
56791
56992
|
return out;
|
|
56792
56993
|
}
|
|
56793
|
-
return { version: ADAPTER_VERSION, household: hh, plan, createWorld, add: add2, blockedOf, pointOf:
|
|
56994
|
+
return { version: ADAPTER_VERSION, household: hh, plan, createWorld, add: add2, blockedOf, pointOf: pointOf3, ownSpec, registries: { typeMap, contentMap, contentByGroup, chairTables, fixturesOfPoint, substitutes, preference, ownTypes } };
|
|
56794
56995
|
}
|
|
56795
56996
|
var FloorplanInteractables = { version: ADAPTER_VERSION, create: create2, TYPE_MAP, CONTENT_MAP, CONTENT_BY_GROUP, CHAIR_TABLES, PREFERENCE, mergeRegistry };
|
|
56796
56997
|
|
|
@@ -56870,21 +57071,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56870
57071
|
{ type: "buffet", category: "buffet", w: 1.6, d: 0.5, h: 0.9, opening: 0.45 },
|
|
56871
57072
|
{ type: "china_cabinet", category: "china_cabinet", w: 1.2, d: 0.45, h: 2, opening: 0.45 },
|
|
56872
57073
|
{ type: "stairs", category: "stairs", w: 1, d: 3.2, h: 2.8 },
|
|
56873
|
-
{ type: "planter_bed", category: "planter_bed", w: 3, d: 0.7, h: 0.4, color: { role: "dirt" } },
|
|
56874
|
-
{ type: "planter_bed_small", category: "planter_bed", w: 1.8, d: 0.6, h: 0.4, color: { role: "dirt" } },
|
|
57074
|
+
{ type: "planter_bed", category: "planter_bed", w: 3, d: 0.7, h: 0.4, color: { role: "dirt" }, material: "concrete" },
|
|
57075
|
+
{ type: "planter_bed_small", category: "planter_bed", w: 1.8, d: 0.6, h: 0.4, color: { role: "dirt" }, material: "concrete" },
|
|
56875
57076
|
{ type: "tree_small", category: "tree", w: 1.2, d: 1.2, h: 3, color: { role: "lawn" } },
|
|
56876
57077
|
{ type: "tree_large", category: "tree_large", w: 3, d: 3, h: 6, color: { role: "lawn" } },
|
|
56877
|
-
{ type: "shrub", category: "shrub", w: 0.8, d: 0.8, h: 0.9, color: { role: "lawn" } },
|
|
56878
|
-
{ type: "outdoor_pot", category: "outdoor_pot", w: 0.5, d: 0.5, h: 0.7 },
|
|
56879
|
-
{ type: "fountain", category: "fountain", w: 2, d: 2, h: 1.2 },
|
|
57078
|
+
{ type: "shrub", category: "shrub", w: 0.8, d: 0.8, h: 0.9, color: { role: "lawn" }, material: "foliage" },
|
|
57079
|
+
{ type: "outdoor_pot", category: "outdoor_pot", w: 0.5, d: 0.5, h: 0.7, material: "ceramic" },
|
|
57080
|
+
{ type: "fountain", category: "fountain", w: 2, d: 2, h: 1.2, material: "concrete" },
|
|
56880
57081
|
{ type: "garden_bench", category: "garden_bench", w: 1.5, d: 0.5, h: 0.5 },
|
|
56881
57082
|
{ type: "clothesline", category: "clothesline", w: 3.6, d: 0.4, h: 2 },
|
|
56882
57083
|
{ type: "bbq_grill", category: "bbq_grill", w: 1, d: 0.7, h: 1.4 },
|
|
56883
57084
|
{ type: "outbuilding", category: "outbuilding", w: 3.2, d: 3, h: 2.6 },
|
|
56884
57085
|
{ type: "doghouse", category: "doghouse", w: 0.6, d: 0.8, h: 0.7 },
|
|
56885
57086
|
{ type: "water_tank", category: "water_tank", w: 1, d: 1, h: 1.8 },
|
|
56886
|
-
{ type: "pool", category: "pool", w: 7, d: 3.5, h: 0, rim: 1.2, color: { role: "water" } },
|
|
56887
|
-
{ type: "pool_large", category: "pool", w: 9, d: 4.5, h: 0, rim: 1.2, color: { role: "water" } },
|
|
57087
|
+
{ type: "pool", category: "pool", w: 7, d: 3.5, h: 0, rim: 1.2, color: { role: "water" }, material: "concrete" },
|
|
57088
|
+
{ type: "pool_large", category: "pool", w: 9, d: 4.5, h: 0, rim: 1.2, color: { role: "water" }, material: "concrete" },
|
|
56888
57089
|
{ type: "sun_lounger", category: "sun_lounger", w: 0.7, d: 2, h: 0.4, deck: true },
|
|
56889
57090
|
{ type: "outdoor_table", category: "outdoor_table", w: 1.6, d: 1, h: 0.75, deck: true },
|
|
56890
57091
|
{ type: "gas_cylinder", category: "gas_cylinder", w: 0.35, d: 0.35, h: 0.6 },
|
|
@@ -56894,12 +57095,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56894
57095
|
{ type: "track_spot", category: "ceiling_light", w: 0.6, d: 0.1, h: 0.12, decor: true, mount: "ceiling", color: { role: "metal" } },
|
|
56895
57096
|
{ type: "chandelier", category: "ceiling_light", w: 0.7, d: 0.7, h: 0.6, decor: true, mount: "ceiling", color: { role: "metal" } },
|
|
56896
57097
|
{ type: "wall_ac", category: "air_conditioner", w: 0.9, d: 0.25, h: 0.28, decor: true, mount: "wall", color: { role: "ceiling" } },
|
|
56897
|
-
{ type: "ac_condenser", category: "ac_condenser", w: 0.8, d: 0.35, h: 0.6, decor: true, mount: "floor", color: { role: "ceiling" } },
|
|
57098
|
+
{ type: "ac_condenser", category: "ac_condenser", w: 0.8, d: 0.35, h: 0.6, decor: true, mount: "floor", color: { role: "ceiling" }, material: "steel" },
|
|
56898
57099
|
{ type: "picture_small", category: "picture", w: 0.4, d: 0.03, h: 0.5, decor: true, mount: "wall", color: { role: "picture_accent" } },
|
|
56899
57100
|
{ type: "picture_large", category: "picture", w: 0.9, d: 0.03, h: 0.6, decor: true, mount: "wall", color: { role: "picture_accent" } },
|
|
56900
|
-
{ type: "mirror", category: "picture", w: 0.6, d: 0.03, h: 0.9, decor: true, mount: "wall", color: { role: "metal" } },
|
|
56901
|
-
{ type: "floor_plant", category: "plant", w: 0.4, d: 0.4, h: 0.9, decor: true, mount: "floor", color: { role: "lawn" } },
|
|
56902
|
-
{ type: "table_plant", category: "plant", w: 0.2, d: 0.2, h: 0.3, decor: true, mount: "support", color: { role: "lawn" } },
|
|
57101
|
+
{ type: "mirror", category: "picture", w: 0.6, d: 0.03, h: 0.9, decor: true, mount: "wall", color: { role: "metal" }, material: "glass" },
|
|
57102
|
+
{ type: "floor_plant", category: "plant", w: 0.4, d: 0.4, h: 0.9, decor: true, mount: "floor", color: { role: "lawn" }, material: "ceramic" },
|
|
57103
|
+
{ type: "table_plant", category: "plant", w: 0.2, d: 0.2, h: 0.3, decor: true, mount: "support", color: { role: "lawn" }, material: "ceramic" },
|
|
56903
57104
|
{ type: "mailbox", category: "mailbox", w: 0.35, d: 0.3, h: 0.3, decor: true, mount: "wall_top", color: { role: "metal" } },
|
|
56904
57105
|
{ type: "table_lamp", category: "table_light", w: 0.36, d: 0.36, h: 0.5, decor: true, mount: "support", powered: true },
|
|
56905
57106
|
{ type: "hanging_plant", category: "plant", w: 0.3, d: 0.3, h: 0.7, decor: true, mount: "ceiling", color: { role: "lawn" } },
|
|
@@ -56914,11 +57115,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56914
57115
|
{ type: "gourmet_counter_small", category: "gourmet", w: 1.8, d: 0.65, h: 1, window: true, equip: ["bbq_grill", "kitchen_cabinet"] },
|
|
56915
57116
|
{ type: "gourmet_table", category: "gourmet", w: 2.8, d: 0.9, h: 0.78 },
|
|
56916
57117
|
{ type: "gourmet_table_small", category: "gourmet", w: 1.2, d: 0.9, h: 0.78 },
|
|
56917
|
-
{ type: "pool_small", category: "pool", w: 5, d: 2.6, h: 0, rim: 1.2, color: { role: "water" } },
|
|
56918
|
-
{ type: "pool_medium", category: "pool", w: 6, d: 3, h: 0, rim: 1.2, color: { role: "water" } },
|
|
57118
|
+
{ type: "pool_small", category: "pool", w: 5, d: 2.6, h: 0, rim: 1.2, color: { role: "water" }, material: "concrete" },
|
|
57119
|
+
{ type: "pool_medium", category: "pool", w: 6, d: 3, h: 0, rim: 1.2, color: { role: "water" }, material: "concrete" },
|
|
56919
57120
|
{ type: "deck", category: "deck", w: 3, d: 2, h: 0.15, flat: true, deck: true, color: { role: "deck_floor" } },
|
|
56920
|
-
{ type: "garden_bed", category: "garden_bed", w: 2, d: 0.8, h: 0.3, color: { role: "dirt" } },
|
|
56921
|
-
{ type: "fruit_tree", category: "tree", w: 2.2, d: 2.2, h: 3.5, color: { role: "lawn" } },
|
|
57121
|
+
{ type: "garden_bed", category: "garden_bed", w: 2, d: 0.8, h: 0.3, color: { role: "dirt" }, material: "concrete" },
|
|
57122
|
+
{ type: "fruit_tree", category: "tree", w: 2.2, d: 2.2, h: 3.5, color: { role: "lawn" }, material: "foliage" },
|
|
56922
57123
|
{ type: "palm_tree", category: "tree", w: 1.2, d: 1.2, h: 4, color: { role: "lawn" } },
|
|
56923
57124
|
{ type: "pergola", category: "pergola", w: 3.6, d: 3.2, h: 2.4, flat: true, mount: "roof", color: { role: "deck_floor" } },
|
|
56924
57125
|
{ type: "bbq_simple", category: "bbq_simple", w: 0.8, d: 0.6, h: 1.2 },
|
|
@@ -57985,7 +58186,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57985
58186
|
}
|
|
57986
58187
|
var residentialTower = residentialTowerTemplate();
|
|
57987
58188
|
|
|
57988
|
-
// ../game-floorplan-three/dist/chunk-
|
|
58189
|
+
// ../game-floorplan-three/dist/chunk-3EJGIA6V.js
|
|
57989
58190
|
var __defProp4 = Object.defineProperty;
|
|
57990
58191
|
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
57991
58192
|
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -57995,6 +58196,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57995
58196
|
"prompt.lockedDoor": "E: locked door",
|
|
57996
58197
|
"prompt.lightOn": "E: turn on the light",
|
|
57997
58198
|
"prompt.lightOff": "E: turn off the light",
|
|
58199
|
+
"prompt.sit": "E: sit",
|
|
58200
|
+
"prompt.lie": "E: lie down",
|
|
57998
58201
|
"what.door": "the door",
|
|
57999
58202
|
"what.curtain": "the curtain",
|
|
58000
58203
|
"what.mailbox": "the mailbox",
|
|
@@ -58021,6 +58224,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58021
58224
|
"prompt.lockedDoor": "E: porta trancada",
|
|
58022
58225
|
"prompt.lightOn": "E: acender a luz",
|
|
58023
58226
|
"prompt.lightOff": "E: apagar a luz",
|
|
58227
|
+
"prompt.sit": "E: sentar",
|
|
58228
|
+
"prompt.lie": "E: deitar",
|
|
58024
58229
|
"what.door": "a porta",
|
|
58025
58230
|
"what.curtain": "a cortina",
|
|
58026
58231
|
"what.mailbox": "a caixa de correio",
|
|
@@ -62893,10 +63098,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62893
63098
|
const walled = applyPanels(slabbed, rawStructure, "panels", slabOptions && rawStructure.construction.frame.rebar ? (span) => beamDepthFor(span, slabOptions) : void 0);
|
|
62894
63099
|
return (slabOptions ? deepenBondBeams(walled, rawStructure, slabOptions) : walled).parts;
|
|
62895
63100
|
}
|
|
62896
|
-
function addFrameBox(THREE, parent, box5, mat, id,
|
|
62897
|
-
for (const b of
|
|
63101
|
+
function addFrameBox(THREE, parent, box5, mat, id, block2) {
|
|
63102
|
+
for (const b of block2.length ? outsideBoxes(box5, block2) : [box5]) addStageBox(THREE, parent, b[0], b[1], b[2], b[3], b[4], b[5], mat, id);
|
|
62898
63103
|
}
|
|
62899
|
-
function buildStructuralStageGroups(THREE, rawStructure, outbuildings, runs = [],
|
|
63104
|
+
function buildStructuralStageGroups(THREE, rawStructure, outbuildings, runs = [], block2 = []) {
|
|
62900
63105
|
const foundation = new THREE.Group();
|
|
62901
63106
|
foundation.name = "stage:1:foundation";
|
|
62902
63107
|
const frame2 = new THREE.Group();
|
|
@@ -62937,15 +63142,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62937
63142
|
seatSlabs(slabs.filter((s) => !s.id.startsWith("tank_")), [...beams, ...columns.filter((c) => !c.tank)], beams);
|
|
62938
63143
|
for (const c of columns) {
|
|
62939
63144
|
const mat = c.material === "wood_soft" || c.material === "wood_hard" ? mats.wood : c.material === "steel" ? mats.sheet : mats.concrete;
|
|
62940
|
-
addFrameBox(THREE, frame2, [c.aabb[0], c.y0, c.aabb[1], c.aabb[2], c.y1, c.aabb[3]], mat, c.id,
|
|
63145
|
+
addFrameBox(THREE, frame2, [c.aabb[0], c.y0, c.aabb[1], c.aabb[2], c.y1, c.aabb[3]], mat, c.id, block2);
|
|
62941
63146
|
if (c.tank || c.y0 > 0.1 || c.material !== "concrete") continue;
|
|
62942
63147
|
if (c.floor === 0) addRebarCage(THREE, starterBars, c.aabb, 0, 0.42, mats.rebar);
|
|
62943
63148
|
}
|
|
62944
63149
|
for (const b of beams) {
|
|
62945
63150
|
const p = beamParts.find((x) => x.id === b.id);
|
|
62946
|
-
addFrameBox(THREE, frame2, [b.aabb[0], b.y0, b.aabb[1], b.aabb[2], b.y1, b.aabb[3]], p && (p.material === "wood_soft" || p.material === "wood_hard") ? mats.wood : mats.concrete, b.id,
|
|
63151
|
+
addFrameBox(THREE, frame2, [b.aabb[0], b.y0, b.aabb[1], b.aabb[2], b.y1, b.aabb[3]], p && (p.material === "wood_soft" || p.material === "wood_hard") ? mats.wood : mats.concrete, b.id, block2);
|
|
62947
63152
|
}
|
|
62948
|
-
for (const s of slabs) addFrameBox(THREE, frame2, [s.aabb[0], s.y0, s.aabb[1], s.aabb[2], s.y1, s.aabb[3]], mats.concrete, s.id,
|
|
63153
|
+
for (const s of slabs) addFrameBox(THREE, frame2, [s.aabb[0], s.y0, s.aabb[1], s.aabb[2], s.y1, s.aabb[3]], mats.concrete, s.id, block2);
|
|
62949
63154
|
const wallCores = wallParts.filter(isMasonry).map((w) => {
|
|
62950
63155
|
const line = wallLineOf(w.aabb), width = coreWidthOf(line.thickness, unit), centre = coreLineOf(line, w, columns, width);
|
|
62951
63156
|
return { ...solidOf(w), aabb: line.alongU ? [w.aabb[0], centre - width / 2, w.aabb[2], centre + width / 2] : [centre - width / 2, w.aabb[1], centre + width / 2, w.aabb[3]] };
|
|
@@ -63329,7 +63534,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63329
63534
|
}
|
|
63330
63535
|
return 0;
|
|
63331
63536
|
};
|
|
63332
|
-
const
|
|
63537
|
+
const boundsOf2 = (roomId, x, z) => {
|
|
63333
63538
|
const rects = shared3.ctx.roomById[roomId ?? ""]?.parts ?? [], rect = rects.find((r) => r[0] <= x && x <= r[2] && r[1] <= z && z <= r[3]) ?? rects[0];
|
|
63334
63539
|
return rect ? [rect[0] + WALL_HALF, rect[1] + WALL_HALF, rect[2] - WALL_HALF, rect[3] - WALL_HALF] : [-Infinity, -Infinity, Infinity, Infinity];
|
|
63335
63540
|
};
|
|
@@ -63355,7 +63560,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63355
63560
|
const fittings = [
|
|
63356
63561
|
...lights.map((it) => {
|
|
63357
63562
|
const ceiling = ceilingOf(it), kind = lampOf.get(it.id) ?? DEFAULT_LAMP_TYPE, lamp = kind === "sconce" ? DEFAULT_LAMP_TYPE : kind;
|
|
63358
|
-
const layout = lamp === "tube_t8" ? tubeLayoutOf(it.x, it.z,
|
|
63563
|
+
const layout = lamp === "tube_t8" ? tubeLayoutOf(it.x, it.z, boundsOf2(it.room, it.x, it.z)) : { alongU: true, span: SOCKET_SIZE.t8.spans[0] }, params = { lamp, x: it.x, z: it.z, ...layout };
|
|
63359
63564
|
return { id: it.id, lamp: kind, rough: ceilingSocketParts({ ...params, mountY: undersideAt(it.x, it.z, ceiling) }), finished: ceilingSocketParts({ ...params, mountY: ceiling }) };
|
|
63360
63565
|
}),
|
|
63361
63566
|
...sconces.map((lampPoint) => {
|
|
@@ -65739,6 +65944,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65739
65944
|
const defined = { NO_COLLIDE, registerCollision, objectDistance, collideObject, collideAt, walkInSolids, kitCollides };
|
|
65740
65945
|
Object.assign(K, defined);
|
|
65741
65946
|
}
|
|
65947
|
+
var PELVIS_FROM_HEAD = 0.95;
|
|
65948
|
+
var SWING_SEAT = 0.45;
|
|
65949
|
+
var SAUNA_BENCH = 0.45;
|
|
65950
|
+
var TUB_FLOOR = 0.12;
|
|
65951
|
+
var PLAN_FURNITURE_SEATS = {
|
|
65952
|
+
sun_lounger: ({ w, d, h }) => [{ id: "lie", pose: "lie", pos: [0, h, -d / 2 + PELVIS_FROM_HEAD], ry: 0, eye: 0.2, exit: [w / 2 + 0.5, 0, 0] }],
|
|
65953
|
+
swing: ({ d }) => [{ id: "seat", pose: "sit", pos: [0, SWING_SEAT, 0], ry: 0, exit: [0, 0, d / 2 + 0.6] }],
|
|
65954
|
+
soaking_tub: ({ d }) => [{ id: "seat", pose: "sit", pos: [0, TUB_FLOOR, -d / 6], ry: 0, exit: [0, 0, d / 2 + 0.5] }],
|
|
65955
|
+
sauna: ({ d }) => [{ id: "bench", pose: "sit", pos: [0, SAUNA_BENCH, -d / 4], ry: 0, exit: [0, 0, d / 2 + 0.5] }]
|
|
65956
|
+
};
|
|
65957
|
+
var planFurnitureSeats = (type, size) => PLAN_FURNITURE_SEATS[type]?.(size) ?? [];
|
|
65742
65958
|
function installInteractionItems(K, shared3) {
|
|
65743
65959
|
const { t, LIGHTS, cursor, definePiece, localOf, registerCollision, togglePiece } = K;
|
|
65744
65960
|
const DOOR_ITEM = /^(tv_unit|tv_unit_small|tv_unit_large|sideboard|china_cabinet|filing_cabinet|pantry|laundry_cabinet|wardrobe|wardrobe_small|wardrobe_large|closet_wardrobe|kitchen_cabinet|kitchen_cabinet_large|kitchen_cabinet_small|fridge|fridge_large|display_fridge_medium|display_fridge)$/;
|
|
@@ -65758,11 +65974,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65758
65974
|
function buildItem2(m, M, ent, api, parent) {
|
|
65759
65975
|
registerCollision(m, M);
|
|
65760
65976
|
const type = m.type;
|
|
65977
|
+
seatItem(m, M);
|
|
65761
65978
|
if (LIGHT_TYPES.has(type)) return lightItem(m, M, ent, api, parent);
|
|
65762
65979
|
if (type === "curtain") return curtainItem(m, M, ent, api, parent);
|
|
65763
65980
|
if (DOOR_ITEM.test(type) || DRAWER_ITEM.test(type)) return furnitureItem(m, M, ent, api, parent, DRAWER_ITEM.test(type));
|
|
65764
65981
|
ent.f(M, api);
|
|
65765
65982
|
}
|
|
65983
|
+
function seatItem(m, M) {
|
|
65984
|
+
const seats = planFurnitureSeats(m.type, { w: M.w, d: M.d, h: M.h });
|
|
65985
|
+
const first = seats[0];
|
|
65986
|
+
if (!first) return;
|
|
65987
|
+
const base2 = M.base + (M.y || 0), [ax, az] = localOf(M, first.pos[0], first.pos[2]);
|
|
65988
|
+
I().items.push({ type: "seat", id: m.id, floor: M.floor, anchor: [ax, base2 + first.pos[1], az], range: 1.6, angle: 1.1, pieces: [], seats, mount: { x: M.x, y: base2, z: M.z, ry: M.ry }, text: () => t(first.pose === "lie" ? "prompt.lie" : "prompt.sit"), action: () => void 0 });
|
|
65989
|
+
}
|
|
65766
65990
|
function lightItem(m, M, ent, api, parent) {
|
|
65767
65991
|
M.on = M.light = M.lit = true;
|
|
65768
65992
|
const n0 = LIGHTS.length, name = shared3.quality === "game" ? "ix:light:" + m.room + "@" + parent : "ix:light:" + m.id;
|
|
@@ -67597,7 +67821,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67597
67821
|
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;
|
|
67598
67822
|
const cage = bars ? pc.role === "column" && sp.shape.kind === "box" ? { ...bars, residualCapacity: cageResidualCapacity(sp.shape.size, bars, sp.structure?.capacity) } : { ...bars } : null;
|
|
67599
67823
|
const out = cage && !sp.reinforcement ? { ...sp, reinforcement: cage } : sp;
|
|
67600
|
-
if (out.reinforcement && !out.units && pc.material === "concrete" && (pc.role
|
|
67824
|
+
if (out.reinforcement && !out.units && pc.material === "concrete" && CAGED_ROLES.has(pc.role) && sp.shape.kind === "box") {
|
|
67601
67825
|
return { ...out, units: { size: [MEMBER_CAGE.unit, MEMBER_CAGE.unit, Math.min(...sp.shape.size)], bond: "stack", mortar: "concrete" } };
|
|
67602
67826
|
}
|
|
67603
67827
|
return out;
|
|
@@ -67660,6 +67884,25 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67660
67884
|
if (distance4 <= -depth) return true;
|
|
67661
67885
|
return distance4 <= -depth * noise3();
|
|
67662
67886
|
}
|
|
67887
|
+
var WALL_ALONG_U = { along: 0, up: 1, across: 2 };
|
|
67888
|
+
var WALL_ALONG_V = { along: 2, up: 1, across: 0 };
|
|
67889
|
+
var LYING = { along: 0, up: 2, across: 1 };
|
|
67890
|
+
function extentOf(part, axis2) {
|
|
67891
|
+
if (axis2 === 1) return [part.y0, part.y1];
|
|
67892
|
+
return axis2 === 0 ? [part.aabb[0], part.aabb[2]] : [part.aabb[1], part.aabb[3]];
|
|
67893
|
+
}
|
|
67894
|
+
function planeAxesOf(part) {
|
|
67895
|
+
const [u0, v0, u1, v1] = part.aabb;
|
|
67896
|
+
if (thinAxisOf([u1 - u0, part.y1 - part.y0, v1 - v0]) === 1) return LYING;
|
|
67897
|
+
return u1 - u0 >= v1 - v0 ? WALL_ALONG_U : WALL_ALONG_V;
|
|
67898
|
+
}
|
|
67899
|
+
function pointOf2(axes, along22, up, across2) {
|
|
67900
|
+
const out = [0, 0, 0];
|
|
67901
|
+
out[axes.along] = along22;
|
|
67902
|
+
out[axes.up] = up;
|
|
67903
|
+
out[axes.across] = across2;
|
|
67904
|
+
return out;
|
|
67905
|
+
}
|
|
67663
67906
|
var JOINT_SHARE = 0.5;
|
|
67664
67907
|
var EPSILON22 = 1e-4;
|
|
67665
67908
|
function carve(boxes, grid) {
|
|
@@ -67769,11 +68012,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67769
68012
|
const boxes = part.gone?.length ? subtract2(mergeSpans(part.spans), part.gone) : mergeSpans(part.spans);
|
|
67770
68013
|
for (const s of line.open ? mergeSpans(carve(boxes, line.open), 0) : boxes) {
|
|
67771
68014
|
const along22 = line.start + (s.a + s.b) / 2;
|
|
67772
|
-
point.set(line.
|
|
67773
|
-
const
|
|
68015
|
+
point.set(...pointOf2(line.axes, along22, (s.y0 + s.y1) / 2, part.mid)).applyMatrix4(toMesh);
|
|
68016
|
+
const [hx, hy, hz2] = pointOf2(line.axes, (s.b - s.a) / 2, (s.y1 - s.y0) / 2, part.thick / 2);
|
|
67774
68017
|
out.push({
|
|
67775
68018
|
center: [point.x, point.y, point.z],
|
|
67776
|
-
half: [
|
|
68019
|
+
half: [hx * scale.x, hy * scale.y, hz2 * scale.z],
|
|
67777
68020
|
rotation: [turn2.x, turn2.y, turn2.z, turn2.w],
|
|
67778
68021
|
kind: "box"
|
|
67779
68022
|
});
|
|
@@ -67831,6 +68074,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67831
68074
|
var SPALL_MIN = 0.025;
|
|
67832
68075
|
var SPALL_RAGGED = 0.045;
|
|
67833
68076
|
var PLASTER_REACH = { least: SPALL_MIN, band: SPALL_RAGGED };
|
|
68077
|
+
var CAST_GAP = 2e-3;
|
|
67834
68078
|
var COVER2 = 0.015;
|
|
67835
68079
|
var LUMP_BAR_INSET = 0.035;
|
|
67836
68080
|
var LUMPS_PER_BAR = 1;
|
|
@@ -67849,6 +68093,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67849
68093
|
if (hi[0] - lo[0] <= 1e-4 || hi[1] - lo[1] <= 1e-4 || hi[2] - lo[2] <= 1e-4) return null;
|
|
67850
68094
|
return { x: (lo[0] + hi[0]) / 2, y: (lo[1] + hi[1]) / 2, z: (lo[2] + hi[2]) / 2, sx: hi[0] - lo[0], sy: hi[1] - lo[1], sz: hi[2] - lo[2], colour: unit.colour };
|
|
67851
68095
|
}
|
|
68096
|
+
var axisVector = (axis2) => [axis2 === 0 ? 1 : 0, axis2 === 1 ? 1 : 0, axis2 === 2 ? 1 : 0];
|
|
68097
|
+
function unitBoxOf(axes, centre, size, colour) {
|
|
68098
|
+
const [x, y, z] = pointOf2(axes, centre[0], centre[1], centre[2]), [sx, sy, sz] = pointOf2(axes, size[0], size[1], size[2]);
|
|
68099
|
+
return { x, y, z, sx, sy, sz, colour };
|
|
68100
|
+
}
|
|
68101
|
+
function coatedInside(bounds2, axes) {
|
|
68102
|
+
const inner = [...bounds2];
|
|
68103
|
+
inner[axes.along] = bounds2[axes.along] + COVER2;
|
|
68104
|
+
inner[axes.along + 3] = bounds2[axes.along + 3] - COVER2;
|
|
68105
|
+
inner[axes.up + 3] = bounds2[axes.up + 3] - COVER2;
|
|
68106
|
+
if (axes.up !== 1) inner[axes.up] = bounds2[axes.up] + COVER2;
|
|
68107
|
+
return inner;
|
|
68108
|
+
}
|
|
67852
68109
|
function installDestructionBreach(K, _shared) {
|
|
67853
68110
|
const { THREE, fragmentMaterial, invalidate, invalidateShadow } = K;
|
|
67854
68111
|
const paintState = { attached: false };
|
|
@@ -68017,13 +68274,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68017
68274
|
hasStrike = true;
|
|
68018
68275
|
};
|
|
68019
68276
|
function cells(part, units, mask) {
|
|
68020
|
-
const [
|
|
68021
|
-
const
|
|
68022
|
-
const
|
|
68023
|
-
const
|
|
68024
|
-
const [
|
|
68025
|
-
const rows = Math.max(1, Math.round((
|
|
68026
|
-
const rowH = (
|
|
68277
|
+
const [a0, a1] = extentOf(part, mask.axes.along), [up0, up1] = extentOf(part, mask.axes.up);
|
|
68278
|
+
const len = a1 - a0;
|
|
68279
|
+
const offset = a0 - mask.start;
|
|
68280
|
+
const merge = Math.max(1, Math.ceil(Math.sqrt(Math.max(1, Math.round((up1 - up0) / units.size[1])) * Math.max(1, Math.round(len / units.size[0])) / BREACH_GRID_CAP)));
|
|
68281
|
+
const ul = units.size[0] * merge, uh = units.size[1] * merge;
|
|
68282
|
+
const rows = Math.max(1, Math.round((up1 - up0) / uh));
|
|
68283
|
+
const rowH = (up1 - up0) / rows;
|
|
68027
68284
|
const per = Math.max(1, Math.round(len / ul));
|
|
68028
68285
|
const w = len / per;
|
|
68029
68286
|
const out = [];
|
|
@@ -68031,7 +68288,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68031
68288
|
const shift = units.bond === "running" && r & 1 ? w / 2 : 0;
|
|
68032
68289
|
for (let i = 0; i < per + (shift ? 1 : 0); i++) {
|
|
68033
68290
|
const a = Math.max(0, i * w - shift), b = Math.min(len, i * w - shift + w);
|
|
68034
|
-
if (b - a > 1e-3) out.push({ a: offset + a, b: offset + b, y0:
|
|
68291
|
+
if (b - a > 1e-3) out.push({ a: offset + a, b: offset + b, y0: up0 + r * rowH, y1: up0 + (r + 1) * rowH, r, i });
|
|
68035
68292
|
}
|
|
68036
68293
|
}
|
|
68037
68294
|
return out;
|
|
@@ -68099,8 +68356,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68099
68356
|
return [...first, ...other];
|
|
68100
68357
|
}
|
|
68101
68358
|
const pillarSpans = (view) => structure.parts.filter((q) => q.role === "column" && wallsAround(q).includes(view.host)).map((q) => {
|
|
68102
|
-
const
|
|
68103
|
-
return { a, b
|
|
68359
|
+
const [from, to] = extentOf(q, view.mask.axes.along), [y0, y1] = extentOf(q, view.mask.axes.up);
|
|
68360
|
+
return { a: from - view.mask.start, b: to - view.mask.start, y0, y1 };
|
|
68104
68361
|
});
|
|
68105
68362
|
const windowGaps = (view) => (structure.openings ?? []).filter((o) => o.kind === "window" && o.wall === view.host).map((o) => ({ a: Math.min(o.from, o.to) - view.mask.start, b: Math.max(o.from, o.to) - view.mask.start, y0: o.y0, y1: o.y1 }));
|
|
68106
68363
|
function outsideGaps(c, gaps) {
|
|
@@ -68149,9 +68406,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68149
68406
|
sh.uniforms.uToHouse = toHouse;
|
|
68150
68407
|
sh.uniforms.uMask = { value: mask.texture };
|
|
68151
68408
|
sh.uniforms.uMaskRect = { value: mask.rect };
|
|
68152
|
-
sh.uniforms.
|
|
68409
|
+
sh.uniforms.uMaskAlong = { value: axisVector(mask.axes.along) };
|
|
68410
|
+
sh.uniforms.uMaskUp = { value: axisVector(mask.axes.up) };
|
|
68153
68411
|
sh.vertexShader = sh.vertexShader.replace("void main() {", "uniform mat4 uToHouse;\nvarying vec3 vHousePos;\nvoid main() {").replace("#include <begin_vertex>", "#include <begin_vertex>\nvHousePos = (uToHouse * vec4(transformed, 1.0)).xyz;");
|
|
68154
|
-
sh.fragmentShader = sh.fragmentShader.replace("void main() {", "uniform sampler2D uMask;\nuniform vec4 uMaskRect;\nuniform
|
|
68412
|
+
sh.fragmentShader = sh.fragmentShader.replace("void main() {", "uniform sampler2D uMask;\nuniform vec4 uMaskRect;\nuniform vec3 uMaskAlong;\nuniform vec3 uMaskUp;\nvarying vec3 vHousePos;\nvoid main() {\n vec2 mUv = vec2((dot(vHousePos, uMaskAlong) - uMaskRect.x) / uMaskRect.z, (dot(vHousePos, uMaskUp) - uMaskRect.y) / uMaskRect.w);\n if (mUv.x >= 0.0 && mUv.x <= 1.0 && mUv.y >= 0.0 && mUv.y <= 1.0 && texture2D(uMask, mUv).r > 0.5) discard;");
|
|
68155
68413
|
};
|
|
68156
68414
|
material.customProgramCacheKey = () => "breachMask" + (base2.customProgramCacheKey?.() ?? "");
|
|
68157
68415
|
const mesh3 = new THREE.Mesh(g, material);
|
|
@@ -68159,7 +68417,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68159
68417
|
mesh3.userData.breachMask = mask;
|
|
68160
68418
|
mesh3.userData.cutAt = (p) => {
|
|
68161
68419
|
const v = local2([p.x, p.y, p.z]);
|
|
68162
|
-
const i = Math.floor((
|
|
68420
|
+
const i = Math.floor((v[mask.axes.along] - mask.start) / mask.len * mask.w), j = Math.floor((v[mask.axes.up] - mask.y0) / mask.height * mask.h);
|
|
68163
68421
|
return i >= 0 && i < mask.w && j >= 0 && j < mask.h && mask.data[j * mask.w + i] > 127;
|
|
68164
68422
|
};
|
|
68165
68423
|
mesh3.position.copy(it.mesh.position);
|
|
@@ -68186,9 +68444,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68186
68444
|
material.onBeforeCompile = (sh) => {
|
|
68187
68445
|
sh.uniforms.uCore = { value: core.texture };
|
|
68188
68446
|
sh.uniforms.uCoreRect = { value: core.rect };
|
|
68189
|
-
sh.uniforms.
|
|
68447
|
+
sh.uniforms.uCoreAlong = { value: axisVector(core.axes.along) };
|
|
68448
|
+
sh.uniforms.uCoreUp = { value: axisVector(core.axes.up) };
|
|
68190
68449
|
sh.vertexShader = sh.vertexShader.replace("void main() {", "varying vec3 vHousePos;\nvoid main() {").replace("#include <begin_vertex>", "#include <begin_vertex>\n#ifdef USE_INSTANCING\nvHousePos = (instanceMatrix * vec4(transformed, 1.0)).xyz;\n#else\nvHousePos = transformed;\n#endif");
|
|
68191
|
-
sh.fragmentShader = sh.fragmentShader.replace("void main() {", "uniform sampler2D uCore;\nuniform vec4 uCoreRect;\nuniform
|
|
68450
|
+
sh.fragmentShader = sh.fragmentShader.replace("void main() {", "uniform sampler2D uCore;\nuniform vec4 uCoreRect;\nuniform vec3 uCoreAlong;\nuniform vec3 uCoreUp;\nvarying vec3 vHousePos;\nvoid main() {\n vec2 cUv = vec2((dot(vHousePos, uCoreAlong) - uCoreRect.x) / uCoreRect.z, (dot(vHousePos, uCoreUp) - uCoreRect.y) / uCoreRect.w);\n if (cUv.x >= 0.0 && cUv.x <= 1.0 && cUv.y >= 0.0 && cUv.y <= 1.0 && texture2D(uCore, cUv).r > 0.5) discard;").replace("#include <color_fragment>", "#include <color_fragment>\nif (!gl_FrontFacing) diffuseColor.rgb *= 0.55;");
|
|
68192
68451
|
};
|
|
68193
68452
|
material.customProgramCacheKey = () => "breachCore";
|
|
68194
68453
|
material.userData.breachCore = core;
|
|
@@ -68207,17 +68466,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68207
68466
|
}
|
|
68208
68467
|
function maskOf(hostId, parts2) {
|
|
68209
68468
|
const host = structure.byId.get(hostId);
|
|
68210
|
-
const
|
|
68211
|
-
const
|
|
68212
|
-
const y0 = Math.min(...parts2.map((id) => structure.byId.get(id).
|
|
68213
|
-
const len =
|
|
68469
|
+
const axes = planeAxesOf(host);
|
|
68470
|
+
const [start, end3] = extentOf(host, axes.along);
|
|
68471
|
+
const y0 = Math.min(...parts2.map((id) => extentOf(structure.byId.get(id), axes.up)[0])), y1 = Math.max(...parts2.map((id) => extentOf(structure.byId.get(id), axes.up)[1]));
|
|
68472
|
+
const len = end3 - start;
|
|
68214
68473
|
const w = Math.max(2, Math.min(2048, Math.ceil(len / MASK_TEXEL))), h = Math.max(2, Math.min(1024, Math.ceil((y1 - y0) / MASK_TEXEL)));
|
|
68215
68474
|
const data = new Uint8Array(w * h);
|
|
68216
68475
|
const texture = new THREE.DataTexture(data, w, h, THREE.RedFormat);
|
|
68217
68476
|
texture.magFilter = THREE.LinearFilter;
|
|
68218
68477
|
texture.minFilter = THREE.LinearFilter;
|
|
68219
68478
|
texture.needsUpdate = true;
|
|
68220
|
-
return { data, texture, w, h,
|
|
68479
|
+
return { data, texture, w, h, axes, start, len, y0, height: y1 - y0, rect: new THREE.Vector4(start, y0, len, y1 - y0) };
|
|
68221
68480
|
}
|
|
68222
68481
|
function besidePillars(c, pillars) {
|
|
68223
68482
|
let { a, b } = c;
|
|
@@ -68246,13 +68505,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68246
68505
|
}
|
|
68247
68506
|
function splitUnits(view, id, around) {
|
|
68248
68507
|
const { mask } = view;
|
|
68249
|
-
const along22 = (p) =>
|
|
68508
|
+
const along22 = (p) => p[mask.axes.along] - mask.start;
|
|
68509
|
+
const upOf = (p) => p[mask.axes.up];
|
|
68250
68510
|
const part = structure.byId.get(id), units = specOf(id).units, chips2 = view.chips.get(id), opening = view.openings.get(id);
|
|
68251
68511
|
const own = cells(part, units, mask);
|
|
68252
68512
|
const all = (id === view.host ? own.flatMap((c) => besidePillars(c, around.pillars)) : own).flatMap((c) => outsideGaps(c, around.gaps));
|
|
68253
68513
|
const holes = [], kept = [];
|
|
68254
68514
|
if (view.fallen.has(id)) return { all, kept, holes: all, boxes: [] };
|
|
68255
|
-
const boxes = chips2.map((k) => ({ s0: along22(k.center) - k.along, s1: along22(k.center) + k.along, y0: k.center
|
|
68515
|
+
const boxes = chips2.map((k) => ({ s0: along22(k.center) - k.along, s1: along22(k.center) + k.along, y0: upOf(k.center) - k.up, y1: upOf(k.center) + k.up }));
|
|
68256
68516
|
const gone = (c) => {
|
|
68257
68517
|
const over = boxes.filter((k) => k.s1 > c.a && k.s0 < c.b && k.y1 > c.y0 && k.y0 < c.y1);
|
|
68258
68518
|
const share = covered(c, over);
|
|
@@ -68260,7 +68520,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68260
68520
|
const s = (c.a + c.b) / 2, y = (c.y0 + c.y1) / 2;
|
|
68261
68521
|
return share >= 0.5 && over.some((k) => s >= k.s0 && s <= k.s1 && y >= k.y0 && y <= k.y1);
|
|
68262
68522
|
};
|
|
68263
|
-
const open = (c) => gone(c) || opening !== void 0 && Math.hypot((c.a + c.b) / 2 - along22(opening.center), (c.y0 + c.y1) / 2 - opening.center
|
|
68523
|
+
const open = (c) => gone(c) || opening !== void 0 && Math.hypot((c.a + c.b) / 2 - along22(opening.center), (c.y0 + c.y1) / 2 - upOf(opening.center)) < opening.radius;
|
|
68264
68524
|
for (const c of all) (open(c) ? holes : kept).push(c);
|
|
68265
68525
|
return { all, kept, holes, boxes };
|
|
68266
68526
|
}
|
|
@@ -68273,20 +68533,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68273
68533
|
function publishStanding(view) {
|
|
68274
68534
|
if (!view.saved) return;
|
|
68275
68535
|
const { mask } = view;
|
|
68276
|
-
const along22 = (p) =>
|
|
68536
|
+
const along22 = (p) => p[mask.axes.along] - mask.start;
|
|
68537
|
+
const upOf = (p) => p[mask.axes.up];
|
|
68277
68538
|
const parts2 = view.parts.map((id) => {
|
|
68278
68539
|
const part = structure.byId.get(id);
|
|
68279
|
-
const
|
|
68280
|
-
const
|
|
68281
|
-
const gone = (view.chips.get(id) ?? []).map((k) => ({ a: along22(k.center) - k.along, b: along22(k.center) + k.along, y0: k.center
|
|
68540
|
+
const [across0, across1] = extentOf(part, mask.axes.across);
|
|
68541
|
+
const thick = across1 - across0, mid = (across0 + across1) / 2;
|
|
68542
|
+
const gone = (view.chips.get(id) ?? []).map((k) => ({ a: along22(k.center) - k.along, b: along22(k.center) + k.along, y0: upOf(k.center) - k.up, y1: upOf(k.center) + k.up }));
|
|
68282
68543
|
return { spans: view.kept.get(id) ?? [], gone, thick, mid };
|
|
68283
68544
|
});
|
|
68284
|
-
const line = {
|
|
68545
|
+
const line = { axes: mask.axes, start: mask.start, open: view.core };
|
|
68285
68546
|
view.items.forEach((it, k) => publishSolids(it.mesh, it.v0, it.v1, k === 0 ? standingSolids(THREE, house, it.mesh, line, parts2) : []));
|
|
68286
68547
|
}
|
|
68287
68548
|
function paint2(view) {
|
|
68288
68549
|
const { mask, core } = view;
|
|
68289
|
-
const along22 = (p) =>
|
|
68550
|
+
const along22 = (p) => p[mask.axes.along] - mask.start;
|
|
68551
|
+
const upOf = (p) => p[mask.axes.up];
|
|
68290
68552
|
const holes = [];
|
|
68291
68553
|
const pits = [];
|
|
68292
68554
|
const discs = [];
|
|
@@ -68302,10 +68564,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68302
68564
|
view.kept.set(id, []);
|
|
68303
68565
|
continue;
|
|
68304
68566
|
}
|
|
68305
|
-
const
|
|
68306
|
-
const
|
|
68307
|
-
if (opening) discs.push({ s: along22(opening.center), y: opening.center
|
|
68308
|
-
for (const k of spalls) flakes.push({ s: along22(k.center), y: k.center
|
|
68567
|
+
const [across0, across1] = extentOf(part, mask.axes.across);
|
|
68568
|
+
const thick = across1 - across0, mid = (across0 + across1) / 2;
|
|
68569
|
+
if (opening) discs.push({ s: along22(opening.center), y: upOf(opening.center), r: opening.radius });
|
|
68570
|
+
for (const k of spalls) flakes.push({ s: along22(k.center), y: upOf(k.center), r: k.radius });
|
|
68309
68571
|
holes.push(...lost);
|
|
68310
68572
|
view.kept.set(id, kept);
|
|
68311
68573
|
if (units2.mortar === part.material) {
|
|
@@ -68361,18 +68623,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68361
68623
|
const list2 = [];
|
|
68362
68624
|
const tone = (hex2, k) => tmp.c.setHex(hex2).multiplyScalar(k).getHex();
|
|
68363
68625
|
const b = view.bounds;
|
|
68364
|
-
const inner =
|
|
68626
|
+
const inner = coatedInside(b, mask.axes);
|
|
68365
68627
|
for (const { c, part, units: units2, thick, mid } of shown2) {
|
|
68366
68628
|
if (!near(c)) continue;
|
|
68367
68629
|
const centre = mask.start + (c.a + c.b) / 2, y = (c.y0 + c.y1) / 2, len = c.b - c.a, h = c.y1 - c.y0;
|
|
68368
68630
|
const at4 = (s, dy, d, colour) => {
|
|
68369
|
-
const unit = clipToBox(
|
|
68370
|
-
if (unit && !discs.some((k) =>
|
|
68631
|
+
const unit = clipToBox(unitBoxOf(mask.axes, [centre, y, mid], [s, dy, d], colour), inner);
|
|
68632
|
+
if (unit && !discs.some((k) => {
|
|
68633
|
+
const p = [unit.x, unit.y, unit.z];
|
|
68634
|
+
return Math.hypot(p[mask.axes.along] - mask.start - k.s, p[mask.axes.up] - k.y) < k.r;
|
|
68635
|
+
})) list2.push(unit);
|
|
68371
68636
|
};
|
|
68372
68637
|
const base2 = fragmentMaterial(part.material).color.getHex();
|
|
68373
68638
|
const n = noise2(centre * 3.1, y * 2.7, 0.07);
|
|
68374
68639
|
if (units2.mortar === "concrete") {
|
|
68375
|
-
at4(len, h, thick - 2 * COVER2, tone(base2, 0.9 + 0.04 * n));
|
|
68640
|
+
at4(len - CAST_GAP, h - CAST_GAP, thick - 2 * COVER2, tone(base2, 0.9 + 0.04 * n));
|
|
68376
68641
|
} else {
|
|
68377
68642
|
at4(len, h, thick - 2 * COVER2 - 0.012, 10327948);
|
|
68378
68643
|
at4(len - 0.012, h - 0.012, thick - 2 * COVER2, tone(base2, 0.8 + 0.35 * n));
|
|
@@ -68401,14 +68666,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68401
68666
|
view.flakes = flakes.length;
|
|
68402
68667
|
publishStanding(view);
|
|
68403
68668
|
}
|
|
68404
|
-
function chipBox(chip,
|
|
68669
|
+
function chipBox(chip, axes) {
|
|
68405
68670
|
house.updateWorldMatrix(true, false);
|
|
68406
68671
|
const q = tmp.q.set(chip.rotation[0], chip.rotation[1], chip.rotation[2], chip.rotation[3]).premultiply(house.getWorldQuaternion(new THREE.Quaternion()).invert());
|
|
68407
68672
|
let a = 0, u = 0;
|
|
68408
68673
|
for (let k = 0; k < 3; k++) {
|
|
68409
68674
|
const axis2 = tmp.p.set(k === 0 ? 1 : 0, k === 1 ? 1 : 0, k === 2 ? 1 : 0).applyQuaternion(q);
|
|
68410
|
-
a += Math.abs(
|
|
68411
|
-
u += Math.abs(axis2.
|
|
68675
|
+
a += Math.abs(axis2.getComponent(axes.along)) * chip.size[k] / 2;
|
|
68676
|
+
u += Math.abs(axis2.getComponent(axes.up)) * chip.size[k] / 2;
|
|
68412
68677
|
}
|
|
68413
68678
|
return { center: local2(chip.center), along: a, up: u };
|
|
68414
68679
|
}
|
|
@@ -68444,12 +68709,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68444
68709
|
const grey = fragmentMaterial("concrete").color.getHex();
|
|
68445
68710
|
const stone = (s, y, d, size, r) => {
|
|
68446
68711
|
const centre = mask.start + s;
|
|
68447
|
-
const unit = clipToBox(
|
|
68712
|
+
const unit = clipToBox(unitBoxOf(mask.axes, [centre, y, d], size, tmp.c.setHex(grey).multiplyScalar(0.85 + 0.2 * r(7)).getHex()), bounds2);
|
|
68448
68713
|
if (unit) out.push(unit);
|
|
68449
68714
|
};
|
|
68450
68715
|
for (const { c, part, thick, mid } of gone) {
|
|
68451
|
-
const
|
|
68452
|
-
const
|
|
68716
|
+
const [from, to] = extentOf(part, mask.axes.along), [up0, up1] = extentOf(part, mask.axes.up);
|
|
68717
|
+
const p0 = from - mask.start, p1 = to - mask.start;
|
|
68718
|
+
const lying = p1 - p0 > up1 - up0;
|
|
68453
68719
|
const random = (seed) => (n) => {
|
|
68454
68720
|
const x = Math.sin(seed + n * 3.3) * 43758.5453;
|
|
68455
68721
|
return x - Math.floor(x);
|
|
@@ -68467,7 +68733,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68467
68733
|
stone(s, y, d, [size, size * (0.6 + 0.5 * r(4)), size], r);
|
|
68468
68734
|
}
|
|
68469
68735
|
}
|
|
68470
|
-
const bars = lying ? [
|
|
68736
|
+
const bars = lying ? [up0 + LUMP_BAR_INSET, up1 - LUMP_BAR_INSET].filter((y) => y >= c.y0 - 1e-6 && y <= c.y1 + 1e-6) : [p0 + LUMP_BAR_INSET, p1 - LUMP_BAR_INSET].filter((s) => s >= c.a - 1e-6 && s <= c.b + 1e-6);
|
|
68471
68737
|
for (const bar2 of bars) {
|
|
68472
68738
|
for (const side of [-1, 1]) {
|
|
68473
68739
|
const d = mid + side * (thick / 2 - LUMP_BAR_INSET);
|
|
@@ -68527,8 +68793,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68527
68793
|
if (view.openings.has(partId)) return false;
|
|
68528
68794
|
view.openings.set(partId, { center: local2(change.opening.center), radius: change.opening.radius });
|
|
68529
68795
|
}
|
|
68530
|
-
if (change.chip) view.chips.get(partId).push(chipBox(change.chip, view.mask.
|
|
68531
|
-
for (const chip of change.chips ?? []) view.chips.get(partId).push(chipBox(chip, view.mask.
|
|
68796
|
+
if (change.chip) view.chips.get(partId).push(chipBox(change.chip, view.mask.axes));
|
|
68797
|
+
for (const chip of change.chips ?? []) view.chips.get(partId).push(chipBox(chip, view.mask.axes));
|
|
68532
68798
|
if (change.spall) {
|
|
68533
68799
|
const list2 = view.spalls.get(partId);
|
|
68534
68800
|
list2.push({ center: local2(change.spall.center), radius: change.spall.radius });
|
|
@@ -68629,13 +68895,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
68629
68895
|
},
|
|
68630
68896
|
/**
|
|
68631
68897
|
* What still stands of the units of `partId` once its wall is cut, as drawn: spans along the wall from `start` (in the house's space, along u when
|
|
68632
|
-
* `
|
|
68898
|
+
* `axes.along`) and up `axes.up`. Null while the wall is whole (all of the part stands).
|
|
68633
68899
|
*/
|
|
68634
68900
|
standing(partId) {
|
|
68635
68901
|
const hostId = hostOf(partId), view = hostId ? views.get(hostId) : void 0;
|
|
68636
68902
|
if (view?.keptStale) refreshKept(view);
|
|
68637
68903
|
const spans = view?.saved ? view.kept.get(partId) : void 0;
|
|
68638
|
-
return view && spans ? { spans,
|
|
68904
|
+
return view && spans ? { spans, axes: view.mask.axes, start: view.mask.start } : null;
|
|
68639
68905
|
},
|
|
68640
68906
|
/** Handles a `stage` event of the house's object. Returns true when the wall was cut. */
|
|
68641
68907
|
stage(event) {
|
|
@@ -69090,8 +69356,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
69090
69356
|
if (du * du + dv * dv >= radius * radius) continue;
|
|
69091
69357
|
const left = breach.standing(part.id);
|
|
69092
69358
|
if (!left) return true;
|
|
69093
|
-
const s0 = (left.
|
|
69094
|
-
const
|
|
69359
|
+
const s0 = (left.axes.along === 0 ? lx : lz) - left.start;
|
|
69360
|
+
const flat2 = left.axes.up !== 1, t0 = left.axes.up === 0 ? lx : lz;
|
|
69361
|
+
const low1 = flat2 ? t0 - radius : Math.min(ly0, ly1), high1 = flat2 ? t0 + radius : Math.max(ly0, ly1);
|
|
69095
69362
|
for (const c of left.spans) if (c.b > s0 - radius && c.a < s0 + radius && c.y1 > low1 && c.y0 < high1) return true;
|
|
69096
69363
|
}
|
|
69097
69364
|
return false;
|
|
@@ -70927,13 +71194,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
70927
71194
|
function seatStructure(L, c, seats, options) {
|
|
70928
71195
|
return [...base(L, c, seats, options.plinth), ...back(L, c), ...arms(L, c, options.boardBack)];
|
|
70929
71196
|
}
|
|
70930
|
-
function cushion(
|
|
70931
|
-
return { ...
|
|
71197
|
+
function cushion(block2, id) {
|
|
71198
|
+
return { ...block2, id, material: "foam", layers: CLOTH_COVER };
|
|
70932
71199
|
}
|
|
70933
71200
|
var SOFAS = /^sofa_/;
|
|
70934
71201
|
var ARMCHAIRS = /^armchair/;
|
|
70935
71202
|
var BEDS = /^(double_bed|queen_bed|king_bed|single_bed|mattress)$/;
|
|
70936
|
-
var seatsOf = (cushions) => cushions.map((
|
|
71203
|
+
var seatsOf = (cushions) => cushions.map((block2, k) => ({ x: block2.position[0], ...cushions[k + 1] ? { seam: (block2.position[0] + cushions[k + 1].position[0]) / 2 } : {} }));
|
|
70937
71204
|
function sofaParts(drawn) {
|
|
70938
71205
|
const woods = drawn.filter((p) => p.key === "wood");
|
|
70939
71206
|
const cloth2 = drawn.filter((p) => p.key === "fabric");
|
|
@@ -70975,7 +71242,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
70975
71242
|
};
|
|
70976
71243
|
const colours = { wood: feet[0].color, skirt: skirt.color, back: back2.color, arm: armLeft.color };
|
|
70977
71244
|
const structure = seatStructure(layout, colours, seatsOf(seatCushions), { plinth: false, boardBack: layout.backFrame });
|
|
70978
|
-
const cushions = [...seatCushions.map((
|
|
71245
|
+
const cushions = [...seatCushions.map((block2, k) => cushion(block2, `seat_cushion_${k}`)), ...backCushions.map((block2, k) => cushion(block2, `back_cushion_${k}`)), cushion(pillow, "accent_pillow")];
|
|
70979
71246
|
return [...structure, ...cushions];
|
|
70980
71247
|
}
|
|
70981
71248
|
var ARMCHAIR_SUPPORT = 0.28;
|
|
@@ -71348,18 +71615,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
71348
71615
|
};
|
|
71349
71616
|
return { spec, build, top, fixed: fixed2 };
|
|
71350
71617
|
}
|
|
71618
|
+
var furnitureCatalogEntry = (type, catalog) => (catalog ?? residentialItems).find((i) => i.type === type);
|
|
71351
71619
|
function furnitureSpec(THREE, type, opts = {}) {
|
|
71352
71620
|
const renderer = rendererOf(THREE, opts.document);
|
|
71353
71621
|
const ent = renderer.types[type];
|
|
71354
71622
|
if (!ent) throw new Error(`game-floorplan-three: no builder for the furniture type "${type}"`);
|
|
71355
|
-
const entry2 = (opts.catalog
|
|
71623
|
+
const entry2 = furnitureCatalogEntry(type, opts.catalog);
|
|
71356
71624
|
const w = opts.w ?? entry2?.w;
|
|
71357
71625
|
const d = opts.d ?? entry2?.d;
|
|
71358
71626
|
const h = opts.h ?? entry2?.h;
|
|
71359
71627
|
if (w === void 0 || d === void 0 || h === void 0) throw new Error(`game-floorplan-three: furniture type "${type}" is not in the catalogue, so give w, d and h`);
|
|
71360
71628
|
const o = opts.options ?? {};
|
|
71361
71629
|
const seed = Math.round(opts.seed ?? 1);
|
|
71362
|
-
const plain2 = SHELVING.test(type) ? "paper" : "plastic";
|
|
71630
|
+
const plain2 = entry2?.material ?? (SHELVING.test(type) ? "paper" : "plastic");
|
|
71363
71631
|
const root = { x: seed, z: 0, ry: 0, w, d, h, y: 0, base: 0, palette: o.palette, seed: `furniture_${type}_${seed}` };
|
|
71364
71632
|
const { K, shared: shared3 } = renderer.internals;
|
|
71365
71633
|
const before = K.PARTS.length;
|
|
@@ -73395,7 +73663,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
73395
73663
|
hgFrac: 0.9,
|
|
73396
73664
|
rail: 1,
|
|
73397
73665
|
scope: 1,
|
|
73398
|
-
rpm: 1100
|
|
73666
|
+
rpm: 1100,
|
|
73667
|
+
eject: "down"
|
|
73399
73668
|
}
|
|
73400
73669
|
},
|
|
73401
73670
|
thompson_m1a1: {
|
|
@@ -73546,7 +73815,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
73546
73815
|
length: 660,
|
|
73547
73816
|
barrel: 470,
|
|
73548
73817
|
options: {
|
|
73549
|
-
shot: 1
|
|
73818
|
+
shot: 1,
|
|
73819
|
+
eject: "down"
|
|
73550
73820
|
}
|
|
73551
73821
|
},
|
|
73552
73822
|
saiga_12: {
|
|
@@ -74736,7 +75006,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
74736
75006
|
fore: 0.55,
|
|
74737
75007
|
gas: 1,
|
|
74738
75008
|
charge: 1,
|
|
74739
|
-
bayo: 1
|
|
75009
|
+
bayo: 1,
|
|
75010
|
+
eject: "up"
|
|
74740
75011
|
},
|
|
74741
75012
|
variantOf: "sks"
|
|
74742
75013
|
},
|
|
@@ -74924,7 +75195,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
74924
75195
|
fore: 0,
|
|
74925
75196
|
bands: 1,
|
|
74926
75197
|
br: 0.012,
|
|
74927
|
-
m1887: 1
|
|
75198
|
+
m1887: 1,
|
|
75199
|
+
eject: "up"
|
|
74928
75200
|
},
|
|
74929
75201
|
variantOf: "winchester_1894"
|
|
74930
75202
|
},
|
|
@@ -75845,6 +76117,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
75845
76117
|
kit.torus(lever, ring3, M.metal, 0, 0, 0);
|
|
75846
76118
|
parts2.muzzle = kit.mark(group, length2 + 0.01, 0, 0);
|
|
75847
76119
|
parts2.eject = kit.mark(group, middle + 0.02, 0.012, 0.01);
|
|
76120
|
+
if (options.eject) parts2.ejectSide = options.eject;
|
|
75848
76121
|
parts2.loadPort = kit.mark(group, middle + 0.03, -0.035, 0.02);
|
|
75849
76122
|
parts2.topLoad = parts2.eject;
|
|
75850
76123
|
parts2.frames = {
|
|
@@ -76093,7 +76366,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76093
76366
|
const ejectX = receiverEnd - (options.ejectBack || 0.07);
|
|
76094
76367
|
const ejectY = options.ar ? receiverHeight * 0.2 : by;
|
|
76095
76368
|
parts2.muzzle = kit.mark(group, length2 + 0.01, by, 0);
|
|
76096
|
-
|
|
76369
|
+
const ejectsDown = options.eject === "down";
|
|
76370
|
+
if (ejectsDown) kit.box(group, 0.05, 2e-3, wR * 0.5, M.hole, ejectX, -receiverHeight / 2 - 1e-3, 0);
|
|
76371
|
+
parts2.eject = ejectsDown ? kit.mark(group, ejectX, -receiverHeight / 2 - 4e-3, 0) : kit.mark(group, ejectX, ejectY, wR / 2 + 6e-3);
|
|
76372
|
+
if (options.eject) parts2.ejectSide = options.eject;
|
|
76097
76373
|
parts2.loadPort = kit.mark(group, receiverEnd - 0.05, -receiverHeight / 2 - 4e-3, 0);
|
|
76098
76374
|
parts2.topLoad = kit.mark(group, ejectX, receiverHeight / 2 + 4e-3, 0);
|
|
76099
76375
|
parts2.family = familyOf(options);
|
|
@@ -76364,7 +76640,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76364
76640
|
box5(group, 0.026, 0.075, 0.026, body, bodyLength + 0.05, -0.05, 0, 0.1);
|
|
76365
76641
|
}
|
|
76366
76642
|
parts2.muzzle = kit.mark(group, L + 0.01, 0.012, 0);
|
|
76367
|
-
|
|
76643
|
+
if (options.eject === "down") {
|
|
76644
|
+
box5(group, 0.05, 2e-3, 0.024, M.hole, bodyLength * 0.25, -0.0385, 0);
|
|
76645
|
+
parts2.eject = kit.mark(group, bodyLength * 0.25, -0.042, 0);
|
|
76646
|
+
parts2.ejectSide = "down";
|
|
76647
|
+
} else parts2.eject = kit.mark(group, bodyLength * 0.25, 5e-3, 0.03);
|
|
76368
76648
|
return { group, parts: parts2 };
|
|
76369
76649
|
}
|
|
76370
76650
|
|
|
@@ -76375,14 +76655,30 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76375
76655
|
const tube2 = new THREE.Mesh(new THREE.TubeGeometry(curve, 40, radius, 8, false), material);
|
|
76376
76656
|
tube2.castShadow = tube2.receiveShadow = true;
|
|
76377
76657
|
group.add(tube2);
|
|
76658
|
+
return tube2;
|
|
76659
|
+
};
|
|
76660
|
+
var fuelPack = (kit, target) => {
|
|
76661
|
+
const { M, box: box5, cylinderY, sphere: sphere2 } = kit;
|
|
76662
|
+
for (const z of [-0.1, 0.1]) {
|
|
76663
|
+
cylinderY(target, 0.085, 0.5, M.olive, -0.3, -0.05, z, 20);
|
|
76664
|
+
sphere2(target, 0.085, M.olive, -0.3, 0.2, z, 2).scale.y = 0.45;
|
|
76665
|
+
sphere2(target, 0.085, M.olive, -0.3, -0.3, z, 2).scale.y = 0.45;
|
|
76666
|
+
cylinderY(target, 0.03, 0.03, M.metal, -0.3, 0.24, z, 12);
|
|
76667
|
+
}
|
|
76668
|
+
sphere2(target, 0.075, M.olive, -0.3, 0.1, 0, 2).position.x = -0.39;
|
|
76669
|
+
box5(target, 0.03, 0.6, 0.24, M.dark, -0.4, -0.05, 0);
|
|
76670
|
+
cylinderY(target, 0.03, 0.012, M.metal, -0.39, 0.18, 0, 14);
|
|
76671
|
+
const gauge = kit.pivot(target, -0.39, 0.18, 3e-3);
|
|
76672
|
+
box5(gauge, 2e-3, 0.022, 2e-3, M.red, 0, 8e-3, 0.012);
|
|
76673
|
+
return gauge;
|
|
76378
76674
|
};
|
|
76379
76675
|
var pilot = (kit, group, x, y) => {
|
|
76380
76676
|
const { M, cylinderX } = kit;
|
|
76381
76677
|
cylinderX(group, 6e-3, 0.03, M.fire2, x + 0.015, y, 0, 6, 0).userData.flame = 1;
|
|
76382
76678
|
cylinderX(group, 4e-3, 0.022, M.fire, x + 0.012, y, 0, 6, 0).userData.flame = 1;
|
|
76383
76679
|
};
|
|
76384
|
-
function buildFlamethrower(kit, group, parts2) {
|
|
76385
|
-
const { M, box: box5, cylinderX
|
|
76680
|
+
function buildFlamethrower(kit, group, parts2, separate = false) {
|
|
76681
|
+
const { M, box: box5, cylinderX } = kit;
|
|
76386
76682
|
parts2.kick = 0.15;
|
|
76387
76683
|
heatify(parts2.glow, cylinderX(group, 0.016, 0.62, M.steel, 0.42, 0, 0, 14));
|
|
76388
76684
|
cylinderX(group, 0.022, 0.1, M.dark, 0.78, 0, 0, 14);
|
|
@@ -76400,19 +76696,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76400
76696
|
box5(rearGrip, 0.03, 0.1, 0.03, M.wood, 0, -0.05, 0);
|
|
76401
76697
|
box5(group, 0.05, 4e-3, 0.012, M.metal, 0.2, -0.035, 0);
|
|
76402
76698
|
cylinderX(group, 0.02, 0.04, M.metal, 0.1, 0, 0, 12);
|
|
76403
|
-
|
|
76404
|
-
|
|
76405
|
-
|
|
76406
|
-
|
|
76407
|
-
|
|
76408
|
-
|
|
76409
|
-
|
|
76410
|
-
|
|
76411
|
-
|
|
76412
|
-
cylinderY(group, 0.03, 0.012, M.metal, -0.39, 0.18, 0, 14);
|
|
76413
|
-
const gauge = kit.pivot(group, -0.39, 0.18, 3e-3);
|
|
76414
|
-
parts2.gauge = gauge;
|
|
76415
|
-
box5(gauge, 2e-3, 0.022, 2e-3, M.red, 0, 8e-3, 0.012);
|
|
76699
|
+
if (separate) {
|
|
76700
|
+
const pack2 = kit.group();
|
|
76701
|
+
parts2.gauge = fuelPack(kit, pack2);
|
|
76702
|
+
hose(kit, group, [[0.08, 0, 0], [0, -0.04, 0], [-0.08, -0.2, 0.05]], 0.011, M.rubber);
|
|
76703
|
+
parts2.worn = { root: pack2, mount: kit.pivot(pack2, -0.415, -0.05, 0), port: kit.pivot(pack2, -0.25, -0.33, 0.08), wandEnd: kit.pivot(group, -0.08, -0.2, 0.05), hoseMaterial: M.rubber };
|
|
76704
|
+
} else {
|
|
76705
|
+
hose(kit, group, [[0.08, 0, 0], [0, -0.04, 0], [-0.08, -0.2, 0.05], [-0.18, -0.32, 0.08], [-0.25, -0.33, 0.08]], 0.011, M.rubber);
|
|
76706
|
+
parts2.gauge = fuelPack(kit, group);
|
|
76707
|
+
}
|
|
76416
76708
|
parts2.muzzle = kit.pivot(group, 0.94, 0, 0);
|
|
76417
76709
|
parts2.rear = kit.pivot(group, 0.1, 0, 0);
|
|
76418
76710
|
}
|
|
@@ -76603,7 +76895,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76603
76895
|
const type = options.lt ?? "";
|
|
76604
76896
|
const isFlame = type === "flame" || type === "flameDIY";
|
|
76605
76897
|
const parts2 = { family: isFlame ? "flame" : "rocket", launcherType: type, glow: [] };
|
|
76606
|
-
if (type === "flame") buildFlamethrower(kit, group, parts2);
|
|
76898
|
+
if (type === "flame") buildFlamethrower(kit, group, parts2, options.separateWorn === true);
|
|
76607
76899
|
else if (type === "flameDIY") buildImprovisedFlamethrower(kit, group, parts2);
|
|
76608
76900
|
else ROCKET_BUILDERS[type]?.(kit, group, parts2);
|
|
76609
76901
|
parts2.eject = parts2.muzzle;
|
|
@@ -76806,6 +77098,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76806
77098
|
};
|
|
76807
77099
|
parts2.muzzle = kit.mark(group, BARREL_END + 0.01, 0, 0);
|
|
76808
77100
|
parts2.eject = kit.mark(group, 0.3, -0.07, 0.08);
|
|
77101
|
+
parts2.ejectSide = "down";
|
|
76809
77102
|
return { group, parts: parts2 };
|
|
76810
77103
|
}
|
|
76811
77104
|
|
|
@@ -76843,6 +77136,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76843
77136
|
box5(tripod, 0.012, 0.62, 0.012, M.metal, 0.22, -0.25, -0.16, -0.75, 0, -0.3);
|
|
76844
77137
|
parts2.muzzle = kit.mark(group, 1.72, 0.01, 0);
|
|
76845
77138
|
parts2.eject = kit.mark(group, 0.3, -0.07, 0);
|
|
77139
|
+
parts2.ejectSide = "down";
|
|
76846
77140
|
return { group, parts: parts2 };
|
|
76847
77141
|
}
|
|
76848
77142
|
|
|
@@ -76967,6 +77261,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
76967
77261
|
parts2.trigger = box5(group, 4e-3, 0.016, 4e-3, M.dark, 0.24, -0.045, 0);
|
|
76968
77262
|
parts2.muzzle = kit.mark(group, 0.48, 0, 0);
|
|
76969
77263
|
parts2.eject = kit.mark(group, 0.2, -0.07, 0);
|
|
77264
|
+
parts2.ejectSide = "down";
|
|
76970
77265
|
return { group, parts: parts2 };
|
|
76971
77266
|
}
|
|
76972
77267
|
|
|
@@ -77077,6 +77372,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77077
77372
|
};
|
|
77078
77373
|
parts2.muzzle = kit.mark(group, length2, 0, 0);
|
|
77079
77374
|
parts2.eject = kit.mark(group, 0.12, -0.092, 0);
|
|
77375
|
+
parts2.ejectSide = "down";
|
|
77080
77376
|
return { group, parts: parts2 };
|
|
77081
77377
|
}
|
|
77082
77378
|
|
|
@@ -77202,6 +77498,87 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77202
77498
|
return (y) => frontTopX + (frontTopY - y) * Math.tan(angle);
|
|
77203
77499
|
}
|
|
77204
77500
|
|
|
77501
|
+
// src/models/sight.ts
|
|
77502
|
+
var SIGHT_SINK = 5e-4;
|
|
77503
|
+
var FOOTPRINT_INSET = 0.15;
|
|
77504
|
+
var RAY_CLEARANCE = 0.05;
|
|
77505
|
+
var measured = /* @__PURE__ */ new WeakMap();
|
|
77506
|
+
var boundsOf = (THREE, geometry) => {
|
|
77507
|
+
const known = measured.get(geometry);
|
|
77508
|
+
if (known) return known;
|
|
77509
|
+
const position = geometry.getAttribute("position");
|
|
77510
|
+
const box5 = new THREE.Box3().setFromBufferAttribute(position);
|
|
77511
|
+
const bounds = { box: box5, sphere: box5.getBoundingSphere(new THREE.Sphere()) };
|
|
77512
|
+
measured.set(geometry, bounds);
|
|
77513
|
+
return bounds;
|
|
77514
|
+
};
|
|
77515
|
+
var hits = /* @__PURE__ */ new WeakMap();
|
|
77516
|
+
var KEY_DIGITS = 6;
|
|
77517
|
+
function hitOn(THREE, mesh3, origin) {
|
|
77518
|
+
const geometry = mesh3.geometry;
|
|
77519
|
+
const ray = new THREE.Ray(origin.clone(), new THREE.Vector3(0, -1, 0)).applyMatrix4(new THREE.Matrix4().copy(mesh3.matrixWorld).invert());
|
|
77520
|
+
const from = ray.origin;
|
|
77521
|
+
const along3 = ray.direction;
|
|
77522
|
+
const key2 = [...from.toArray(), ...along3.toArray()].map((value) => value.toFixed(KEY_DIGITS)).join(",");
|
|
77523
|
+
const known = hits.get(geometry) ?? /* @__PURE__ */ new Map();
|
|
77524
|
+
hits.set(geometry, known);
|
|
77525
|
+
if (!known.has(key2)) {
|
|
77526
|
+
const before = { box: geometry.boundingBox, sphere: geometry.boundingSphere };
|
|
77527
|
+
const bounds = boundsOf(THREE, geometry);
|
|
77528
|
+
geometry.boundingBox = bounds.box;
|
|
77529
|
+
geometry.boundingSphere = bounds.sphere;
|
|
77530
|
+
const probe2 = new THREE.Mesh(geometry, mesh3.material);
|
|
77531
|
+
const found = new THREE.Raycaster(from, along3).intersectObject(probe2, false)[0];
|
|
77532
|
+
geometry.boundingBox = before.box;
|
|
77533
|
+
geometry.boundingSphere = before.sphere;
|
|
77534
|
+
known.set(key2, found ? found.point.clone() : null);
|
|
77535
|
+
}
|
|
77536
|
+
const local2 = known.get(key2);
|
|
77537
|
+
return local2 ? local2.clone().applyMatrix4(mesh3.matrixWorld) : null;
|
|
77538
|
+
}
|
|
77539
|
+
function surfaceUnder(kit, support, parent, spec) {
|
|
77540
|
+
const { THREE } = kit;
|
|
77541
|
+
let root = support;
|
|
77542
|
+
while (root.parent) root = root.parent;
|
|
77543
|
+
root.updateMatrixWorld(true);
|
|
77544
|
+
const reachX = spec.length / 2 * (1 - 2 * FOOTPRINT_INSET);
|
|
77545
|
+
const reachZ = spec.width / 2 * (1 - 2 * FOOTPRINT_INSET);
|
|
77546
|
+
const corners = [[0, 0], [-reachX, -reachZ], [-reachX, reachZ], [reachX, -reachZ], [reachX, reachZ]].map(([dx, dz]) => parent.localToWorld(new THREE.Vector3(spec.x + dx, 0, dz)));
|
|
77547
|
+
const footprint = new THREE.Box3().setFromPoints(corners);
|
|
77548
|
+
const under = [];
|
|
77549
|
+
const world = new THREE.Box3();
|
|
77550
|
+
const whole = new THREE.Box3();
|
|
77551
|
+
support.traverse((child) => {
|
|
77552
|
+
const mesh3 = child;
|
|
77553
|
+
if (!mesh3.isMesh) return;
|
|
77554
|
+
world.copy(boundsOf(THREE, mesh3.geometry).box).applyMatrix4(mesh3.matrixWorld);
|
|
77555
|
+
whole.union(world);
|
|
77556
|
+
if (mesh3.userData["sight"] === true) return;
|
|
77557
|
+
if (world.max.x < footprint.min.x || world.min.x > footprint.max.x || world.max.z < footprint.min.z || world.min.z > footprint.max.z) return;
|
|
77558
|
+
under.push(mesh3);
|
|
77559
|
+
});
|
|
77560
|
+
const top = whole.max.y;
|
|
77561
|
+
if (under.length === 0) throw new Error("a sight with nothing under it");
|
|
77562
|
+
let highest = -Infinity;
|
|
77563
|
+
for (const origin of corners) {
|
|
77564
|
+
origin.y = top + RAY_CLEARANCE;
|
|
77565
|
+
for (const mesh3 of under) {
|
|
77566
|
+
const hit = hitOn(THREE, mesh3, origin);
|
|
77567
|
+
if (hit) highest = Math.max(highest, parent.worldToLocal(hit).y);
|
|
77568
|
+
}
|
|
77569
|
+
}
|
|
77570
|
+
if (highest === -Infinity) throw new Error("a sight with nothing under it");
|
|
77571
|
+
return highest;
|
|
77572
|
+
}
|
|
77573
|
+
function placeSight(kit, parent, support, spec) {
|
|
77574
|
+
const tilt = spec.tilt ?? 0;
|
|
77575
|
+
const halfHeight = spec.height / 2 * Math.cos(tilt) + spec.length / 2 * Math.abs(Math.sin(tilt));
|
|
77576
|
+
const bottom = surfaceUnder(kit, support, parent, spec) - SIGHT_SINK;
|
|
77577
|
+
const mesh3 = kit.box(parent, spec.length, spec.height, spec.width, spec.material, spec.x, bottom + halfHeight, 0, tilt);
|
|
77578
|
+
mesh3.userData["sight"] = true;
|
|
77579
|
+
return { mesh: mesh3, bottom };
|
|
77580
|
+
}
|
|
77581
|
+
|
|
77205
77582
|
// src/models/pistol-design-slide.ts
|
|
77206
77583
|
function buildDesignSlide(kit, slide2, parts2, name, design, length2) {
|
|
77207
77584
|
const { M, box: box5, cylinderX } = kit;
|
|
@@ -77228,14 +77605,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77228
77605
|
}
|
|
77229
77606
|
heatify(parts2.glow, cylinderX(slide2, 62e-4, 4e-3, M.dark, length2 + 15e-4, 2e-3, 0, 18));
|
|
77230
77607
|
cylinderX(slide2, 34e-4, 5e-3, M.hole, length2 + 25e-4, 2e-3, 0, 12);
|
|
77231
|
-
const
|
|
77232
|
-
|
|
77233
|
-
|
|
77234
|
-
box5(slide2,
|
|
77235
|
-
box5(slide2, 22e-4, 22e-4, 0.0166, M.white, 9e-3,
|
|
77608
|
+
const front = placeSight(kit, slide2, slide2, { length: 4e-3, height: 7e-3, width: 4e-3, material: M.dark, x: length2 - 8e-3 });
|
|
77609
|
+
const rear = placeSight(kit, slide2, slide2, { length: 8e-3, height: 7e-3, width: 0.016, material: M.dark, x: 9e-3 });
|
|
77610
|
+
parts2.sights = [front.mesh, rear.mesh];
|
|
77611
|
+
box5(slide2, 22e-4, 22e-4, 46e-4, M.white, length2 - 8e-3, front.bottom + 58e-4, 0);
|
|
77612
|
+
box5(slide2, 22e-4, 22e-4, 0.0166, M.white, 9e-3, rear.bottom + 58e-4, 0);
|
|
77236
77613
|
}
|
|
77237
77614
|
|
|
77238
77615
|
// src/models/pistol-design.ts
|
|
77616
|
+
var PORT_RISE = 5e-3;
|
|
77239
77617
|
function buildDesignedPistol(kit, options, name) {
|
|
77240
77618
|
const { M, box: box5 } = kit;
|
|
77241
77619
|
const design = PISTOL_DESIGNS[name];
|
|
@@ -77284,7 +77662,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77284
77662
|
box5(hammer2, 0.01, 6e-3, 0.012, M.dark, -0.011, 8e-3, 0, 0.5);
|
|
77285
77663
|
}
|
|
77286
77664
|
parts2.muzzle = kit.mark(group, length2 + 6e-3, 2e-3, 0);
|
|
77287
|
-
parts2.eject = kit.mark(group, length2 * 0.6, sh / 2, sw * 0.25);
|
|
77665
|
+
parts2.eject = kit.mark(group, length2 * 0.6, sh / 2 + PORT_RISE, sw * 0.25);
|
|
77288
77666
|
return { group, parts: parts2 };
|
|
77289
77667
|
}
|
|
77290
77668
|
|
|
@@ -77323,11 +77701,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77323
77701
|
box5(group, 24e-4, SLIDE_HEIGHT * 0.9, WIDTH2 + 4e-4, M.dark, slideLength, 0, 0);
|
|
77324
77702
|
for (let i = 0; i < 9; i++) box5(slide2, 22e-4, SLIDE_HEIGHT * 0.66, WIDTH2 + 12e-4, M.dark, 8e-3 + i * 48e-4, -3e-3, 0);
|
|
77325
77703
|
box5(slide2, length2 * 0.08, 3e-3, WIDTH2 * 0.5, M.hole, length2 * 0.42, SLIDE_HEIGHT / 2, WIDTH2 * 0.12);
|
|
77326
|
-
|
|
77327
|
-
box5(slide2, 3e-3, 2e-3, 4e-3, M.hole, 8e-3,
|
|
77704
|
+
const rearSight = placeSight(kit, slide2, slide2, { length: 7e-3, height: 6e-3, width: 0.014, material: M.dark, x: 8e-3 });
|
|
77705
|
+
box5(slide2, 3e-3, 2e-3, 4e-3, M.hole, 8e-3, rearSight.bottom + 5e-3, 0);
|
|
77328
77706
|
box5(group, barrelLength * 0.9, 4e-3, WIDTH2 * 0.42, metal2, slideLength + barrelLength * 0.5, SLIDE_HEIGHT / 2 + 2e-3, 0);
|
|
77329
77707
|
for (let i = 0; i < 7; i++) box5(group, 4e-3, 15e-4, WIDTH2 * 0.43, M.hole, slideLength + 0.01 + i * 0.013, SLIDE_HEIGHT / 2 + 4e-3, 0);
|
|
77330
|
-
|
|
77708
|
+
parts2.sights = [rearSight.mesh, placeSight(kit, group, group, { length: 4e-3, height: 6e-3, width: 4e-3, material: M.dark, x: length2 - 6e-3 }).mesh];
|
|
77331
77709
|
const nose = plate(kit, group, [[-WIDTH2 / 2, -SLIDE_HEIGHT / 2 + 2e-3], [WIDTH2 / 2, -SLIDE_HEIGHT / 2 + 2e-3], [WIDTH2 * 0.16, SLIDE_HEIGHT / 2 - 2e-3], [-WIDTH2 * 0.16, SLIDE_HEIGHT / 2 - 2e-3]], null, 3e-3, metal2);
|
|
77332
77710
|
nose.rotation.y = Math.PI / 2;
|
|
77333
77711
|
nose.position.set(length2 + 15e-4, 0, 0);
|
|
@@ -77461,16 +77839,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77461
77839
|
const muzzleY = style.tri ? slideHeight * 0.08 : 2e-3;
|
|
77462
77840
|
heatify(parts2.glow, cylinderX(slide2, style.tri ? 72e-4 : 62e-4, 4e-3, M.dark, L + 15e-4, muzzleY, 0, 18));
|
|
77463
77841
|
cylinderX(slide2, 34e-4, 5e-3, M.hole, L + 25e-4, muzzleY, 0, 12);
|
|
77464
|
-
const
|
|
77842
|
+
const seat2 = (spec) => placeSight(kit, slide2, slide2, spec);
|
|
77465
77843
|
if (style.sight === "u" || style.sight === "3dot") {
|
|
77466
|
-
|
|
77467
|
-
|
|
77468
|
-
|
|
77469
|
-
|
|
77470
|
-
|
|
77844
|
+
const front = seat2({ length: 4e-3, height: 7e-3, width: 4e-3, material: M.dark, x: L - 8e-3 });
|
|
77845
|
+
const rear = seat2({ length: 8e-3, height: 7e-3, width: 0.016, material: M.dark, x: 9e-3 });
|
|
77846
|
+
parts2.sights = [front.mesh, rear.mesh];
|
|
77847
|
+
box5(slide2, 22e-4, 22e-4, 46e-4, M.white, L - 8e-3, front.bottom + 58e-4, 0);
|
|
77848
|
+
if (style.sight === "u") box5(slide2, 4e-3, 2e-3, 0.0122, M.white, 9e-3, rear.bottom + 6e-3, 0);
|
|
77849
|
+
else box5(slide2, 22e-4, 22e-4, 0.0166, M.white, 9e-3, rear.bottom + 58e-4, 0);
|
|
77471
77850
|
} else {
|
|
77472
|
-
|
|
77473
|
-
box5(slide2, 6e-3, 4e-3, 0.012, M.dark, 8e-3, top + 2e-3, 0);
|
|
77851
|
+
parts2.sights = [seat2({ length: 6e-3, height: 4e-3, width: 3e-3, material: M.dark, x: L - 6e-3 }).mesh, seat2({ length: 6e-3, height: 4e-3, width: 0.012, material: M.dark, x: 8e-3 }).mesh];
|
|
77474
77852
|
}
|
|
77475
77853
|
if (style.decock === "slide") {
|
|
77476
77854
|
box5(slide2, 0.012, 8e-3, 4e-3, M.dark, 0.02, slideHeight * 0.15, slideWidth / 2 + 2e-3, 0.3);
|
|
@@ -77628,8 +78006,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77628
78006
|
box5(group, barrel * 0.96, 58e-4, 88e-4, M.metal, start + barrel * 0.48, 0.0218, 0);
|
|
77629
78007
|
for (let i = 0; i < 2; i++) box5(group, barrel * 0.2, 62e-4, 92e-4, M.hole, start + barrel * (0.26 + i * 0.36), 0.0218, 0);
|
|
77630
78008
|
box5(group, 0.012, 36e-4, 4e-3, M.dark, start + barrel * 0.4, -4e-3, 94e-4);
|
|
77631
|
-
|
|
77632
|
-
|
|
78009
|
+
const front = placeSight(kit, group, group, { length: 9e-3, height: 0.01, width: 34e-4, material: M.metal, x: start + barrel - 7e-3, tilt: -0.35 });
|
|
78010
|
+
parts2.sights = [...parts2.sights ?? [], front.mesh];
|
|
78011
|
+
box5(group, 35e-4, 5e-3, 36e-4, M.red, start + barrel - 45e-4, front.mesh.position.y + 3e-4, 0, -0.35);
|
|
77633
78012
|
cylinderX(group, 42e-4, 5e-3, M.hole, start + barrel + 15e-4, 9e-3, 0, 12);
|
|
77634
78013
|
}
|
|
77635
78014
|
function buildPythonGrip(kit, parts2, group) {
|
|
@@ -77659,8 +78038,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77659
78038
|
box5(group, 0.085, 0.056, 0.026, M.metal, 0.07, -4e-3, 0);
|
|
77660
78039
|
kit.roundness = null;
|
|
77661
78040
|
box5(group, 0.056, 8e-3, 0.02, M.metal, 0.075, 0.025, 0);
|
|
77662
|
-
|
|
77663
|
-
|
|
78041
|
+
const rear = placeSight(kit, group, group, { length: 0.016, height: 0.01, width: 0.016, material: M.metal, x: 0.044 });
|
|
78042
|
+
parts2.sights = [rear.mesh];
|
|
78043
|
+
box5(group, 4e-3, 8e-3, 0.012, M.dark, 0.044, rear.bottom + 0.011, 0);
|
|
77664
78044
|
box5(group, 0.024, 0.012, 4e-3, M.dark, 0.055, 4e-3, -0.013);
|
|
77665
78045
|
box5(group, 0.016, 0.018, 0.0255, M.metal, 0.099, -0.014, 0);
|
|
77666
78046
|
const crane = kit.pivot(group, 0.077, -0.026, 0);
|
|
@@ -77724,8 +78104,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
77724
78104
|
heatify(parts2.glow, cylinderX(group, 88e-4, barrel, metal2, 0.112 + barrel / 2, 9e-3, 0, 18));
|
|
77725
78105
|
box5(group, barrel * 0.92, 0.015, 0.013, metal2, 0.112 + barrel * 0.46, -5e-3, 0);
|
|
77726
78106
|
cylinderX(group, 4e-3, 5e-3, M.hole, 0.112 + barrel + 15e-4, 9e-3, 0, 12);
|
|
77727
|
-
|
|
77728
|
-
|
|
78107
|
+
parts2.sights = [
|
|
78108
|
+
placeSight(kit, group, group, { length: 0.012, height: 9e-3, width: 4e-3, material: M.dark, x: 0.112 + barrel - 8e-3, tilt: -0.3 }).mesh,
|
|
78109
|
+
placeSight(kit, group, group, { length: 0.012, height: 6e-3, width: 0.012, material: M.dark, x: 0.105 }).mesh
|
|
78110
|
+
];
|
|
77729
78111
|
const hammer2 = kit.pivot(group, 0.036, 0.018, 0);
|
|
77730
78112
|
box5(hammer2, 0.01, 0.02, 8e-3, M.dark, -4e-3, 8e-3, 0, 0.45);
|
|
77731
78113
|
parts2.hammer = hammer2;
|
|
@@ -78230,13 +78612,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
78230
78612
|
return root;
|
|
78231
78613
|
};
|
|
78232
78614
|
var hasWeaponModel = (id) => id in MODEL_ENTRIES || id in ARCHETYPE_MODELS;
|
|
78233
|
-
function buildWeaponModelById(THREE, id) {
|
|
78615
|
+
function buildWeaponModelById(THREE, id, options = {}) {
|
|
78234
78616
|
const entry2 = MODEL_ENTRIES[ARCHETYPE_MODELS[id] ?? id];
|
|
78235
78617
|
if (!entry2) return void 0;
|
|
78236
78618
|
const kit = modelKit(THREE);
|
|
78237
|
-
const
|
|
78238
|
-
if (id in ARCHETYPE_MODELS) delete
|
|
78239
|
-
|
|
78619
|
+
const modelOptions = { L: entry2.length, B: entry2.barrel, cal: entry2.caliber, ...entry2.options };
|
|
78620
|
+
if (id in ARCHETYPE_MODELS) delete modelOptions.chambers;
|
|
78621
|
+
if (options.worn === "separate") modelOptions.separateWorn = true;
|
|
78622
|
+
const built2 = BUILDERS[entry2.builder](kit, modelOptions);
|
|
78240
78623
|
nameParts(built2.parts);
|
|
78241
78624
|
let root;
|
|
78242
78625
|
if (entry2.builder === "launcher") {
|
|
@@ -79231,9 +79614,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
79231
79614
|
if (hit.thickness <= 0) return 0;
|
|
79232
79615
|
return Math.max(0, entry2.lossDb + MASS_LAW_DB_PER_DOUBLING * Math.log2(hit.thickness / entry2.thickness));
|
|
79233
79616
|
}
|
|
79234
|
-
function totalLossDb(
|
|
79617
|
+
function totalLossDb(hits2, setup = {}) {
|
|
79235
79618
|
let total = 0;
|
|
79236
|
-
for (const hit of
|
|
79619
|
+
for (const hit of hits2) total += hitLossDb(hit, setup);
|
|
79237
79620
|
return Math.min(total, setup.maxLossDb ?? OCCLUSION_DEFAULTS.maxLossDb);
|
|
79238
79621
|
}
|
|
79239
79622
|
function occlusionState(lossDb, setup = {}) {
|
|
@@ -84790,6 +85173,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
84790
85173
|
// src/fx/layers.ts
|
|
84791
85174
|
var createLayers = () => ({ casings: true, magazines: true, muzzleFlash: true, attachments: true, beams: true });
|
|
84792
85175
|
|
|
85176
|
+
// src/models/eject-port.ts
|
|
85177
|
+
var EJECT_SIDES = {
|
|
85178
|
+
right: [-0.25, 0.55, 0.8],
|
|
85179
|
+
up: [-0.1, 0.97, 0.2],
|
|
85180
|
+
down: [0, -1, 0.05],
|
|
85181
|
+
back: [-1, -0.1, 0],
|
|
85182
|
+
backUp: [-1, 0.9, 0]
|
|
85183
|
+
};
|
|
85184
|
+
var EJECT_SCATTER = 0.12;
|
|
85185
|
+
var ejectDirection = (THREE, side) => new THREE.Vector3(...EJECT_SIDES[side]).normalize();
|
|
85186
|
+
|
|
84793
85187
|
// src/laser-raycast.ts
|
|
84794
85188
|
var VIEWMODEL_NODE_NAME = "weapon-viewmodel";
|
|
84795
85189
|
var IN_HAND_NODE_NAME = "weapon-in-hand";
|
|
@@ -84856,7 +85250,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
84856
85250
|
/** A shouldered gun's bore runs this far above the shoulder pocket (the cheek on the comb). */
|
|
84857
85251
|
boreAbove: 0.05,
|
|
84858
85252
|
/** A handgun's (or a short two-hand gun's) grip: toward the middle of the chest, a little low, at the reach of bent arms. */
|
|
84859
|
-
handgunGrip: [-0.
|
|
85253
|
+
handgunGrip: [-0.13, -0.05, -0.4],
|
|
84860
85254
|
/** A one-hand tool's grip: low in front of the body, the elbow bent. */
|
|
84861
85255
|
toolGrip: [0.02, -0.34, -0.3],
|
|
84862
85256
|
/** A gun in each hand: each grip ahead of its own shoulder, a little in and low, the arms out at the aim (the left one is the mirror, in the left shoulder's frame). */
|
|
@@ -84872,7 +85266,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
84872
85266
|
/** The farthest apart two hands hold a long gun (a support hand past it slides back along the gun, toward the grip). */
|
|
84873
85267
|
supportSpan: 0.5,
|
|
84874
85268
|
/** A gun carried at the hip (`carry: 'hip'`): its rear grip low at the right hip, a little ahead of it. */
|
|
84875
|
-
hipGrip: [0.
|
|
85269
|
+
hipGrip: [0.2, -0.4, -0.24],
|
|
84876
85270
|
/**
|
|
84877
85271
|
* A tool put away against the body to free its hand (a magazine changed with a tool in each hand): tucked in the front of the belt on its own side, muzzle down and grip forward, its
|
|
84878
85272
|
* grip here in the frame of the shoulder pocket (the left one mirrored).
|
|
@@ -84984,6 +85378,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
84984
85378
|
// the lens of the long guns and the tools: a gun beside a blade in the other hand is drawn through the same one
|
|
84985
85379
|
dual: { grip: [0.19, -0.2, -0.4], fov: 84, sights: { distance: 0.42, fromRear: 0.02 } }
|
|
84986
85380
|
};
|
|
85381
|
+
var viewKindOf = (parts2, oneHand) => oneHand ? "dual" : parts2.carry === "hip" ? "hip" : parts2.family === "pistol" || parts2.family === "revolver" ? "handgun" : parts2.family === "rocket" ? "launcher" : "long";
|
|
84987
85382
|
var NO_GRIP_REAR = [0.2, -0.24, -0.12];
|
|
84988
85383
|
var SIGHT_UNDER_EYE = 0.02;
|
|
84989
85384
|
var scratch2 = { grip: null, hip: null, aimed: null, tilt: null };
|
|
@@ -85232,8 +85627,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85232
85627
|
var SHOVEL_SWING = {
|
|
85233
85628
|
keys: [
|
|
85234
85629
|
{ at: 0, ...HOLD },
|
|
85235
|
-
{ at: 0.3, offset: [0.
|
|
85236
|
-
{ at: 0.47, offset: [-0.025, 0, -0.
|
|
85630
|
+
{ at: 0.3, offset: [0.17, 0.04, 0.06], turn: [0.05, 0.2, 0.1] },
|
|
85631
|
+
{ at: 0.47, offset: [-0.025, 0, -0.08], turn: [0, -0.15, 0] },
|
|
85237
85632
|
{ at: 0.67, offset: [-0.16, -0.03, -0.1], turn: [0, -0.5, -0.075] },
|
|
85238
85633
|
{ at: 1, ...HOLD }
|
|
85239
85634
|
]
|
|
@@ -85262,7 +85657,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85262
85657
|
pivot: "grip",
|
|
85263
85658
|
keys: [
|
|
85264
85659
|
{ at: 0, ...HOLD },
|
|
85265
|
-
{ at: 0.
|
|
85660
|
+
{ at: 0.14, offset: [0.14, 0.03, 0.05], turn: [0.7, -0.9, 0] },
|
|
85661
|
+
{ at: 0.29, offset: [0.24, 0.04, 0.1], turn: [1.9, -0.6, 0] },
|
|
85266
85662
|
{ at: 0.43, offset: [-0.1, 0.04, -0.07], turn: [-0.3, 1.2, 0] },
|
|
85267
85663
|
{ at: 0.64, offset: [-0.28, 0.1, 0], turn: [2, 1, 0] },
|
|
85268
85664
|
{ at: 0.8, offset: [-0.2, 0.06, 0.02], turn: [1.8, 0.8, 0] },
|
|
@@ -85373,7 +85769,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85373
85769
|
return group;
|
|
85374
85770
|
}
|
|
85375
85771
|
|
|
85376
|
-
// ../game-items-three/dist/chunk-
|
|
85772
|
+
// ../game-items-three/dist/chunk-DBIE2ZMX.js
|
|
85377
85773
|
var destruction_default = {
|
|
85378
85774
|
families: {
|
|
85379
85775
|
drink_can: {
|
|
@@ -85770,6 +86166,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85770
86166
|
return;
|
|
85771
86167
|
}
|
|
85772
86168
|
const rule = modelId !== void 0 ? itemDestruction(modelId) : shapeId !== void 0 ? shapeDestruction(shapeId) : void 0;
|
|
86169
|
+
const body = options.parts?.length === 1 ? options.parts[0] : void 0;
|
|
85773
86170
|
if (rule?.tessellate) tessellateShapes(root, rule.tessellate, three);
|
|
85774
86171
|
const solid2 = [];
|
|
85775
86172
|
root.traverse((object2) => {
|
|
@@ -85783,6 +86180,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85783
86180
|
mesh3.userData.destructionSkin = true;
|
|
85784
86181
|
return;
|
|
85785
86182
|
}
|
|
86183
|
+
if (body) {
|
|
86184
|
+
mesh3.userData.destructionMaterial = body.material;
|
|
86185
|
+
if (body.thickness !== void 0) mesh3.userData.destructionThickness = body.thickness;
|
|
86186
|
+
}
|
|
85786
86187
|
if (rule?.hollow) mesh3.userData.hollow = true;
|
|
85787
86188
|
if (powder) mesh3.userData.destructionPowder = { color: powder.color };
|
|
85788
86189
|
solid2.push(mesh3);
|
|
@@ -85816,6 +86217,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
85816
86217
|
return object2;
|
|
85817
86218
|
};
|
|
85818
86219
|
return {
|
|
86220
|
+
carryHandle: (part) => {
|
|
86221
|
+
part.userData[CARRY_HANDLE_TAG] = true;
|
|
86222
|
+
return part;
|
|
86223
|
+
},
|
|
85819
86224
|
T: T2,
|
|
85820
86225
|
materials,
|
|
85821
86226
|
M,
|
|
@@ -89242,7 +89647,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
89242
89647
|
mesh3(bx(14, 5.5, 3), metal2(7304056), [23, 0, -6])
|
|
89243
89648
|
);
|
|
89244
89649
|
};
|
|
89245
|
-
var bucket = ({ mesh: mesh3, bx, cyl, G, plastic, metal: metal2 }) => {
|
|
89650
|
+
var bucket = ({ mesh: mesh3, bx, cyl, G, plastic, metal: metal2, carryHandle }) => {
|
|
89246
89651
|
const body = plastic(2908062);
|
|
89247
89652
|
const wire = metal2(9080209);
|
|
89248
89653
|
return G(
|
|
@@ -89251,7 +89656,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
89251
89656
|
mesh3(cyl(11.8, 11.8, 1, 16), plastic(2313602), [0, -13, 0]),
|
|
89252
89657
|
mesh3(bx(0.6, 3.7, 0.6), wire, [13, 11.35, 0]),
|
|
89253
89658
|
mesh3(bx(0.6, 3.7, 0.6), wire, [-13, 11.35, 0]),
|
|
89254
|
-
mesh3(bx(27.2, 0.5, 1.1), wire, [0, 13.25, 0])
|
|
89659
|
+
carryHandle(mesh3(bx(27.2, 0.5, 1.1), wire, [0, 13.25, 0]))
|
|
89255
89660
|
);
|
|
89256
89661
|
};
|
|
89257
89662
|
var binoculars = ({ mesh: mesh3, bx, cyl, G, M, plastic, metal: metal2 }) => {
|
|
@@ -91876,7 +92281,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
91876
92281
|
const materials = kit.materials.slice(first);
|
|
91877
92282
|
if (options.wear) setWear(materials, options.wear);
|
|
91878
92283
|
root.userData.wear = options.wear ?? 0;
|
|
91879
|
-
if (options.destructible) tagForDestruction(root, { ...kind === "model" && item.model !== void 0 ? { modelId: item.model } : {}, ...shape === void 0 ? {} : { shapeId: shape }, ...item.weight === void 0 ? {} : { weight: item.weight }, size: item.size, ...item.powder ? { powder: item.powder } : {}, three: T2 });
|
|
92284
|
+
if (options.destructible) tagForDestruction(root, { ...kind === "model" && item.model !== void 0 ? { modelId: item.model } : {}, ...shape === void 0 ? {} : { shapeId: shape }, ...item.weight === void 0 ? {} : { weight: item.weight }, size: item.size, ...item.powder ? { powder: item.powder } : {}, ...item.parts ? { parts: item.parts } : {}, three: T2 });
|
|
91880
92285
|
markKitOrigin(root, { owner: "game-items-three", kind: "item", id: item.id, ...kind === "shape" ? { standIn: true } : {} });
|
|
91881
92286
|
return { root, kind, ...shape ? { shape } : {}, size: item.size, materials };
|
|
91882
92287
|
}
|
|
@@ -92092,7 +92497,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92092
92497
|
["nail_bat", { grips: { handle: -0.3, support: -0.41 } }],
|
|
92093
92498
|
["iron_pipe", { grips: { handle: -0.29, support: -0.41 } }],
|
|
92094
92499
|
["crowbar", { grips: { handle: -0.3, support: -0.42 } }],
|
|
92095
|
-
["sledgehammer", { grips: { handle: -0.22, support: -0.42 } }]
|
|
92500
|
+
["sledgehammer", { grips: { handle: -0.22, support: -0.42 } }],
|
|
92501
|
+
// an axe and a pickaxe are swung with both hands as the shovel is (the `two_hand_swing` family): the right at the end of the haft, the left up it toward the head
|
|
92502
|
+
["axe", { grips: { handle: -0.44, support: -0.2 } }],
|
|
92503
|
+
["pickaxe", { grips: { handle: -0.44, support: -0.2 } }],
|
|
92504
|
+
// a spear is thrust with both hands on the shaft, a forearm apart
|
|
92505
|
+
["improvised_spear", { grips: { handle: -0.35, support: -0.12 } }]
|
|
92096
92506
|
];
|
|
92097
92507
|
var hasThrowableModel = (def) => def.action?.kind === "throwable" && def.action.explosive !== void 0 && hasExplosiveModel(def.action.explosive);
|
|
92098
92508
|
var buildThrowableModel = (THREE, def) => def.action?.kind === "throwable" && def.action.explosive !== void 0 ? buildExplosiveModel(THREE, def.action.explosive) : void 0;
|
|
@@ -92124,6 +92534,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92124
92534
|
|
|
92125
92535
|
// src/box-fx.ts
|
|
92126
92536
|
var TOOL_REACH = 0.47;
|
|
92537
|
+
var RIGID_IN_HAND = /* @__PURE__ */ new Set(["melee", "tool"]);
|
|
92538
|
+
var SEAT_STILL = { distance: 1e-4, angle: 1e-4 };
|
|
92127
92539
|
var EJECTS_ON_SHOT = /* @__PURE__ */ new Set(["pistol", "smg", "carbine", "rifle", "sniper", "shotgun"]);
|
|
92128
92540
|
var SPOUTS = /* @__PURE__ */ new Set(["firearm", "flame", "heat", "extinguisher"]);
|
|
92129
92541
|
var DROPS_MAGAZINE = /* @__PURE__ */ new Set(["pistol", "smg", "carbine", "rifle", "sniper"]);
|
|
@@ -92149,7 +92561,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92149
92561
|
let inHand = null;
|
|
92150
92562
|
let def = null;
|
|
92151
92563
|
let hold = null;
|
|
92152
|
-
let
|
|
92564
|
+
let kick2 = 0;
|
|
92153
92565
|
let motion = null;
|
|
92154
92566
|
const applyMotion = (frame2) => {
|
|
92155
92567
|
if (!motion) return;
|
|
@@ -92190,6 +92602,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92190
92602
|
const q = new THREE.Quaternion();
|
|
92191
92603
|
const bodyFrame = new THREE.Quaternion();
|
|
92192
92604
|
const q2 = new THREE.Quaternion();
|
|
92605
|
+
const seatTurn = new THREE.Quaternion();
|
|
92606
|
+
const seatAsked = new THREE.Quaternion();
|
|
92193
92607
|
const pointForward = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI / 2);
|
|
92194
92608
|
const frontOf = new THREE.Vector3();
|
|
92195
92609
|
const restBox2 = new THREE.Box3();
|
|
@@ -92255,15 +92669,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92255
92669
|
scene.add(mesh3);
|
|
92256
92670
|
bodies.push({ mesh: mesh3, velocity: velocity2, spin: new THREE.Vector3(random() * 20 - 10, random() * 30 - 15, random() * 20 - 10), radius, age: 0, resting: false, bounces: 0, kind });
|
|
92257
92671
|
};
|
|
92258
|
-
const ejectCasing = (caliberMm, isShell
|
|
92672
|
+
const ejectCasing = (caliberMm, isShell) => {
|
|
92673
|
+
if (!model) return;
|
|
92259
92674
|
const radius = isShell ? 0.0105 : Math.max(3e-3, caliberMm / 1e3 * 0.6);
|
|
92260
92675
|
const length2 = isShell ? 0.068 : Math.min(0.07, Math.max(0.015, caliberMm / 1e3 * 2.6));
|
|
92261
92676
|
const mesh3 = new THREE.Mesh(new THREE.CylinderGeometry(radius, radius, length2, 8), isShell ? shell : brass);
|
|
92262
92677
|
mesh3.name = "casing";
|
|
92263
|
-
|
|
92264
|
-
const
|
|
92265
|
-
|
|
92266
|
-
const
|
|
92678
|
+
hand.updateMatrixWorld(true);
|
|
92679
|
+
const from = model.localToWorld(new THREE.Vector3(frontOf.x - lengthMetres * 0.4, frontOf.y + 0.02, 0.015));
|
|
92680
|
+
if (inLens) toWorldLens(camera2, from, camera2.fov ?? 72, VIEW_HOLD.tool.fov);
|
|
92681
|
+
const scatter2 = new THREE.Vector3(random() - 0.5, random() - 0.5, random() - 0.5).multiplyScalar(2 * EJECT_SCATTER);
|
|
92682
|
+
const velocity2 = ejectDirection(THREE, "right").add(scatter2).normalize().multiplyScalar(1.5 + random() * 0.6).applyQuaternion(model.getWorldQuaternion(q2));
|
|
92267
92683
|
throwBody("casing", mesh3, from, velocity2, radius);
|
|
92268
92684
|
};
|
|
92269
92685
|
const dropMagazine = (category) => {
|
|
@@ -92285,20 +92701,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92285
92701
|
bodies.splice(bodies.indexOf(body), 1);
|
|
92286
92702
|
}
|
|
92287
92703
|
const onShot = (weapon2) => {
|
|
92288
|
-
|
|
92704
|
+
kick2 = 1;
|
|
92289
92705
|
const caliber = weapon2.action.kind === "firearm" ? arsenal.calibers.get(weapon2.action.caliber) : void 0;
|
|
92290
92706
|
const energy = caliber ? muzzleEnergy(caliber) * (caliber.pellets ?? 1) : FALLBACK_ENERGY;
|
|
92291
92707
|
audio?.shot(energy, weapon2.category, { ...caliber ? { caliber } : {}, distance: options.soundDistance?.() ?? 0, space: options.soundSpace?.() ?? "outdoor" });
|
|
92292
92708
|
if (CYCLES.has(weapon2.id)) audio?.cycle();
|
|
92293
|
-
if (EJECTS_ON_SHOT.has(weapon2.category) && weapon2.id !== "shotgun_double_12") ejectCasing(caliberOf2(weapon2), weapon2.category === "shotgun"
|
|
92709
|
+
if (EJECTS_ON_SHOT.has(weapon2.category) && weapon2.id !== "shotgun_double_12") ejectCasing(caliberOf2(weapon2), weapon2.category === "shotgun");
|
|
92294
92710
|
};
|
|
92295
|
-
const onReloadStart = (weapon2
|
|
92711
|
+
const onReloadStart = (weapon2) => {
|
|
92296
92712
|
if (DROPS_MAGAZINE.has(weapon2.category)) dropMagazine(weapon2.category);
|
|
92297
92713
|
else audio?.reloadStart(weapon2.category);
|
|
92298
|
-
if (weapon2.category === "revolver" || weapon2.id === "shotgun_double_12") {
|
|
92299
|
-
const spent = Math.max(1, tool2.capacity - tool2.ammo);
|
|
92300
|
-
for (let i = 0; i < spent; i++) ejectCasing(caliberOf2(weapon2), weapon2.category === "shotgun", true);
|
|
92301
|
-
}
|
|
92302
92714
|
};
|
|
92303
92715
|
const stepBody = (body, dt) => {
|
|
92304
92716
|
body.age += dt;
|
|
@@ -92351,6 +92763,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92351
92763
|
hand.updateMatrixWorld(true);
|
|
92352
92764
|
return targetsOf(THREE, held, model.getWorldQuaternion(q2), 0);
|
|
92353
92765
|
},
|
|
92766
|
+
seat(reached) {
|
|
92767
|
+
const held = heldHold();
|
|
92768
|
+
const got = reached[side];
|
|
92769
|
+
if (!model || !def || !held || !got || !RIGID_IN_HAND.has(def.action.kind)) return false;
|
|
92770
|
+
hand.updateMatrixWorld(true);
|
|
92771
|
+
const asked = targetsOf(THREE, held, model.getWorldQuaternion(q2), 0)[side];
|
|
92772
|
+
if (!asked) return false;
|
|
92773
|
+
seatTurn.set(...got.quaternion).multiply(seatAsked.set(...asked.quaternion).invert());
|
|
92774
|
+
const off = Math.hypot(got.position[0] - asked.position[0], got.position[1] - asked.position[1], got.position[2] - asked.position[2]);
|
|
92775
|
+
if (off < SEAT_STILL.distance && 2 * Math.acos(Math.min(1, Math.abs(seatTurn.w))) < SEAT_STILL.angle) return false;
|
|
92776
|
+
hand.position.sub(v.set(...asked.position)).applyQuaternion(seatTurn).add(v.set(...got.position));
|
|
92777
|
+
hand.quaternion.premultiply(seatTurn);
|
|
92778
|
+
hand.updateMatrixWorld(true);
|
|
92779
|
+
return true;
|
|
92780
|
+
},
|
|
92354
92781
|
handle(event, tool2) {
|
|
92355
92782
|
if (event.type === "explosion" || event.type === "player" || event.type === "footfall") return;
|
|
92356
92783
|
const weapon2 = arsenal.weapons.get(event.weapon);
|
|
@@ -92365,12 +92792,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92365
92792
|
}
|
|
92366
92793
|
if (event.type === "shot") onShot(weapon2);
|
|
92367
92794
|
else if (event.type === "empty") audio?.click();
|
|
92368
|
-
else if (event.type === "reload" && event.phase === "start") onReloadStart(weapon2
|
|
92795
|
+
else if (event.type === "reload" && event.phase === "start") onReloadStart(weapon2);
|
|
92369
92796
|
else if (event.type === "reload" && event.phase === "end") audio?.reloadEnd(weapon2.category);
|
|
92370
92797
|
reloading = tool2.reloading;
|
|
92371
92798
|
},
|
|
92372
92799
|
update(dt) {
|
|
92373
|
-
|
|
92800
|
+
kick2 *= Math.exp(-dt * 14);
|
|
92374
92801
|
if (motion) {
|
|
92375
92802
|
motion.elapsed += dt;
|
|
92376
92803
|
if (motion.elapsed >= motion.duration) motion = null;
|
|
@@ -92381,7 +92808,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92381
92808
|
const held = heldHold();
|
|
92382
92809
|
const kind = isOneHand() && def?.action.kind === "firearm" ? "dual" : "tool";
|
|
92383
92810
|
placeInView({ THREE, hand, holder: model, camera: camera2, right: heldAnchor(held), box: restBox2, kind, aim: 0, offset: noMotion, ...side === "L" ? { mirror: true } : {} });
|
|
92384
|
-
hand.position.add(v.set(0, -0.12 * dip, 0.05 *
|
|
92811
|
+
hand.position.add(v.set(0, -0.12 * dip, 0.05 * kick2).applyQuaternion(camera2.quaternion));
|
|
92385
92812
|
applyMotion(camera2.quaternion);
|
|
92386
92813
|
hand.updateMatrixWorld(true);
|
|
92387
92814
|
} else if (inHand && model) {
|
|
@@ -92392,8 +92819,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92392
92819
|
const grip = def?.action.kind === "firearm" ? BODY_HOLD.dualGrip : BODY_HOLD.toolGrip;
|
|
92393
92820
|
placeOnBody({ THREE, hand, holder: model, frame: options.bodyHold?.() ?? eyeFrame(), rear, lengthMetres, handgun: true, right: heldAnchor(held), left: null, grip, ...side === "L" ? { mirror: true } : {} });
|
|
92394
92821
|
} else placeOnBody({ THREE, hand, holder: model, frame: options.bodyHold?.() ?? eyeFrame(), rear, lengthMetres, handgun, right: hold?.right ?? null, left: hold?.left ?? null });
|
|
92395
|
-
hand.position.add(v.set(0, -0.12 * dip, 0.05 *
|
|
92396
|
-
q.setFromEuler(new THREE.Euler(0.14 *
|
|
92822
|
+
hand.position.add(v.set(0, -0.12 * dip, 0.05 * kick2).applyQuaternion(camera2.quaternion));
|
|
92823
|
+
q.setFromEuler(new THREE.Euler(0.14 * kick2 - 0.25 * dip, 0, 0.6 * dip));
|
|
92397
92824
|
hand.quaternion.multiply(q);
|
|
92398
92825
|
const body = options.bodyHold?.() ?? eyeFrame();
|
|
92399
92826
|
applyMotion(bodyFrame.set(body.quaternion[0], body.quaternion[1], body.quaternion[2], body.quaternion[3]));
|
|
@@ -92567,9 +92994,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92567
92994
|
}
|
|
92568
92995
|
function cycleClip(context) {
|
|
92569
92996
|
const { parts: parts2, family } = context;
|
|
92570
|
-
if (family === "pump" && parts2.pump) return composeClip("cycle", [move("pump", "x", 0.22, 0.11, 0, PUMP_TRAVEL), move("pump", "x", 0.36, 0.11, PUMP_TRAVEL, 0)], [cue(0.3, "eject_casing"
|
|
92571
|
-
if ((family === "bolt" || family === "boltmag") && parts2.bolt && parts2.boltHandle) return composeClip("cycle", boltStroke(0.3), [cue(0.5, "eject_casing"
|
|
92572
|
-
if (family === "lever" && parts2.lever) return composeClip("cycle", [turn("lever", "z", 0.22, 0.13, 0, LEVER_TURN), turn("lever", "z", 0.38, 0.13, LEVER_TURN, 0)], [cue(0.3, "eject_casing"
|
|
92997
|
+
if (family === "pump" && parts2.pump) return composeClip("cycle", [move("pump", "x", 0.22, 0.11, 0, PUMP_TRAVEL), move("pump", "x", 0.36, 0.11, PUMP_TRAVEL, 0)], [cue(0.3, "eject_casing")], 0.5);
|
|
92998
|
+
if ((family === "bolt" || family === "boltmag") && parts2.bolt && parts2.boltHandle) return composeClip("cycle", boltStroke(0.3), [cue(0.5, "eject_casing")], 0.82);
|
|
92999
|
+
if (family === "lever" && parts2.lever) return composeClip("cycle", [turn("lever", "z", 0.22, 0.13, 0, LEVER_TURN), turn("lever", "z", 0.38, 0.13, LEVER_TURN, 0)], [cue(0.3, "eject_casing")], 0.55);
|
|
92573
93000
|
return void 0;
|
|
92574
93001
|
}
|
|
92575
93002
|
var STUCK_AT = { stovepipe: 0.35, double_feed: 0.6, misfire: 0, failure_to_extract: 0 };
|
|
@@ -92644,7 +93071,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92644
93071
|
return draft;
|
|
92645
93072
|
}
|
|
92646
93073
|
function revolverReload(kind) {
|
|
92647
|
-
const events = [sound2(0, "cylinder_open"), cue(0.32, "eject_casing", { from: "chambers"
|
|
93074
|
+
const events = [sound2(0, "cylinder_open"), cue(0.32, "eject_casing", { from: "chambers" }), sound2(0.32, "cylinder_eject"), sound2(1.2, "cylinder_close")];
|
|
92648
93075
|
if (kind !== "one_by_one") events.push(cue(0.7, "move_in", { from: "chambers" }), sound2(0.7, "speedloader"));
|
|
92649
93076
|
return { tweens: [turn("crane", "x", 0, 0.22, 0, -1.25), turn("crane", "x", 1.05, 0.2, -1.25, 0)], events, end: 1.3 };
|
|
92650
93077
|
}
|
|
@@ -92652,7 +93079,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92652
93079
|
tweens: [turn("barrels", "z", 0, 0.2, 0, -0.5), turn("barrels", "z", 1, 0.15, -0.5, 0)],
|
|
92653
93080
|
events: [
|
|
92654
93081
|
sound2(0, "barrels_open"),
|
|
92655
|
-
cue(0.25, "eject_casing", { from: "breech"
|
|
93082
|
+
cue(0.25, "eject_casing", { from: "breech" }),
|
|
92656
93083
|
sound2(0.25, "casings_eject"),
|
|
92657
93084
|
cue(0.65, "move_in", { from: "breech" }),
|
|
92658
93085
|
sound2(0.65, "shell_insert"),
|
|
@@ -92765,12 +93192,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92765
93192
|
var FAULT_SLIDE_BACK = { stovepipe: 0.35, double_feed: 0.6 };
|
|
92766
93193
|
var pullTrigger = (context) => context.parts.trigger ? [turn("trigger", "z", 0, 0.04, 0, 0.35), turn("trigger", "z", 0.06, 0.08, 0.35, 0)] : [];
|
|
92767
93194
|
var recoil = (context) => {
|
|
92768
|
-
const
|
|
93195
|
+
const kick2 = kickOf(context);
|
|
92769
93196
|
return [
|
|
92770
|
-
move(ROOT2, "x", 0, 0.03, 0, -0.014 *
|
|
92771
|
-
turn(ROOT2, "z", 0, 0.03, 0, 0.045 *
|
|
92772
|
-
move(ROOT2, "x", 0.03, 0.18, -0.014 *
|
|
92773
|
-
turn(ROOT2, "z", 0.03, 0.18, 0.045 *
|
|
93197
|
+
move(ROOT2, "x", 0, 0.03, 0, -0.014 * kick2),
|
|
93198
|
+
turn(ROOT2, "z", 0, 0.03, 0, 0.045 * kick2),
|
|
93199
|
+
move(ROOT2, "x", 0.03, 0.18, -0.014 * kick2, 0),
|
|
93200
|
+
turn(ROOT2, "z", 0.03, 0.18, 0.045 * kick2, 0)
|
|
92774
93201
|
];
|
|
92775
93202
|
};
|
|
92776
93203
|
var spinBarrels = (context) => context.parts.barrels && context.family === "belt" ? [turn("barrels", "x", 0, 0.03, 0, Math.PI / 3)] : [];
|
|
@@ -92786,7 +93213,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
92786
93213
|
tweens.push(move(part, "x", 0, 0.025, 0, travel));
|
|
92787
93214
|
if (!locked) tweens.push(move(part, "x", 0.025, 0.045, travel, 0));
|
|
92788
93215
|
}
|
|
92789
|
-
events.push(cue(0.012, "eject_casing"
|
|
93216
|
+
events.push(cue(0.012, "eject_casing"));
|
|
92790
93217
|
} else if (REVOLVING.has(family) && parts2.cylinder && parts2.hammer) {
|
|
92791
93218
|
tweens.push(turn("cylinder", "x", 0, 0.05, 0, Math.PI / 3), turn("hammer", "z", 0, 0.05, 0, 0.5), turn("hammer", "z", 0.05, 0.03, 0.5, -0.5), turn("hammer", "z", 0.12, 0.08, -0.5, 0));
|
|
92792
93219
|
}
|
|
@@ -97827,11 +98254,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97827
98254
|
const { x, y, scale } = args;
|
|
97828
98255
|
let best;
|
|
97829
98256
|
let bestDistance = 9;
|
|
97830
|
-
for (const
|
|
97831
|
-
const distance4 = Math.hypot(
|
|
98257
|
+
for (const block2 of blocks) {
|
|
98258
|
+
const distance4 = Math.hypot(block2.x - x, block2.y - y);
|
|
97832
98259
|
if (distance4 < bestDistance) {
|
|
97833
98260
|
bestDistance = distance4;
|
|
97834
|
-
best =
|
|
98261
|
+
best = block2;
|
|
97835
98262
|
}
|
|
97836
98263
|
}
|
|
97837
98264
|
if (!best) return;
|
|
@@ -97845,10 +98272,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97845
98272
|
impact2(host.engine, "concrete", [ORIGIN4[0] + x, y, ORIGIN4[2] + 0.13], [0, 0, 1], 0.8);
|
|
97846
98273
|
} else if (action === "collapse") {
|
|
97847
98274
|
const { x, y } = args;
|
|
97848
|
-
for (const
|
|
97849
|
-
const dx =
|
|
97850
|
-
const dy =
|
|
97851
|
-
|
|
98275
|
+
for (const block2 of blocks) {
|
|
98276
|
+
const dx = block2.x - x;
|
|
98277
|
+
const dy = block2.y - y;
|
|
98278
|
+
block2.motion = {
|
|
97852
98279
|
vx: dx * random.between(0.8, 2),
|
|
97853
98280
|
vy: random.between(0.5, 2.5) + dy * 0.5,
|
|
97854
98281
|
vz: random.between(-2.2, -0.4),
|
|
@@ -97865,17 +98292,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97865
98292
|
throw new Error(`blocks: unknown query ${name}`);
|
|
97866
98293
|
},
|
|
97867
98294
|
update(_host, dt) {
|
|
97868
|
-
for (const
|
|
97869
|
-
const motion =
|
|
98295
|
+
for (const block2 of blocks) {
|
|
98296
|
+
const motion = block2.motion;
|
|
97870
98297
|
if (!motion || motion.rest) continue;
|
|
97871
98298
|
motion.vy -= 9.8 * dt;
|
|
97872
|
-
|
|
97873
|
-
|
|
97874
|
-
|
|
97875
|
-
|
|
97876
|
-
|
|
97877
|
-
if (
|
|
97878
|
-
|
|
98299
|
+
block2.x += motion.vx * dt;
|
|
98300
|
+
block2.y += motion.vy * dt;
|
|
98301
|
+
block2.rotation[0] += motion.wx * dt;
|
|
98302
|
+
block2.rotation[1] += motion.wy * dt;
|
|
98303
|
+
block2.rotation[2] += motion.wz * dt;
|
|
98304
|
+
if (block2.y < FLOOR2) {
|
|
98305
|
+
block2.y = FLOOR2;
|
|
97879
98306
|
motion.vy *= -0.25;
|
|
97880
98307
|
motion.vx *= 0.5;
|
|
97881
98308
|
motion.vz *= 0.5;
|
|
@@ -97884,8 +98311,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97884
98311
|
motion.wz *= 0.5;
|
|
97885
98312
|
if (Math.abs(motion.vy) < 0.4 && Math.hypot(motion.vx, motion.vz) < 0.3) {
|
|
97886
98313
|
motion.rest = true;
|
|
97887
|
-
|
|
97888
|
-
|
|
98314
|
+
block2.rotation[0] = Math.round(block2.rotation[0] / QUARTER_TURN) * QUARTER_TURN;
|
|
98315
|
+
block2.rotation[2] = Math.round(block2.rotation[2] / QUARTER_TURN) * QUARTER_TURN;
|
|
97889
98316
|
}
|
|
97890
98317
|
}
|
|
97891
98318
|
}
|
|
@@ -103547,6 +103974,45 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
103547
103974
|
};
|
|
103548
103975
|
}
|
|
103549
103976
|
|
|
103977
|
+
// src/fx/worn-pack-rig.ts
|
|
103978
|
+
var MOUNT_TURN = Math.PI / 2;
|
|
103979
|
+
var HOSE_SAG = 0.18;
|
|
103980
|
+
var HOSE_RADIUS = 0.011;
|
|
103981
|
+
var HOSE_SEGMENTS = 28;
|
|
103982
|
+
var createWornPackRig = (THREE, scene, pack2) => {
|
|
103983
|
+
const turn2 = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), MOUNT_TURN);
|
|
103984
|
+
const cord = createHangingCord(THREE, { segments: HOSE_SEGMENTS, radius: HOSE_RADIUS, material: pack2.hoseMaterial });
|
|
103985
|
+
const hose2 = cord.mesh;
|
|
103986
|
+
const from = new THREE.Vector3();
|
|
103987
|
+
const to = new THREE.Vector3();
|
|
103988
|
+
const rotation2 = new THREE.Quaternion();
|
|
103989
|
+
const offset = new THREE.Vector3();
|
|
103990
|
+
pack2.root.visible = false;
|
|
103991
|
+
hose2.visible = false;
|
|
103992
|
+
scene.add(pack2.root, hose2);
|
|
103993
|
+
return {
|
|
103994
|
+
update(slot) {
|
|
103995
|
+
const shown = slot !== null;
|
|
103996
|
+
pack2.root.visible = shown;
|
|
103997
|
+
hose2.visible = shown;
|
|
103998
|
+
if (!slot) return;
|
|
103999
|
+
rotation2.set(...slot.quaternion).multiply(turn2);
|
|
104000
|
+
pack2.root.quaternion.copy(rotation2);
|
|
104001
|
+
pack2.root.position.set(...slot.position).sub(offset.copy(pack2.mount.position).applyQuaternion(rotation2));
|
|
104002
|
+
pack2.root.updateMatrixWorld(true);
|
|
104003
|
+
pack2.wandEnd.getWorldPosition(from);
|
|
104004
|
+
pack2.port.getWorldPosition(to);
|
|
104005
|
+
cord.hang(from, to, HOSE_SAG);
|
|
104006
|
+
},
|
|
104007
|
+
dispose() {
|
|
104008
|
+
hose2.removeFromParent();
|
|
104009
|
+
hose2.geometry.dispose();
|
|
104010
|
+
pack2.root.removeFromParent();
|
|
104011
|
+
discardObject3D(pack2.root);
|
|
104012
|
+
}
|
|
104013
|
+
};
|
|
104014
|
+
};
|
|
104015
|
+
|
|
103550
104016
|
// src/fx/heavy.ts
|
|
103551
104017
|
var PI17 = Math.PI;
|
|
103552
104018
|
var ROCKET_LIGHT_NAME = "rocket-light";
|
|
@@ -103958,6 +104424,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
103958
104424
|
|
|
103959
104425
|
// src/fx/viewmodel-events.ts
|
|
103960
104426
|
var PI18 = Math.PI;
|
|
104427
|
+
var DROP_SPEED = 0.4;
|
|
103961
104428
|
var UGL_FLASH = 1.6;
|
|
103962
104429
|
var restFlat = (object2) => {
|
|
103963
104430
|
object2.rotation.x = 0;
|
|
@@ -103978,10 +104445,16 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
103978
104445
|
if (session.cartridge.caseType) casing2.group.userData["caseType"] = session.cartridge.caseType;
|
|
103979
104446
|
particles.spawn(casing2.group, velocity2, { kind: "casing", life: 25, radius: casing2.radius, bounce: 0.35, spin, onRest: restFlat, ownsGeometry: true, collider: casingCollider(casing2.radius, casing2.length) });
|
|
103980
104447
|
};
|
|
103981
|
-
const
|
|
104448
|
+
const scattered = (side, speed) => {
|
|
104449
|
+
const direction = ejectDirection(THREE, side);
|
|
104450
|
+
const jitter = vector2(random() - 0.5, random() - 0.5, random() - 0.5).multiplyScalar(2 * EJECT_SCATTER);
|
|
104451
|
+
return direction.add(jitter).normalize().multiplyScalar(speed);
|
|
104452
|
+
};
|
|
104453
|
+
const ejectFromPort = () => {
|
|
103982
104454
|
if (!parts2.eject) return;
|
|
103983
|
-
const
|
|
103984
|
-
|
|
104455
|
+
const side = parts2.ejectSide ?? "right";
|
|
104456
|
+
const speed = side === "down" ? DROP_SPEED : (1.5 + random() * 0.6) * reach2;
|
|
104457
|
+
throwCase(parts2.eject, toWorld3(session, scattered(side, speed)), vector2(random() * 30, random() * 30, random() * 30));
|
|
103985
104458
|
};
|
|
103986
104459
|
const ejectAll = (marks, spent) => {
|
|
103987
104460
|
marks?.forEach((mark, index) => {
|
|
@@ -104055,7 +104528,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104055
104528
|
const round5 = buildRound(kit, session.cartridge.dims, session.cartridge.shape);
|
|
104056
104529
|
round5.group.position.copy(positionOf3(parts2.eject));
|
|
104057
104530
|
particles.spawn(round5.group, toWorld3(session, vector2(-0.2, 1.1, 1.2)), { kind: "round", life: 25, radius: round5.radius, bounce: 0.3, spin: vector2(8, 12, 6), onRest: restFlat, ownsGeometry: true });
|
|
104058
|
-
} else ejectFromPort(
|
|
104531
|
+
} else ejectFromPort();
|
|
104059
104532
|
};
|
|
104060
104533
|
const trackOf = (mark) => () => root.parent ? { position: positionOf3(mark), orientation: root.getWorldQuaternion(new THREE.Quaternion()) } : null;
|
|
104061
104534
|
return (event) => {
|
|
@@ -104073,9 +104546,9 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104073
104546
|
}
|
|
104074
104547
|
break;
|
|
104075
104548
|
case "eject_casing":
|
|
104076
|
-
if (data.from === "chambers") ejectAll(parts2.chambers, () => ({ velocity:
|
|
104077
|
-
else if (data.from === "breech") ejectAll(parts2.breech, () => ({ velocity:
|
|
104078
|
-
else ejectFromPort(
|
|
104549
|
+
if (data.from === "chambers") ejectAll(parts2.chambers, () => ({ velocity: scattered("back", 0.5 + random() * 0.3), spin: vector2(10, 20, 5), tilt: 0 }));
|
|
104550
|
+
else if (data.from === "breech") ejectAll(parts2.breech, () => ({ velocity: scattered("backUp", 1.3), spin: vector2(3, 8, 12), tilt: -0.5 }));
|
|
104551
|
+
else ejectFromPort();
|
|
104079
104552
|
break;
|
|
104080
104553
|
case "drop_magazine":
|
|
104081
104554
|
dropMagazine(data.up === true);
|
|
@@ -104679,6 +105152,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104679
105152
|
hand.add(holder);
|
|
104680
105153
|
let tasks = [];
|
|
104681
105154
|
let stockRig = null;
|
|
105155
|
+
let wornRig = null;
|
|
104682
105156
|
let stockFolded = false;
|
|
104683
105157
|
let session = null;
|
|
104684
105158
|
let player = null;
|
|
@@ -104722,6 +105196,8 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104722
105196
|
lens2 = null;
|
|
104723
105197
|
lensLayer = -1;
|
|
104724
105198
|
session.attachments?.dispose();
|
|
105199
|
+
wornRig?.dispose();
|
|
105200
|
+
wornRig = null;
|
|
104725
105201
|
discardObject3D(session.model.root);
|
|
104726
105202
|
player = null;
|
|
104727
105203
|
session = null;
|
|
@@ -104747,7 +105223,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104747
105223
|
});
|
|
104748
105224
|
const equip = (weapon2) => {
|
|
104749
105225
|
const def = arsenal.weapons.get(weapon2);
|
|
104750
|
-
const model = def ? buildWeaponModelById(THREE, weapon2) : void 0;
|
|
105226
|
+
const model = def ? buildWeaponModelById(THREE, weapon2, { worn: "separate" }) : void 0;
|
|
104751
105227
|
if (!def || !model) return false;
|
|
104752
105228
|
release();
|
|
104753
105229
|
hold = null;
|
|
@@ -104758,6 +105234,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104758
105234
|
lift = 0;
|
|
104759
105235
|
rigStock(THREE, model, def);
|
|
104760
105236
|
rigUnderbarrel(THREE, model, def);
|
|
105237
|
+
wornRig = model.parts.worn ? createWornPackRig(THREE, scene, model.parts.worn) : null;
|
|
104761
105238
|
const modelBox = new THREE.Box3().setFromObject(model.root);
|
|
104762
105239
|
const length2 = modelBox.getSize(new THREE.Vector3()).x;
|
|
104763
105240
|
modelRear = modelBox.min.x;
|
|
@@ -104928,7 +105405,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104928
105405
|
const oneHand = isOneHand();
|
|
104929
105406
|
const held = heldHold();
|
|
104930
105407
|
if (options.firstPerson?.()) {
|
|
104931
|
-
const kind =
|
|
105408
|
+
const kind = viewKindOf(session.model.parts, oneHand);
|
|
104932
105409
|
const aim = oneHand || kind === "hip" ? 0 : options.aim?.() ?? 0;
|
|
104933
105410
|
placeInView({ THREE, hand, holder, camera: camera2, right: heldAnchor(held), box: restBox2, kind, aim, offset: viewMotion(dt, aim), ...side === "L" ? { mirror: true } : {} });
|
|
104934
105411
|
setLens(kind);
|
|
@@ -105023,6 +105500,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
105023
105500
|
clock += dt;
|
|
105024
105501
|
if (session) {
|
|
105025
105502
|
place(dt);
|
|
105503
|
+
wornRig?.update(options.firstPerson?.() ? null : options.bodySlot?.("back") ?? null);
|
|
105026
105504
|
player?.update(dt);
|
|
105027
105505
|
if (posed.length) {
|
|
105028
105506
|
hand.updateMatrixWorld(true);
|
|
@@ -105152,6 +105630,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
105152
105630
|
...options.physics ? { physics: options.physics } : {},
|
|
105153
105631
|
...options.contact ? { contact: options.contact } : {},
|
|
105154
105632
|
...options.bodyHold ? { bodyHold: options.bodyHold } : {},
|
|
105633
|
+
...options.bodySlot ? { bodySlot: options.bodySlot } : {},
|
|
105155
105634
|
...options.firstPerson ? { firstPerson: options.firstPerson } : {},
|
|
105156
105635
|
...options.viewmodelFov ? { viewmodelFov: options.viewmodelFov } : {},
|
|
105157
105636
|
...options.aim ? { aim: options.aim } : {},
|
|
@@ -105239,6 +105718,11 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
105239
105718
|
if (supportR > 0.5) delete merged2.fingers;
|
|
105240
105719
|
return merged2;
|
|
105241
105720
|
},
|
|
105721
|
+
seat: (reached) => {
|
|
105722
|
+
const moved = model.inHand === null && box5.seat(reached);
|
|
105723
|
+
const movedLeft = left !== null && leftHeld() && left.model.inHand === null && left.box.seat(reached);
|
|
105724
|
+
return moved || movedLeft;
|
|
105725
|
+
},
|
|
105242
105726
|
muzzle: (hand) => {
|
|
105243
105727
|
const pair = hand === "L" ? left : right;
|
|
105244
105728
|
if (!pair) return null;
|
|
@@ -105775,6 +106259,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
105775
106259
|
source: "generated",
|
|
105776
106260
|
file: "generated/famas.svg"
|
|
105777
106261
|
},
|
|
106262
|
+
fists: {
|
|
106263
|
+
source: "generated",
|
|
106264
|
+
file: "generated/fists.svg"
|
|
106265
|
+
},
|
|
105778
106266
|
flamethrower: {
|
|
105779
106267
|
source: "generated",
|
|
105780
106268
|
file: "generated/flamethrower.svg"
|
|
@@ -105871,6 +106359,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
105871
106359
|
source: "generated",
|
|
105872
106360
|
file: "generated/hammer.svg"
|
|
105873
106361
|
},
|
|
106362
|
+
hand: {
|
|
106363
|
+
source: "generated",
|
|
106364
|
+
file: "generated/hand.svg"
|
|
106365
|
+
},
|
|
105874
106366
|
hatchet: {
|
|
105875
106367
|
source: "generated",
|
|
105876
106368
|
file: "generated/hatchet.svg"
|
|
@@ -105971,6 +106463,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
105971
106463
|
source: "generated",
|
|
105972
106464
|
file: "generated/kel_tec_ksg.svg"
|
|
105973
106465
|
},
|
|
106466
|
+
kick: {
|
|
106467
|
+
source: "generated",
|
|
106468
|
+
file: "generated/kick.svg"
|
|
106469
|
+
},
|
|
105974
106470
|
knife: {
|
|
105975
106471
|
source: "generated",
|
|
105976
106472
|
file: "generated/knife.svg"
|
|
@@ -106223,6 +106719,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
106223
106719
|
source: "generated",
|
|
106224
106720
|
file: "generated/shotgun_semi_12.svg"
|
|
106225
106721
|
},
|
|
106722
|
+
shove: {
|
|
106723
|
+
source: "generated",
|
|
106724
|
+
file: "generated/shove.svg"
|
|
106725
|
+
},
|
|
106226
106726
|
shovel: {
|
|
106227
106727
|
source: "generated",
|
|
106228
106728
|
file: "generated/shovel.svg"
|
|
@@ -106883,6 +107383,16 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
106883
107383
|
get fx() {
|
|
106884
107384
|
return fx;
|
|
106885
107385
|
},
|
|
107386
|
+
// every tool of the arsenal has its picture: the hotbar shows it for the ones no item stands for too (the generic guns, the hand and the fists)
|
|
107387
|
+
toolThumbnails: () => {
|
|
107388
|
+
const urls = {};
|
|
107389
|
+
if (thumbnailBase === false) return urls;
|
|
107390
|
+
for (const id of arsenal.weapons.keys()) {
|
|
107391
|
+
const url2 = weaponThumbnailUrl(id, thumbnailBase);
|
|
107392
|
+
if (url2) urls[id] = url2;
|
|
107393
|
+
}
|
|
107394
|
+
return urls;
|
|
107395
|
+
},
|
|
106886
107396
|
items: () => [
|
|
106887
107397
|
...weaponDefs.map((def) => withThumbnail(weaponItem(def, arsenal.name(def.id), options.items, options.props), def.id)),
|
|
106888
107398
|
counterItem(text.counter),
|
|
@@ -106970,6 +107480,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
106970
107480
|
// the weapon against a wall asks as often as the laser, on the clock of the simulation (so a fast-forwarded room measures as often per frame)
|
|
106971
107481
|
contact: createLaserRaycast(lent.THREE, lent.scene, lent.camera, { now: () => simulatedMs }),
|
|
106972
107482
|
...lent.holdFrame ? { bodyHold: () => lent.holdFrame?.() ?? null, leftBodyHold: () => lent.holdFrame?.("L") ?? null } : {},
|
|
107483
|
+
...lent.bodySlot ? { bodySlot: (slot) => lent.bodySlot?.(slot) ?? null } : {},
|
|
106973
107484
|
firstPerson: () => lent.player().cameraMode === "first",
|
|
106974
107485
|
// the lens of the gun in first person, how far it is brought to the eye (the right button) and how the body moves (the bob and the sway follow it)
|
|
106975
107486
|
...lent.setViewmodelFov ? { viewmodelFov: (degrees) => lent.setViewmodelFov?.(degrees) } : {},
|
|
@@ -107037,7 +107548,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
107037
107548
|
created.update(dt);
|
|
107038
107549
|
holstered?.update(dt);
|
|
107039
107550
|
});
|
|
107040
|
-
const offHands = lent.setHandTargets?.(
|
|
107551
|
+
const offHands = lent.setHandTargets?.(
|
|
107552
|
+
() => holstered?.handTargets() ?? created.handTargets(),
|
|
107553
|
+
(reached) => !holstered?.handTargets() && created.seat(reached)
|
|
107554
|
+
);
|
|
107041
107555
|
const offMuzzle = lent.setMuzzleSource?.((hand) => created.muzzle(hand));
|
|
107042
107556
|
const offClear = lent.onClear?.(() => created.clearLoose());
|
|
107043
107557
|
created.handle({ type: "tool", weapon: lent.tool().weapon }, lent.tool());
|
|
@@ -107359,7 +107873,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
107359
107873
|
if (by === "shot") say(fillText2(log.jet_lit, { seconds: num2(now() - (vessel.leakAt ?? now()), 1), rest: num2(rest2, 1) }), { phase: "torch", objectId: vessel.objectId, seconds: now() - (vessel.leakAt ?? now()), rest: rest2 });
|
|
107360
107874
|
else say(fillText2(log.lighter_lit, {}), { phase: "torch", objectId: vessel.objectId, by });
|
|
107361
107875
|
};
|
|
107362
|
-
const
|
|
107876
|
+
const shove2 = (vessel) => {
|
|
107363
107877
|
const leak = vessel.leaks[vessel.leaks.length - 1];
|
|
107364
107878
|
if (!room || !leak) return;
|
|
107365
107879
|
const [dx, dy, dz] = leak.direction;
|
|
@@ -107535,7 +108049,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
107535
108049
|
continue;
|
|
107536
108050
|
}
|
|
107537
108051
|
if (vessel.leakAt !== void 0) {
|
|
107538
|
-
if (t - vessel.leakAt <= hissSeconds && leaking(vessel))
|
|
108052
|
+
if (t - vessel.leakAt <= hissSeconds && leaking(vessel)) shove2(vessel);
|
|
107539
108053
|
if (vessel.cause === "shot" && !vessel.lit && t - vessel.leakAt >= igniteDelay && leaking(vessel)) ignite(vessel, "shot");
|
|
107540
108054
|
}
|
|
107541
108055
|
if (vessel.lit) {
|
|
@@ -108131,6 +108645,51 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
108131
108645
|
return { model: holder, axis: [0, 1, 0], ...body ? { body } : {} };
|
|
108132
108646
|
}
|
|
108133
108647
|
|
|
108648
|
+
// src/body-action-models.ts
|
|
108649
|
+
var SKIN3 = 14263420;
|
|
108650
|
+
var CLOTH = 3099514;
|
|
108651
|
+
var SOLE = 8947848;
|
|
108652
|
+
var block = (THREE, group, [width, height, depth, x, y, z = 0, turn2 = 0], color2, metalness = 0) => {
|
|
108653
|
+
const mesh3 = new THREE.Mesh(new THREE.BoxGeometry(width, height, depth), new THREE.MeshStandardMaterial({ color: color2, metalness }));
|
|
108654
|
+
mesh3.position.set(x, y, z);
|
|
108655
|
+
mesh3.rotation.z = turn2;
|
|
108656
|
+
group.add(mesh3);
|
|
108657
|
+
};
|
|
108658
|
+
var forearm = (THREE, group, y) => block(THREE, group, [0.34, 0.075, 0.07, -0.17, y], CLOTH);
|
|
108659
|
+
var openHand = (THREE, group) => {
|
|
108660
|
+
forearm(THREE, group, 0);
|
|
108661
|
+
block(THREE, group, [0.1, 0.09, 0.03, 0.05, 0], SKIN3);
|
|
108662
|
+
for (const [index, y] of [-0.033, -0.011, 0.011, 0.033].entries()) block(THREE, group, [0.085 - (index === 0 || index === 3 ? 0.012 : 0), 0.019, 0.025, 0.145, y + (index - 1.5) * 4e-3, 0, (index - 1.5) * 0.09], SKIN3);
|
|
108663
|
+
block(THREE, group, [0.06, 0.022, 0.025, 0.07, 0.07, 0, 0.7], SKIN3);
|
|
108664
|
+
};
|
|
108665
|
+
var fists = (THREE, group) => {
|
|
108666
|
+
for (const y of [-0.075, 0.075]) {
|
|
108667
|
+
forearm(THREE, group, y);
|
|
108668
|
+
block(THREE, group, [0.095, 0.085, 0.08, 0.05, y], SKIN3);
|
|
108669
|
+
for (const step of [-1.5, -0.5, 0.5, 1.5]) block(THREE, group, [0.025, 0.018, 0.02, 0.105, y + step * 0.02], SKIN3);
|
|
108670
|
+
}
|
|
108671
|
+
};
|
|
108672
|
+
var shove = (THREE, group) => {
|
|
108673
|
+
forearm(THREE, group, 0);
|
|
108674
|
+
block(THREE, group, [0.035, 0.16, 0.11, 0.05, 0.04], SKIN3);
|
|
108675
|
+
block(THREE, group, [0.05, 0.03, 0.03, 0.02, -0.06, 0, 0.5], SKIN3);
|
|
108676
|
+
};
|
|
108677
|
+
var kick = (THREE, group) => {
|
|
108678
|
+
block(THREE, group, [0.5, 0.11, 0.11, -0.25, 0], CLOTH);
|
|
108679
|
+
block(THREE, group, [0.07, 0.3, 0.12, 0.035, 0.04], CLOTH);
|
|
108680
|
+
block(THREE, group, [0.03, 0.3, 0.125, 0.085, 0.04], SOLE, 0.8);
|
|
108681
|
+
block(THREE, group, [0.07, 0.07, 0.12, 0.05, 0.2, 0, 0.3], CLOTH);
|
|
108682
|
+
};
|
|
108683
|
+
var BUILDERS5 = { hand: openHand, fists, shove, kick };
|
|
108684
|
+
function buildBodyActionModel(THREE, id) {
|
|
108685
|
+
const draw2 = BUILDERS5[id];
|
|
108686
|
+
if (!draw2) return void 0;
|
|
108687
|
+
const group = new THREE.Group();
|
|
108688
|
+
group.name = id;
|
|
108689
|
+
draw2(THREE, group);
|
|
108690
|
+
return group;
|
|
108691
|
+
}
|
|
108692
|
+
|
|
108134
108693
|
// src/weapon-props.ts
|
|
108135
108694
|
function createWeaponProps(options = {}) {
|
|
108136
108695
|
const entryOf = ([id, model]) => ({ id, model: model ?? { item: "" } });
|