@adatechnology/game-weapons-three 0.29.9 → 0.29.10
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/dist/index.global.js
CHANGED
|
@@ -22231,6 +22231,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22231
22231
|
else along3++;
|
|
22232
22232
|
}
|
|
22233
22233
|
};
|
|
22234
|
+
function put(out, at4, value) {
|
|
22235
|
+
if (at4 < out.length) out[at4] = value;
|
|
22236
|
+
else out.push(value);
|
|
22237
|
+
}
|
|
22238
|
+
function sortFirst(out, count) {
|
|
22239
|
+
for (let i = 1; i < count; i++) {
|
|
22240
|
+
const value = out[i];
|
|
22241
|
+
let j = i - 1;
|
|
22242
|
+
while (j >= 0 && out[j] > value) {
|
|
22243
|
+
out[j + 1] = out[j];
|
|
22244
|
+
j--;
|
|
22245
|
+
}
|
|
22246
|
+
out[j + 1] = value;
|
|
22247
|
+
}
|
|
22248
|
+
}
|
|
22234
22249
|
var PART_GRID_MIN_PARTS = 64;
|
|
22235
22250
|
var MAX_CELLS_PER_AXIS = 64;
|
|
22236
22251
|
var PAD = 1e-4;
|
|
@@ -22247,8 +22262,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22247
22262
|
if (![...min2, ...max2].every(Number.isFinite)) {
|
|
22248
22263
|
return {
|
|
22249
22264
|
candidates(_origin, _direction, _maxDistance, out) {
|
|
22250
|
-
|
|
22251
|
-
|
|
22265
|
+
for (let index = 0; index < parts2.length; index++) put(out, index, index);
|
|
22266
|
+
return parts2.length;
|
|
22252
22267
|
}
|
|
22253
22268
|
};
|
|
22254
22269
|
}
|
|
@@ -22288,20 +22303,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22288
22303
|
let stamp = 0;
|
|
22289
22304
|
return {
|
|
22290
22305
|
candidates(origin, direction, maxDistance, out) {
|
|
22291
|
-
|
|
22306
|
+
let count = 0;
|
|
22292
22307
|
let t0 = 0;
|
|
22293
22308
|
let t1 = maxDistance;
|
|
22294
22309
|
for (let k = 0; k < 3; k++) {
|
|
22295
22310
|
const d = direction[k];
|
|
22296
22311
|
if (Math.abs(d) < 1e-12) {
|
|
22297
|
-
if (origin[k] < min2[k] || origin[k] > max2[k]) return;
|
|
22312
|
+
if (origin[k] < min2[k] || origin[k] > max2[k]) return 0;
|
|
22298
22313
|
continue;
|
|
22299
22314
|
}
|
|
22300
22315
|
const a = (min2[k] - origin[k]) / d;
|
|
22301
22316
|
const b = (max2[k] - origin[k]) / d;
|
|
22302
22317
|
t0 = Math.max(t0, Math.min(a, b));
|
|
22303
22318
|
t1 = Math.min(t1, Math.max(a, b));
|
|
22304
|
-
if (t0 > t1) return;
|
|
22319
|
+
if (t0 > t1) return 0;
|
|
22305
22320
|
}
|
|
22306
22321
|
stamp++;
|
|
22307
22322
|
if (stamp === 4294967295) {
|
|
@@ -22321,7 +22336,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22321
22336
|
const index = items[k];
|
|
22322
22337
|
if (seen[index] === stamp) continue;
|
|
22323
22338
|
seen[index] = stamp;
|
|
22324
|
-
out
|
|
22339
|
+
put(out, count++, index);
|
|
22325
22340
|
}
|
|
22326
22341
|
if (nx <= ny && nx <= nz) {
|
|
22327
22342
|
if (nx > t1) break;
|
|
@@ -22340,7 +22355,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22340
22355
|
nz += ez;
|
|
22341
22356
|
}
|
|
22342
22357
|
}
|
|
22343
|
-
|
|
22358
|
+
sortFirst(out, count);
|
|
22359
|
+
return count;
|
|
22344
22360
|
}
|
|
22345
22361
|
};
|
|
22346
22362
|
}
|
|
@@ -26372,6 +26388,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26372
26388
|
objectsRevision++;
|
|
26373
26389
|
}
|
|
26374
26390
|
};
|
|
26391
|
+
const movedObjects = [];
|
|
26392
|
+
const markMoved = (o) => {
|
|
26393
|
+
if (o.rayMoved) return;
|
|
26394
|
+
o.rayMoved = true;
|
|
26395
|
+
movedObjects.push(o);
|
|
26396
|
+
};
|
|
26375
26397
|
const listeners = /* @__PURE__ */ new Map();
|
|
26376
26398
|
let cur = [];
|
|
26377
26399
|
const blasts = [];
|
|
@@ -26547,6 +26569,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26547
26569
|
unsup: [],
|
|
26548
26570
|
anyAnchor: false,
|
|
26549
26571
|
order: ++orderCounter,
|
|
26572
|
+
rayStamp: 0,
|
|
26573
|
+
raySlot: 0,
|
|
26574
|
+
rayMoved: false,
|
|
26550
26575
|
loose: carry?.loose ?? false,
|
|
26551
26576
|
cast: /* @__PURE__ */ new Map(),
|
|
26552
26577
|
base: { pos: [pos[0], pos[1], pos[2]], rot: [rot[0], rot[1], rot[2], rot[3]] }
|
|
@@ -27381,6 +27406,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27381
27406
|
applySoilPose(o);
|
|
27382
27407
|
};
|
|
27383
27408
|
const applySoilPose = (o) => {
|
|
27409
|
+
markMoved(o);
|
|
27384
27410
|
const so = o.soil;
|
|
27385
27411
|
if (!so) {
|
|
27386
27412
|
o.st.position = [o.base.pos[0], o.base.pos[1], o.base.pos[2]];
|
|
@@ -28299,11 +28325,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28299
28325
|
return grid;
|
|
28300
28326
|
};
|
|
28301
28327
|
const partsAlong = (o, lo, ld, maxDist) => {
|
|
28302
|
-
if (o.parts.length < PART_GRID_MIN_PARTS || !lo.
|
|
28303
|
-
partGridOf(o).candidates(lo, ld, maxDist, gridCandidates);
|
|
28304
|
-
|
|
28305
|
-
|
|
28306
|
-
|
|
28328
|
+
if (o.parts.length < PART_GRID_MIN_PARTS || !(Number.isFinite(lo[0]) && Number.isFinite(lo[1]) && Number.isFinite(lo[2]) && Number.isFinite(ld[0]) && Number.isFinite(ld[1]) && Number.isFinite(ld[2]))) return -1;
|
|
28329
|
+
const count = partGridOf(o).candidates(lo, ld, maxDist, gridCandidates);
|
|
28330
|
+
for (let i = 0; i < count; i++) {
|
|
28331
|
+
const p = o.parts[gridCandidates[i]];
|
|
28332
|
+
if (i < gridParts.length) gridParts[i] = p;
|
|
28333
|
+
else gridParts.push(p);
|
|
28334
|
+
}
|
|
28335
|
+
return count;
|
|
28307
28336
|
};
|
|
28308
28337
|
const splitInto = (o, cuts) => {
|
|
28309
28338
|
const carryFor = (keep2, keepOpen = () => false) => ({
|
|
@@ -28360,6 +28389,140 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28360
28389
|
return implList;
|
|
28361
28390
|
};
|
|
28362
28391
|
const NO_IMPLS = [];
|
|
28392
|
+
const RAY_CELL = 2;
|
|
28393
|
+
const RAY_GRID_BIG = 4;
|
|
28394
|
+
const RAY_GRID_HALF = 512;
|
|
28395
|
+
const RAY_GRID_MAX_CELLS = 64;
|
|
28396
|
+
const gridCells = /* @__PURE__ */ new Map();
|
|
28397
|
+
const gridCentre = [0, 0, 0];
|
|
28398
|
+
const gridSpans = /* @__PURE__ */ new WeakMap();
|
|
28399
|
+
const bigObjects = [];
|
|
28400
|
+
let gridFor = -1;
|
|
28401
|
+
let gridQuery = 0;
|
|
28402
|
+
const gridHits = [];
|
|
28403
|
+
const cellOf = (v) => Math.floor(v / RAY_CELL) | 0;
|
|
28404
|
+
const inGrid = (c) => c >= -RAY_GRID_HALF && c < RAY_GRID_HALF;
|
|
28405
|
+
const cellKey3 = (ix, iy, iz) => ix + RAY_GRID_HALF + (iy + RAY_GRID_HALF) * 1024 + (iz + RAY_GRID_HALF) * 1048576 | 0;
|
|
28406
|
+
const cellAt = (key2) => {
|
|
28407
|
+
let cell = gridCells.get(key2);
|
|
28408
|
+
if (!cell) {
|
|
28409
|
+
cell = [];
|
|
28410
|
+
gridCells.set(key2, cell);
|
|
28411
|
+
}
|
|
28412
|
+
return cell;
|
|
28413
|
+
};
|
|
28414
|
+
const dropFrom = (list2, o) => {
|
|
28415
|
+
const at4 = list2.indexOf(o);
|
|
28416
|
+
if (at4 < 0) return;
|
|
28417
|
+
list2[at4] = list2[list2.length - 1];
|
|
28418
|
+
list2.length--;
|
|
28419
|
+
};
|
|
28420
|
+
const unplace = (o, span) => {
|
|
28421
|
+
if (!span.placed) return;
|
|
28422
|
+
span.placed = false;
|
|
28423
|
+
if (span.big) {
|
|
28424
|
+
dropFrom(bigObjects, o);
|
|
28425
|
+
return;
|
|
28426
|
+
}
|
|
28427
|
+
for (let iz = span.z0; iz <= span.z1; iz++) for (let iy = span.y0; iy <= span.y1; iy++) for (let ix = span.x0; ix <= span.x1; ix++) dropFrom(cellAt(cellKey3(ix, iy, iz)), o);
|
|
28428
|
+
};
|
|
28429
|
+
const place = (o) => {
|
|
28430
|
+
o.raySlot = slots.get(o.id) ?? 0;
|
|
28431
|
+
let span = gridSpans.get(o);
|
|
28432
|
+
const c = rotateVecInto(o.st.rotation, o.bc, gridCentre);
|
|
28433
|
+
c[0] += o.st.position[0];
|
|
28434
|
+
c[1] += o.st.position[1];
|
|
28435
|
+
c[2] += o.st.position[2];
|
|
28436
|
+
const r = o.br;
|
|
28437
|
+
const x0 = cellOf(c[0] - r), y0 = cellOf(c[1] - r), z0 = cellOf(c[2] - r);
|
|
28438
|
+
const x1 = cellOf(c[0] + r), y1 = cellOf(c[1] + r), z1 = cellOf(c[2] + r);
|
|
28439
|
+
const big = !(x1 - x0 < RAY_GRID_BIG && y1 - y0 < RAY_GRID_BIG && z1 - z0 < RAY_GRID_BIG) || !(inGrid(x0) && inGrid(y0) && inGrid(z0) && inGrid(x1) && inGrid(y1) && inGrid(z1));
|
|
28440
|
+
if (span?.placed && span.big === big && (big || span.x0 === x0 && span.y0 === y0 && span.z0 === z0 && span.x1 === x1 && span.y1 === y1 && span.z1 === z1)) return;
|
|
28441
|
+
if (span) unplace(o, span);
|
|
28442
|
+
else {
|
|
28443
|
+
span = { x0, y0, z0, x1, y1, z1, big, placed: false };
|
|
28444
|
+
gridSpans.set(o, span);
|
|
28445
|
+
}
|
|
28446
|
+
span.x0 = x0;
|
|
28447
|
+
span.y0 = y0;
|
|
28448
|
+
span.z0 = z0;
|
|
28449
|
+
span.x1 = x1;
|
|
28450
|
+
span.y1 = y1;
|
|
28451
|
+
span.z1 = z1;
|
|
28452
|
+
span.big = big;
|
|
28453
|
+
span.placed = true;
|
|
28454
|
+
if (big) {
|
|
28455
|
+
bigObjects.push(o);
|
|
28456
|
+
return;
|
|
28457
|
+
}
|
|
28458
|
+
for (let iz = z0; iz <= z1; iz++) for (let iy = y0; iy <= y1; iy++) for (let ix = x0; ix <= x1; ix++) cellAt(cellKey3(ix, iy, iz)).push(o);
|
|
28459
|
+
};
|
|
28460
|
+
const refreshGrid = () => {
|
|
28461
|
+
if (gridFor !== objectsRevision) {
|
|
28462
|
+
for (const cell of gridCells.values()) cell.length = 0;
|
|
28463
|
+
bigObjects.length = 0;
|
|
28464
|
+
const all = objectsInOrder();
|
|
28465
|
+
for (let i = 0; i < all.length; i++) {
|
|
28466
|
+
const span = gridSpans.get(all[i]);
|
|
28467
|
+
if (span) span.placed = false;
|
|
28468
|
+
place(all[i]);
|
|
28469
|
+
}
|
|
28470
|
+
for (let i = 0; i < movedObjects.length; i++) movedObjects[i].rayMoved = false;
|
|
28471
|
+
movedObjects.length = 0;
|
|
28472
|
+
gridFor = objectsRevision;
|
|
28473
|
+
return;
|
|
28474
|
+
}
|
|
28475
|
+
for (let i = 0; i < movedObjects.length; i++) {
|
|
28476
|
+
const o = movedObjects[i];
|
|
28477
|
+
o.rayMoved = false;
|
|
28478
|
+
if (objects.get(o.id) === o) place(o);
|
|
28479
|
+
}
|
|
28480
|
+
movedObjects.length = 0;
|
|
28481
|
+
};
|
|
28482
|
+
const sortBySlot = (list2, count) => {
|
|
28483
|
+
for (let i = 1; i < count; i++) {
|
|
28484
|
+
const o = list2[i];
|
|
28485
|
+
let j = i - 1;
|
|
28486
|
+
while (j >= 0 && list2[j].raySlot > o.raySlot) {
|
|
28487
|
+
list2[j + 1] = list2[j];
|
|
28488
|
+
j--;
|
|
28489
|
+
}
|
|
28490
|
+
list2[j + 1] = o;
|
|
28491
|
+
}
|
|
28492
|
+
};
|
|
28493
|
+
const objectsNear = (origin, d, maxDist) => {
|
|
28494
|
+
if (!(maxDist < Infinity)) return -1;
|
|
28495
|
+
const ex = origin[0] + d[0] * maxDist, ey = origin[1] + d[1] * maxDist, ez = origin[2] + d[2] * maxDist;
|
|
28496
|
+
const x0 = cellOf(Math.min(origin[0], ex)), y0 = cellOf(Math.min(origin[1], ey)), z0 = cellOf(Math.min(origin[2], ez));
|
|
28497
|
+
const x1 = cellOf(Math.max(origin[0], ex)), y1 = cellOf(Math.max(origin[1], ey)), z1 = cellOf(Math.max(origin[2], ez));
|
|
28498
|
+
if (!(inGrid(x0) && inGrid(y0) && inGrid(z0) && inGrid(x1) && inGrid(y1) && inGrid(z1))) return -1;
|
|
28499
|
+
if ((x1 - x0 + 1) * (y1 - y0 + 1) * (z1 - z0 + 1) > RAY_GRID_MAX_CELLS) return -1;
|
|
28500
|
+
refreshGrid();
|
|
28501
|
+
const stamp = ++gridQuery;
|
|
28502
|
+
let count = 0;
|
|
28503
|
+
for (let i = 0; i < bigObjects.length; i++) {
|
|
28504
|
+
bigObjects[i].rayStamp = stamp;
|
|
28505
|
+
if (count < gridHits.length) gridHits[count] = bigObjects[i];
|
|
28506
|
+
else gridHits.push(bigObjects[i]);
|
|
28507
|
+
count++;
|
|
28508
|
+
}
|
|
28509
|
+
for (let iz = z0; iz <= z1; iz++)
|
|
28510
|
+
for (let iy = y0; iy <= y1; iy++)
|
|
28511
|
+
for (let ix = x0; ix <= x1; ix++) {
|
|
28512
|
+
const cell = gridCells.get(cellKey3(ix, iy, iz));
|
|
28513
|
+
if (!cell) continue;
|
|
28514
|
+
for (let i = 0; i < cell.length; i++) {
|
|
28515
|
+
const o = cell[i];
|
|
28516
|
+
if (o.rayStamp === stamp) continue;
|
|
28517
|
+
o.rayStamp = stamp;
|
|
28518
|
+
if (count < gridHits.length) gridHits[count] = o;
|
|
28519
|
+
else gridHits.push(o);
|
|
28520
|
+
count++;
|
|
28521
|
+
}
|
|
28522
|
+
}
|
|
28523
|
+
sortBySlot(gridHits, count);
|
|
28524
|
+
return count;
|
|
28525
|
+
};
|
|
28363
28526
|
const NO_SKIP = {};
|
|
28364
28527
|
const rayDirections = [];
|
|
28365
28528
|
let rayDepth = 0;
|
|
@@ -28416,8 +28579,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28416
28579
|
const minRadius = skip.minObjectRadius ?? 0;
|
|
28417
28580
|
let best = null;
|
|
28418
28581
|
const counts = sweepCounts;
|
|
28419
|
-
const
|
|
28420
|
-
|
|
28582
|
+
const near = scope2 || candidates ? -1 : objectsNear(origin, d, maxDist);
|
|
28583
|
+
const visited = scope2 ? scope2.objects : candidates ?? (near >= 0 ? gridHits : objectsInOrder());
|
|
28584
|
+
const visitedCount = near >= 0 ? near : visited.length;
|
|
28585
|
+
for (let oi = 0; oi < visitedCount; oi++) {
|
|
28421
28586
|
const o = visited[oi];
|
|
28422
28587
|
if (counts) counts.objectVisits++;
|
|
28423
28588
|
if (skip.skipLoose && o.loose || o.br < minRadius) continue;
|
|
@@ -28433,8 +28598,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28433
28598
|
objectOrigin[2] = origin[2] - o.st.position[2];
|
|
28434
28599
|
const lo = rotateVecInto(objectTurnBack, objectOrigin, objectOrigin);
|
|
28435
28600
|
const ld = rotateVecInto(objectTurnBack, d, objectDirection);
|
|
28436
|
-
const
|
|
28437
|
-
|
|
28601
|
+
const scoped = scope2?.parts.get(o);
|
|
28602
|
+
const gathered = scoped || counts ? -1 : partsAlong(o, lo, ld, maxDist);
|
|
28603
|
+
const along3 = scoped ?? (gathered >= 0 ? gridParts : o.parts);
|
|
28604
|
+
const alongCount = gathered >= 0 ? gathered : along3.length;
|
|
28605
|
+
for (let pi = 0; pi < alongCount; pi++) {
|
|
28438
28606
|
const p = along3[pi];
|
|
28439
28607
|
if (counts) counts.partVisits++;
|
|
28440
28608
|
if (isLost(p) || ignore?.has(`${o.id}\0${p.spec.id}`)) continue;
|
|
@@ -28444,7 +28612,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28444
28612
|
counts.shapeTested.add(o.id);
|
|
28445
28613
|
}
|
|
28446
28614
|
const r = rayPartInto(o.st.position, o.st.rotation, p.spec, p.q, origin, d, p.pos);
|
|
28447
|
-
if (r && r.t0 < 0 && r.t1 > 0 && p.st.chipped?.length && inGap(p, toLocal(p.pos, p.q, objLocal(o, origin)))) {
|
|
28615
|
+
if ((passed || skip.body) && r && r.t0 < 0 && r.t1 > 0 && p.st.chipped?.length && inGap(p, toLocal(p.pos, p.q, objLocal(o, origin)))) {
|
|
28448
28616
|
r.t0 = 0;
|
|
28449
28617
|
r.n = vec.scale(d, -1);
|
|
28450
28618
|
}
|
|
@@ -31531,6 +31699,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31531
31699
|
poseVersion++;
|
|
31532
31700
|
objectPoses.set(o, (objectPoses.get(o) ?? 0) + 1);
|
|
31533
31701
|
updateBound(o);
|
|
31702
|
+
markMoved(o);
|
|
31534
31703
|
if (o.hosted && (o.hostedHosts?.has(partId) || p.spec.hostedIn !== void 0 && p.st.exposed !== true)) dirtyHosted.add(o);
|
|
31535
31704
|
},
|
|
31536
31705
|
remove(id) {
|
|
@@ -33990,15 +34159,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
33990
34159
|
const pier = (clear - win) / 2;
|
|
33991
34160
|
const at23 = (u) => along3 === 0 ? [u, 0, fixed2] : [fixed2, 0, u];
|
|
33992
34161
|
const size = (u, h) => along3 === 0 ? [u, h, c.thickness] : [c.thickness, h, u];
|
|
33993
|
-
const
|
|
34162
|
+
const put2 = (name, u, h, y, centreU, on) => {
|
|
33994
34163
|
const p = at23(centreU);
|
|
33995
34164
|
wall(`infill_${f}_${side}_${k}_${name}`, size(u, h), [p[0], y, p[2]], on);
|
|
33996
34165
|
};
|
|
33997
34166
|
const id = (name) => `infill_${f}_${side}_${k}_${name}`;
|
|
33998
|
-
|
|
33999
|
-
|
|
34000
|
-
|
|
34001
|
-
|
|
34167
|
+
put2("sill", clear, sill, yb + sill / 2, centre2, [c1, c2]);
|
|
34168
|
+
put2("pl", pier, head - sill, yb + sill + (head - sill) / 2, centre2 - clear / 2 + pier / 2, [c1, id("sill")]);
|
|
34169
|
+
put2("pr", pier, head - sill, yb + sill + (head - sill) / 2, centre2 + clear / 2 - pier / 2, [c2, id("sill")]);
|
|
34170
|
+
put2("head", clear, room - head, yb + head + (room - head) / 2, centre2, [c1, c2]);
|
|
34002
34171
|
const gp = at23(centre2);
|
|
34003
34172
|
const gid = `glass_${f}_${side}_${k}`;
|
|
34004
34173
|
parts2.push({
|
|
@@ -34088,24 +34257,24 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
34088
34257
|
const floor2 = `slab_${level - 1}`;
|
|
34089
34258
|
const y = storeyBase(g, level);
|
|
34090
34259
|
const shafts = options.shafts ?? [];
|
|
34091
|
-
const
|
|
34260
|
+
const put2 = (id, material, size, at23, mass, extra = {}) => {
|
|
34092
34261
|
parts2.push({ id: id + sfx, material, shape: box2(size), position: [at23[0], y + size[1] / 2, at23[1]], mass, fill: 0.2, structure: { role: "partition" }, tags: ["mechanical"], ...extra });
|
|
34093
34262
|
rests(joints, id + sfx, floor2, "bolt");
|
|
34094
34263
|
};
|
|
34095
|
-
shafts.forEach((at23, k) =>
|
|
34264
|
+
shafts.forEach((at23, k) => put2(`machine_${k}`, "steel", [1.2, 1, 0.8], at23, c.machineMass + c.suspendedMass, { tags: ["mechanical", "elevator_machine"] }));
|
|
34096
34265
|
const liters = options.waterLiters ?? towerWater(level, options);
|
|
34097
34266
|
const depth = 2;
|
|
34098
34267
|
const side = Math.sqrt(liters / 1e3 / depth);
|
|
34099
34268
|
const [hx] = slabHalf(g);
|
|
34100
34269
|
const tankAt = options.tankAt ?? [-hx / 2, 0];
|
|
34101
34270
|
const shell = 4 * side * depth + 2 * side * side;
|
|
34102
|
-
|
|
34271
|
+
put2("water_tank", c.tankMaterial, [side, depth, side], tankAt, liters + 1100 * c.tankWall * shell, {
|
|
34103
34272
|
fill: shell * c.tankWall / (side * side * depth),
|
|
34104
34273
|
thickness: c.tankWall,
|
|
34105
34274
|
contains: { fluid: "water", liters },
|
|
34106
34275
|
tags: ["mechanical", "water_tank"]
|
|
34107
34276
|
});
|
|
34108
|
-
for (let k = 0; k < c.chillers; k++)
|
|
34277
|
+
for (let k = 0; k < c.chillers; k++) put2(`chiller_${k}`, "steel", [3, 2, 1.5], [-hx + 2 + k * 3.5, -(slabHalf(g)[1] - 2)], c.chillerMass, { tags: ["mechanical", "chiller"] });
|
|
34109
34278
|
return { ...spec, parts: parts2, joints };
|
|
34110
34279
|
}
|
|
34111
34280
|
var DAMPER_DEFAULTS = { ratio: 0.01, modalShare: 0.25, material: "steel", maxHeight: 2.5 };
|
|
@@ -58103,7 +58272,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58103
58272
|
try {
|
|
58104
58273
|
for (const { b, shut } of pieces) {
|
|
58105
58274
|
shutFaces = shut;
|
|
58106
|
-
|
|
58275
|
+
put2(mat, "box", (b[0] + b[3]) / 2, (b[1] + b[4]) / 2, (b[2] + b[5]) / 2, _qi, b[3] - b[0], b[4] - b[1], b[5] - b[2], color2);
|
|
58107
58276
|
}
|
|
58108
58277
|
} finally {
|
|
58109
58278
|
shared3.ctx.keepOut = taken.length ? taken : void 0;
|
|
@@ -58112,7 +58281,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58112
58281
|
}
|
|
58113
58282
|
return true;
|
|
58114
58283
|
}
|
|
58115
|
-
function
|
|
58284
|
+
function put2(mat, geo, px, py, pz, q, sx, sy, sz, color2, uvr) {
|
|
58116
58285
|
if ((shared3.ctx.keepOut || shared3.ctx.itemBoxes) && geo === "box" && !uvr && keptOut(mat, px, py, pz, q, sx, sy, sz, color2)) return;
|
|
58117
58286
|
if (shared3.ctx.blockBoxes && geo === "box" && mat !== "emissive" && mat !== "glass" && Math.abs(q.x) + Math.abs(q.y) + Math.abs(q.z) < 1e-9) shared3.ctx.blockBoxes.push([px - sx / 2, py - sy / 2, pz - sz / 2, px + sx / 2, py + sy / 2, pz + sz / 2]);
|
|
58118
58287
|
{
|
|
@@ -58206,16 +58375,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58206
58375
|
function boxC(mat, cx, cy, cz, sx, sy, sz, color2, rx = 0, ry = 0, rz = 0, uvr) {
|
|
58207
58376
|
if (rx || ry || rz) _q.setFromEuler(_e.set(rx, ry, rz, "YXZ"));
|
|
58208
58377
|
else _q.identity();
|
|
58209
|
-
|
|
58378
|
+
put2(mat, "box", cx, cy, cz, _q, sx, sy, sz, color2, uvr);
|
|
58210
58379
|
}
|
|
58211
58380
|
function bxBase(mat, x0, y0, z0, x1, y1, z1, color2) {
|
|
58212
58381
|
if (x1 - x0 < 1e-4 || y1 - y0 < 1e-4 || z1 - z0 < 1e-4) return;
|
|
58213
58382
|
_q.identity();
|
|
58214
|
-
|
|
58383
|
+
put2(mat, "box", (x0 + x1) / 2, (y0 + y1) / 2, (z0 + z1) / 2, _q, x1 - x0, y1 - y0, z1 - z0, color2);
|
|
58215
58384
|
}
|
|
58216
58385
|
function cylBase(mat, x, y, z, r, h, color2, seg2 = "cyl") {
|
|
58217
58386
|
_q.identity();
|
|
58218
|
-
|
|
58387
|
+
put2(mat, seg2, x, y + h / 2, z, _q, r * 2, h, r * 2, color2);
|
|
58219
58388
|
}
|
|
58220
58389
|
function polyFace(mat, pts, color2, hint) {
|
|
58221
58390
|
const A = accFor(mat), n = pts.length, O = cursor.org, RY = cursor.ry;
|
|
@@ -58279,7 +58448,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58279
58448
|
const setBx = (f) => {
|
|
58280
58449
|
bxImpl = f;
|
|
58281
58450
|
};
|
|
58282
|
-
const defined = { GEO, UV_SCALE, WITH_MAP, Accumulator, cursor, PARTS, MIRRORS, part, applyPart, _Y, _qa, _qb, pieceRecord, structurePiece, accFor, _q, _e, _col, rgbOf, put, boxC, bx, getBx, setBx, cylBase, polyFace };
|
|
58451
|
+
const defined = { GEO, UV_SCALE, WITH_MAP, Accumulator, cursor, PARTS, MIRRORS, part, applyPart, _Y, _qa, _qb, pieceRecord, structurePiece, accFor, _q, _e, _col, rgbOf, put: put2, boxC, bx, getBx, setBx, cylBase, polyFace };
|
|
58283
58452
|
Object.assign(K, defined);
|
|
58284
58453
|
}
|
|
58285
58454
|
function installKernelNoise(K, _shared) {
|
|
@@ -60374,7 +60543,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60374
60543
|
Object.assign(K, defined);
|
|
60375
60544
|
}
|
|
60376
60545
|
function installRoofTiles(K, shared3) {
|
|
60377
|
-
const { UV_SCALE, _Y, _h2, _q, accFor, cursor, put, rgbOf, structurePiece } = K;
|
|
60546
|
+
const { UV_SCALE, _Y, _h2, _q, accFor, cursor, put: put2, rgbOf, structurePiece } = K;
|
|
60378
60547
|
const sh = (...a) => K.sh(...a);
|
|
60379
60548
|
const R_STYLE = () => shared3.ctx.r && shared3.ctx.r.style || "budget";
|
|
60380
60549
|
function tileRelief(mat, pts, color2, type, origin) {
|
|
@@ -60512,10 +60681,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60512
60681
|
const colonial = type !== "fiber_cement", r = colonial ? 0.085 : 0.075, c = sh(roofColor, colonial ? 0.82 : 0.9), lift = colonial ? 0.05 : 0.035;
|
|
60513
60682
|
_q.setFromUnitVectors(_Y, K._v3.set(dx / Ln, dy / Ln, dz / Ln));
|
|
60514
60683
|
const mx = (a[0] + b[0]) / 2, my = (a[1] + b[1]) / 2 + lift, mz = (a[2] + b[2]) / 2;
|
|
60515
|
-
|
|
60684
|
+
put2("plain", colonial ? "cyl" : "cyl6", mx, my, mz, _q, r * 2, Ln, r * 2, c);
|
|
60516
60685
|
if (colonial) for (let t = 0.25; t < Ln - 0.1; t += 0.42) {
|
|
60517
60686
|
const f = t / Ln;
|
|
60518
|
-
|
|
60687
|
+
put2("plain", "cyl", a[0] + dx * f, a[1] + dy * f + lift, a[2] + dz * f, _q, r * 2.25, 0.035, r * 2.25, sh(c, 0.7));
|
|
60519
60688
|
}
|
|
60520
60689
|
}
|
|
60521
60690
|
function pieceOfPane(x, z) {
|
|
@@ -61994,7 +62163,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61994
62163
|
var UNDER_SINK_VALVE_RISE = 0.1;
|
|
61995
62164
|
var pipeMass = (diameter, length2) => DENSITY.plastic * Math.PI * (diameter / 2) ** 2 * length2 * PIPE_WALL_FILL;
|
|
61996
62165
|
function installUtilitiesWater(K, shared3) {
|
|
61997
|
-
const { THREE, _Y, _q, cursor, cylBase, part, pieceRecord, put } = K;
|
|
62166
|
+
const { THREE, _Y, _q, cursor, cylBase, part, pieceRecord, put: put2 } = K;
|
|
61998
62167
|
function createWater(r, state) {
|
|
61999
62168
|
const H = r.utilities?.plumbing, cap = H ? +H.capacityL || 0 : 0, ls = { dry: [], full: [] }, points = {}, itemPoint = {};
|
|
62000
62169
|
if (H) for (const p of H.points) {
|
|
@@ -62081,7 +62250,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62081
62250
|
const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2], L = Math.hypot(dx, dy, dz);
|
|
62082
62251
|
if (L < 1e-3) return;
|
|
62083
62252
|
_q.setFromUnitVectors(_Y, _v3.set(dx / L, dy / L, dz / L));
|
|
62084
|
-
|
|
62253
|
+
put2("plain", "cyl", (a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2, _q, diameter, L, diameter, color2);
|
|
62085
62254
|
}
|
|
62086
62255
|
const _v3 = new THREE.Vector3();
|
|
62087
62256
|
function layWallRun({ id, routes, diameter, group, meta }) {
|
|
@@ -62346,7 +62515,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62346
62515
|
var END_RENDER = 0.02;
|
|
62347
62516
|
var SLIVER_CLEAR = 5e-4;
|
|
62348
62517
|
var MORTAR_LIFT = 9e-3;
|
|
62349
|
-
function layUnits(rect, coursing,
|
|
62518
|
+
function layUnits(rect, coursing, put2) {
|
|
62350
62519
|
const { courseH, unitLen, joint: joint2, courseBase } = coursing;
|
|
62351
62520
|
const first = Math.floor((rect.y0 - courseBase) / courseH + 1e-6);
|
|
62352
62521
|
for (let row = first; courseBase + row * courseH < rect.y1 - 1e-6; row++) {
|
|
@@ -62366,7 +62535,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62366
62535
|
units[units.length - 1][1] = rect.a1;
|
|
62367
62536
|
if (units.length > 1 && units[0][1] - units[0][0] < MIN_PIECE2) units.splice(0, 2, [rect.a0, units[1][1]]);
|
|
62368
62537
|
if (units.length > 1 && units[units.length - 1][1] - units[units.length - 1][0] < MIN_PIECE2) units.splice(units.length - 2, 2, [units[units.length - 2][0], rect.a1]);
|
|
62369
|
-
for (const [b0, b1] of units)
|
|
62538
|
+
for (const [b0, b1] of units) put2(b0, ya, b1, yb);
|
|
62370
62539
|
}
|
|
62371
62540
|
}
|
|
62372
62541
|
function coreWidthOf(thickness, unitId) {
|
|
@@ -62943,7 +63112,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62943
63112
|
var FLOOR_SLAB_UNDERSIDE = 0.24;
|
|
62944
63113
|
var BOX_COLOR = 15381256;
|
|
62945
63114
|
function installUtilitiesElectrical(K, shared3) {
|
|
62946
|
-
const { _Y, _q, _v3, bx, cursor, cylBase, part, pieceRecord, put } = K;
|
|
63115
|
+
const { _Y, _q, _v3, bx, cursor, cylBase, part, pieceRecord, put: put2 } = K;
|
|
62947
63116
|
const sh = (...a) => K.sh(...a);
|
|
62948
63117
|
function electricalStructure() {
|
|
62949
63118
|
const R = shared3.ctx.r, E = R.utilities?.electrical;
|
|
@@ -62955,7 +63124,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62955
63124
|
const L = Math.hypot(b[0] - a[0], b[1] - a[1], b[2] - a[2]);
|
|
62956
63125
|
if (L < 1e-3) return;
|
|
62957
63126
|
_q.setFromUnitVectors(_Y, _v3.set((b[0] - a[0]) / L, (b[1] - a[1]) / L, (b[2] - a[2]) / L));
|
|
62958
|
-
|
|
63127
|
+
put2("plain", "cyl", (a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2, _q, r_ * 2, L, r_ * 2, wireRun);
|
|
62959
63128
|
};
|
|
62960
63129
|
const pole = (u, v, h) => {
|
|
62961
63130
|
const buried = postEmbedment(h), below = shared3.ctx.visorScene ? 0 : buried;
|
|
@@ -63217,7 +63386,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63217
63386
|
const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2], L = Math.hypot(dx, dy, dz);
|
|
63218
63387
|
if (L < 1e-3) return;
|
|
63219
63388
|
_q.setFromUnitVectors(_Y, _v3.set(dx / L, dy / L, dz / L));
|
|
63220
|
-
|
|
63389
|
+
put2("plain", "cyl", (a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2, _q, diameter, L, diameter, color2);
|
|
63221
63390
|
}
|
|
63222
63391
|
const defined = { electricalStructure, pipe2 };
|
|
63223
63392
|
Object.assign(K, defined);
|
|
@@ -63470,7 +63639,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63470
63639
|
Object.assign(K, defined);
|
|
63471
63640
|
}
|
|
63472
63641
|
function installFurnitureApi(K, shared3) {
|
|
63473
|
-
const { _e, _h2, _q, boxC, cursor, macroGround, polyFace, put } = K;
|
|
63642
|
+
const { _e, _h2, _q, boxC, cursor, macroGround, polyFace, put: put2 } = K;
|
|
63474
63643
|
const MATERIAL_MAP2 = { plain: "plain", metal: "metal", wood: "wood", glass: "glass", fabric: "fabric", foam: "fabric", plant: "plant", water: "water", emissive: "emissive", "atlas_picture": "picture", "atlas_floor": "floor", plaster: "plain", matte: "glass", glass_light: "emissive", light: "emissive", ceramic_tile: "plain", parquet: "plain", ceramic: "plain" };
|
|
63475
63644
|
const mm = (k) => MATERIAL_MAP2[k] || "plain";
|
|
63476
63645
|
const LIGHTS = [];
|
|
@@ -63487,7 +63656,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63487
63656
|
cylinder(M, mat, x, y, z, r, h, color2, rx = 0, rz = 0, seg2) {
|
|
63488
63657
|
const [px, pz] = loc(M, x, z);
|
|
63489
63658
|
_q.setFromEuler(_e.set(rx || 0, M.ry, rz || 0, "YXZ"));
|
|
63490
|
-
|
|
63659
|
+
put2(mm(mat), seg2 || "cyl", px, M.base + y + (rx || rz ? 0 : h / 2), pz, _q, r * 2, h, r * 2, color2);
|
|
63491
63660
|
},
|
|
63492
63661
|
leaf(M, x, y, z, w, h, color2, ry = 0, rx = 0) {
|
|
63493
63662
|
const [px, pz] = loc(M, x, z), a = M.ry + (ry || 0), ca = Math.cos(a), sa = Math.sin(a), t1 = (rx || 0) * 0.8, t2 = (rx || 0) * 1.5, y0 = M.base + y;
|
|
@@ -63508,12 +63677,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63508
63677
|
if (uv && mat === "atlas_floor") {
|
|
63509
63678
|
const col = Math.floor(uv.u0 * 4 + 1e-6), lin = uv.v0 < 0.5 ? 1 : 0, cell = col + 4 * lin, h0 = _h2(Math.round(px * 8), Math.round(pz * 8)), type = cell === 5 ? "dirt" : cell === 0 || cell === 1 ? "lawn" : null;
|
|
63510
63679
|
if (type === "dirt") {
|
|
63511
|
-
|
|
63680
|
+
put2("dirt", "plane", px, M.base + y, pz, _q, w, h, 1, sh(color2, 1 / 0.965));
|
|
63512
63681
|
return;
|
|
63513
63682
|
}
|
|
63514
63683
|
if (type) uv = { u0: uv.u0, u1: uv.u1, v0: uv.v0, v1: uv.v1, rot: h0 * 4 | 0, fx: h0 > 0.5 ? 1 : 0, vc: (wx, wz) => macroGround(wx, wz, type) };
|
|
63515
63684
|
}
|
|
63516
|
-
|
|
63685
|
+
put2(mm(mat), "plane", px, M.base + y, pz, _q, w, h, 1, color2, uv);
|
|
63517
63686
|
},
|
|
63518
63687
|
light(M, x, y, z, color2, range3, type, ex) {
|
|
63519
63688
|
const [px, pz] = loc(M, x, z);
|
|
@@ -63539,7 +63708,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63539
63708
|
Object.assign(K, defined);
|
|
63540
63709
|
}
|
|
63541
63710
|
function installFurnitureBuilders(K, shared3) {
|
|
63542
|
-
const { PE, _q, kit2, kk, paletteColor, put, rngOf, sh } = K;
|
|
63711
|
+
const { PE, _q, kit2, kk, paletteColor, put: put2, rngOf, sh } = K;
|
|
63543
63712
|
const counterTap = (...a) => K.counterTap(...a);
|
|
63544
63713
|
const apart = () => !shared3.ctx.visorScene;
|
|
63545
63714
|
const FURNITURE = {
|
|
@@ -63591,7 +63760,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63591
63760
|
lc("metal", -0.08, h + 0.03, -0.05, 0.01, 0.2, 9075290);
|
|
63592
63761
|
_q.identity();
|
|
63593
63762
|
const [px, pz] = [M.x + -0.08 * Math.cos(M.ry) + -0.05 * Math.sin(M.ry), M.z - -0.08 * Math.sin(M.ry) + -0.05 * Math.cos(M.ry)];
|
|
63594
|
-
|
|
63763
|
+
put2("fabric", "cone", px, M.base + h + 0.32, pz, _q, 0.36, 0.2, 0.36, 15259824);
|
|
63595
63764
|
}
|
|
63596
63765
|
},
|
|
63597
63766
|
shelf(M, A, o = {}) {
|
|
@@ -63869,7 +64038,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63869
64038
|
lc("plain", 0, 0, 0, 0.14, 0.03, 2763306);
|
|
63870
64039
|
lc("metal", 0, 0.03, 0, 0.012, M.h - 0.35, 9075290);
|
|
63871
64040
|
_q.identity();
|
|
63872
|
-
|
|
64041
|
+
put2("fabric", "cone", M.x, M.base + (M.y || 0) + M.h - 0.2, M.z, _q, 0.4, 0.3, 0.4, 14733992);
|
|
63873
64042
|
},
|
|
63874
64043
|
microwave(M, A) {
|
|
63875
64044
|
const { b: lb } = kk(M, A);
|
|
@@ -66743,7 +66912,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66743
66912
|
PL.push(l);
|
|
66744
66913
|
}
|
|
66745
66914
|
const slotOf = (i) => lease ? lease.handles[i].slot : i;
|
|
66746
|
-
const
|
|
66915
|
+
const put2 = (i, v) => {
|
|
66747
66916
|
if (lease) {
|
|
66748
66917
|
lease.handles[i].update(v.color === void 0 || typeof v.color === "number" ? v : { ...v, color: new THREE.Color(v.color).getHex() });
|
|
66749
66918
|
return;
|
|
@@ -66882,13 +67051,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66882
67051
|
const b0 = LZU.uRB0.value, b1 = LZU.uRB1.value, b2 = LZU.uRB2.value, by = LZU.uRBY.value, ex = LZU.uREx.value;
|
|
66883
67052
|
A.crates[i] = g ? { k: g.k, rects: g.rects, y: g.y, exterior: !!g.exterior, exclusion: g.exclusion || null, d: g.d } : null;
|
|
66884
67053
|
if (!g) {
|
|
66885
|
-
|
|
67054
|
+
put2(i, { intensity: 0 });
|
|
66886
67055
|
for (const a of [b0, b1, b2, ex]) a.set(EMPTY, at4 * 4);
|
|
66887
67056
|
by.set([0, 0], at4 * 2);
|
|
66888
67057
|
continue;
|
|
66889
67058
|
}
|
|
66890
67059
|
const lamp = g.exterior ? { intensity: g.lumens, distance: g.dist, decay: g.decay } : { intensity: (7 + g.range * 0.8) * lim(1 + 0.4 * (Math.sqrt(g.n) - 1), 1, 2.2), distance: Math.max(3, g.dm * 1.3 + 0.5), decay: 1.6 };
|
|
66891
|
-
|
|
67060
|
+
put2(i, { position: g.pos, color: g.color, ...lamp });
|
|
66892
67061
|
const rs = g.rects;
|
|
66893
67062
|
b0.set(rs[0] || EMPTY, at4 * 4);
|
|
66894
67063
|
b1.set(rs[1] || EMPTY, at4 * 4);
|
|
@@ -97507,8 +97676,36 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97507
97676
|
loop: 2,
|
|
97508
97677
|
timeline: [call2("bodywork_impact", [0, 0, 0], NORMAL, [variable("dx"), variable("dy"), variable("dz")], variable("bore"), variable("paint"), variable("metal"))]
|
|
97509
97678
|
};
|
|
97679
|
+
var GLASS_PIECE = 11061464;
|
|
97680
|
+
var GLASS_DUST = 12572386;
|
|
97681
|
+
var HIT = [0, 0, 0];
|
|
97682
|
+
var VEHICLE_GLASS_CHIP = {
|
|
97683
|
+
id: "vehicle_glass_chip",
|
|
97684
|
+
pageId: "vehicle:vehicle_glass_chip",
|
|
97685
|
+
team: "vehicles",
|
|
97686
|
+
budget: { particles: 16, debris: 6 },
|
|
97687
|
+
loop: 2,
|
|
97688
|
+
timeline: [
|
|
97689
|
+
burst("add", 6, { p: HIT, box: [0.04, 0.04, 0.04], size: [8e-3, 0.02], life: [0.12, 0.3], c0: 16777215, a: 0.9, fi: 0.3 }),
|
|
97690
|
+
burst("normal", 6, { p: HIT, dir: NORMAL, sp: [0.3, 0.9], drag: 3, life: [0.4, 0.8], size: [0.04, 0.08], grow: 2, c0: GLASS_DUST, a: 0.18 }),
|
|
97691
|
+
repeat(6, debris({ p: HIT, box: [0.03, 0.03, 0.03], dir: NORMAL, cone: 0.6, sp: [0.4, 1.4], size: [rnd(2e-3, 4e-3), 2e-3, rnd(2e-3, 4e-3)], c: GLASS_PIECE, spin: 20, life: 6, bounce: 0.2 }))
|
|
97692
|
+
]
|
|
97693
|
+
};
|
|
97694
|
+
var VEHICLE_GLASS_SHATTER = {
|
|
97695
|
+
id: "vehicle_glass_shatter",
|
|
97696
|
+
pageId: "vehicle:vehicle_glass_shatter",
|
|
97697
|
+
team: "vehicles",
|
|
97698
|
+
budget: { particles: 40, debris: 0 },
|
|
97699
|
+
loop: 2,
|
|
97700
|
+
timeline: [
|
|
97701
|
+
burst("add", 24, { p: HIT, box: [0.5, 0.3, 0.5], size: [0.01, 0.03], life: [0.15, 0.5], c0: 16777215, a: 0.9, fi: 0.3 }),
|
|
97702
|
+
burst("normal", 10, { p: [0, -0.15, 0], box: [0.5, 0.2, 0.5], sp: [0.1, 0.4], drag: 2, life: [0.6, 1.1], size: [0.08, 0.14], grow: 2.5, c0: GLASS_DUST, a: 0.14 })
|
|
97703
|
+
]
|
|
97704
|
+
};
|
|
97510
97705
|
var VEHICLE_EFFECTS = [
|
|
97511
97706
|
BODYWORK_IMPACT,
|
|
97707
|
+
VEHICLE_GLASS_CHIP,
|
|
97708
|
+
VEHICLE_GLASS_SHATTER,
|
|
97512
97709
|
/** The engine on fire: `engine_smoke` at its worst condition (black smoke, flames in the hood, a light). */
|
|
97513
97710
|
aliasOf(ENGINE_SMOKE, "vehicle_fire", { params: { id: "condition", options: ["100", "60", "30", "10"], default: 3 }, loop: 12 }),
|
|
97514
97711
|
/** The exhaust of a car under way: `engine_smoke` in the best condition, for half a second so a moving car asks again. */
|
|
@@ -98966,6 +99163,110 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
98966
99163
|
function addScrape(store, spec) {
|
|
98967
99164
|
store.add({ kind: "scrape", ...spec, y: spec.y + 2e-3 + nextLift(store) * 2e-4 });
|
|
98968
99165
|
}
|
|
99166
|
+
var RESTITUTION = -0.32;
|
|
99167
|
+
var GROUND_FRICTION = 0.5;
|
|
99168
|
+
var REST_SPEED = 0.6;
|
|
99169
|
+
var REST_SLIDE = 0.5;
|
|
99170
|
+
var TRAIL_SECONDS = 1.8;
|
|
99171
|
+
var TRAIL_STEP = 0.025;
|
|
99172
|
+
var QUARTER_TURN3 = Math.PI / 2;
|
|
99173
|
+
var TOP_FACING = 0.7;
|
|
99174
|
+
var MOVE2 = { x0: 0.5, y0: 0.5, z0: 0.5, x1: 0.5, y1: 0.5, z1: 0.5, pad: 0.5 };
|
|
99175
|
+
function bounce2(core, chunk, floor2) {
|
|
99176
|
+
chunk.y = floor2;
|
|
99177
|
+
if (chunk.blood && !chunk.splat && core.layers.mark) {
|
|
99178
|
+
chunk.splat = true;
|
|
99179
|
+
addBloodSplat(core.marks, core.ground, chunk.rng, { x: chunk.x, z: chunk.z, radius: chunk.rng.between(0.06, 0.13) });
|
|
99180
|
+
}
|
|
99181
|
+
chunk.vy *= RESTITUTION;
|
|
99182
|
+
chunk.vx *= GROUND_FRICTION;
|
|
99183
|
+
chunk.vz *= GROUND_FRICTION;
|
|
99184
|
+
chunk.ax *= GROUND_FRICTION;
|
|
99185
|
+
chunk.ay *= GROUND_FRICTION;
|
|
99186
|
+
chunk.az *= GROUND_FRICTION;
|
|
99187
|
+
if (Math.abs(chunk.vy) < REST_SPEED && Math.hypot(chunk.vx, chunk.vz) < REST_SLIDE) {
|
|
99188
|
+
chunk.rest = true;
|
|
99189
|
+
chunk.rx = Math.round(chunk.rx / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99190
|
+
chunk.rz = Math.round(chunk.rz / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99191
|
+
}
|
|
99192
|
+
}
|
|
99193
|
+
var chunkPad = (chunk) => Math.max(chunk.sx, chunk.sy, chunk.sz) * 0.45;
|
|
99194
|
+
function hitFace(chunk, out) {
|
|
99195
|
+
chunk.x = out.x;
|
|
99196
|
+
chunk.y = out.y;
|
|
99197
|
+
chunk.z = out.z;
|
|
99198
|
+
const into = chunk.vx * out.nx + chunk.vy * out.ny + chunk.vz * out.nz;
|
|
99199
|
+
if (into >= 0) return;
|
|
99200
|
+
const tx = chunk.vx - into * out.nx;
|
|
99201
|
+
const ty = chunk.vy - into * out.ny;
|
|
99202
|
+
const tz = chunk.vz - into * out.nz;
|
|
99203
|
+
const back2 = into * RESTITUTION;
|
|
99204
|
+
chunk.vx = tx * GROUND_FRICTION + back2 * out.nx;
|
|
99205
|
+
chunk.vy = ty * GROUND_FRICTION + back2 * out.ny;
|
|
99206
|
+
chunk.vz = tz * GROUND_FRICTION + back2 * out.nz;
|
|
99207
|
+
chunk.ax *= GROUND_FRICTION;
|
|
99208
|
+
chunk.ay *= GROUND_FRICTION;
|
|
99209
|
+
chunk.az *= GROUND_FRICTION;
|
|
99210
|
+
if (out.ny > TOP_FACING && Math.abs(back2) < REST_SPEED && Math.sqrt(tx * tx + tz * tz) * GROUND_FRICTION < REST_SLIDE) {
|
|
99211
|
+
chunk.rest = true;
|
|
99212
|
+
chunk.rx = Math.round(chunk.rx / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99213
|
+
chunk.rz = Math.round(chunk.rz / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99214
|
+
}
|
|
99215
|
+
}
|
|
99216
|
+
function leaveTrail(core, chunk, dt) {
|
|
99217
|
+
chunk.trail -= dt;
|
|
99218
|
+
if (chunk.trail > 0) return;
|
|
99219
|
+
chunk.trail = TRAIL_STEP;
|
|
99220
|
+
const random = chunk.rng;
|
|
99221
|
+
addSpark(core, {
|
|
99222
|
+
x: chunk.x,
|
|
99223
|
+
y: chunk.y,
|
|
99224
|
+
z: chunk.z,
|
|
99225
|
+
vx: chunk.vx * 0.15,
|
|
99226
|
+
vy: chunk.vy * 0.15,
|
|
99227
|
+
vz: chunk.vz * 0.15,
|
|
99228
|
+
life: random.between(0.25, 0.45),
|
|
99229
|
+
w: 0.05 + chunk.sx * 0.2,
|
|
99230
|
+
st: 0.05,
|
|
99231
|
+
kind: 0,
|
|
99232
|
+
g: 0,
|
|
99233
|
+
drag: 1,
|
|
99234
|
+
source: chunk.source
|
|
99235
|
+
});
|
|
99236
|
+
if (random.next() < 0.25) {
|
|
99237
|
+
addPuff(core, random, { x: chunk.x, y: chunk.y, z: chunk.z, s0: 0.04, s1: 0.14 + chunk.sx * 0.3, sg: 0.15, life: random.between(1, 1.6), drag: 2, buoy: 0.6, color: SMOKE_COLORS.grey, kind: 0, source: chunk.source });
|
|
99238
|
+
}
|
|
99239
|
+
}
|
|
99240
|
+
function updateChunks(core, dt) {
|
|
99241
|
+
const confiner = core.confiner;
|
|
99242
|
+
const confining = !confiner.empty;
|
|
99243
|
+
const chunks = core.chunks.items;
|
|
99244
|
+
for (let index = 0; index < chunks.length; index++) {
|
|
99245
|
+
const chunk = chunks[index];
|
|
99246
|
+
chunk.t += dt;
|
|
99247
|
+
if (chunk.rest) continue;
|
|
99248
|
+
MOVE2.x0 = chunk.x;
|
|
99249
|
+
MOVE2.y0 = chunk.y;
|
|
99250
|
+
MOVE2.z0 = chunk.z;
|
|
99251
|
+
chunk.vy -= core.gravity * dt;
|
|
99252
|
+
chunk.x += chunk.vx * dt;
|
|
99253
|
+
chunk.y += chunk.vy * dt;
|
|
99254
|
+
chunk.z += chunk.vz * dt;
|
|
99255
|
+
chunk.rx += chunk.ax * dt;
|
|
99256
|
+
chunk.ry += chunk.ay * dt;
|
|
99257
|
+
chunk.rz += chunk.az * dt;
|
|
99258
|
+
if (confining) {
|
|
99259
|
+
MOVE2.x1 = chunk.x;
|
|
99260
|
+
MOVE2.y1 = chunk.y;
|
|
99261
|
+
MOVE2.z1 = chunk.z;
|
|
99262
|
+
MOVE2.pad = chunkPad(chunk);
|
|
99263
|
+
if (confiner.confineMove(MOVE2, dt)) hitFace(chunk, confiner.out);
|
|
99264
|
+
}
|
|
99265
|
+
const floor2 = chunk.sy * 0.45 + core.groundAt(chunk.x, chunk.z);
|
|
99266
|
+
if (chunk.y < floor2) bounce2(core, chunk, floor2);
|
|
99267
|
+
if (chunk.hot && chunk.t < TRAIL_SECONDS && core.layers.smoke) leaveTrail(core, chunk, dt);
|
|
99268
|
+
}
|
|
99269
|
+
}
|
|
98969
99270
|
function createRingPool(capacity) {
|
|
98970
99271
|
return new OrderedPool(capacity, () => ({ x: 0, z: 0, y0: 0, rise: 0, rk: 0, R0: 0, R1: 0, r: 0, roll: 0, t: 0, life: 0 }));
|
|
98971
99272
|
}
|
|
@@ -99095,6 +99396,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99095
99396
|
puff3.z = out.z;
|
|
99096
99397
|
slideInto(out, puff3);
|
|
99097
99398
|
}
|
|
99399
|
+
function chunkBornFrom(core, chunk, ox, oy, oz) {
|
|
99400
|
+
const confiner = core.confiner;
|
|
99401
|
+
if (confiner.empty) return;
|
|
99402
|
+
BIRTH.x0 = ox;
|
|
99403
|
+
BIRTH.y0 = oy;
|
|
99404
|
+
BIRTH.z0 = oz;
|
|
99405
|
+
BIRTH.x1 = chunk.x;
|
|
99406
|
+
BIRTH.y1 = chunk.y;
|
|
99407
|
+
BIRTH.z1 = chunk.z;
|
|
99408
|
+
BIRTH.pad = chunkPad(chunk);
|
|
99409
|
+
if (confiner.confineMove(BIRTH, 0)) hitFace(chunk, confiner.out);
|
|
99410
|
+
}
|
|
99098
99411
|
function composeFireballs(context) {
|
|
99099
99412
|
const { core, def, random, x, y, z, size, scale, direction } = context;
|
|
99100
99413
|
if (!core.layers.fire || !def.fireballs) return;
|
|
@@ -99279,7 +99592,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99279
99592
|
const sy = plate2 ? s * 0.3 : s * random.between(0.6, 1);
|
|
99280
99593
|
const color2 = hexToRgb2(chunks.colors.length > 0 ? pick22(random, chunks.colors) : DEFAULT_CHUNK_COLOR);
|
|
99281
99594
|
const hot = random.next() < chunks.hot;
|
|
99282
|
-
addChunk(core, random, {
|
|
99595
|
+
const chunk = addChunk(core, random, {
|
|
99283
99596
|
x: x + d.x * 0.2,
|
|
99284
99597
|
y: y + 0.2,
|
|
99285
99598
|
z: z + d.z * 0.2,
|
|
@@ -99293,10 +99606,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99293
99606
|
plate: plate2,
|
|
99294
99607
|
hot
|
|
99295
99608
|
});
|
|
99609
|
+
chunkBornFrom(core, chunk, x, y, z);
|
|
99296
99610
|
}
|
|
99297
99611
|
}
|
|
99298
99612
|
function composeRimDebris(context) {
|
|
99299
|
-
const { core, random, x, z } = context;
|
|
99613
|
+
const { core, random, x, y, z } = context;
|
|
99300
99614
|
const radius = context.def.mark.crater ?? 0;
|
|
99301
99615
|
if (!core.layers.shrapnel) return;
|
|
99302
99616
|
const speedScale = context.def.chunks.speed ?? 1;
|
|
@@ -99307,7 +99621,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99307
99621
|
const s = random.between(0.12, 0.28);
|
|
99308
99622
|
const vy2 = random.between(4, 10);
|
|
99309
99623
|
const color2 = hexToRgb2(random.next() < 0.6 ? ROCK_COLORS[0] : ROCK_COLORS[1]);
|
|
99310
|
-
addChunk(core, random, {
|
|
99624
|
+
const chunk = addChunk(core, random, {
|
|
99311
99625
|
x: x + Math.cos(angle) * 0.3,
|
|
99312
99626
|
y: 0.1,
|
|
99313
99627
|
z: z + Math.sin(angle) * 0.3,
|
|
@@ -99320,6 +99634,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99320
99634
|
color: color2,
|
|
99321
99635
|
plate: true
|
|
99322
99636
|
});
|
|
99637
|
+
chunkBornFrom(core, chunk, x, y, z);
|
|
99323
99638
|
}
|
|
99324
99639
|
}
|
|
99325
99640
|
function composeMushroom(context, spec) {
|
|
@@ -99450,71 +99765,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99450
99765
|
emitRequests(context);
|
|
99451
99766
|
return scale;
|
|
99452
99767
|
}
|
|
99453
|
-
var RESTITUTION = -0.32;
|
|
99454
|
-
var GROUND_FRICTION = 0.5;
|
|
99455
|
-
var REST_SPEED = 0.6;
|
|
99456
|
-
var REST_SLIDE = 0.5;
|
|
99457
|
-
var TRAIL_SECONDS = 1.8;
|
|
99458
|
-
var TRAIL_STEP = 0.025;
|
|
99459
|
-
var QUARTER_TURN3 = Math.PI / 2;
|
|
99460
|
-
function bounce2(core, chunk, floor2) {
|
|
99461
|
-
chunk.y = floor2;
|
|
99462
|
-
if (chunk.blood && !chunk.splat && core.layers.mark) {
|
|
99463
|
-
chunk.splat = true;
|
|
99464
|
-
addBloodSplat(core.marks, core.ground, chunk.rng, { x: chunk.x, z: chunk.z, radius: chunk.rng.between(0.06, 0.13) });
|
|
99465
|
-
}
|
|
99466
|
-
chunk.vy *= RESTITUTION;
|
|
99467
|
-
chunk.vx *= GROUND_FRICTION;
|
|
99468
|
-
chunk.vz *= GROUND_FRICTION;
|
|
99469
|
-
chunk.ax *= GROUND_FRICTION;
|
|
99470
|
-
chunk.ay *= GROUND_FRICTION;
|
|
99471
|
-
chunk.az *= GROUND_FRICTION;
|
|
99472
|
-
if (Math.abs(chunk.vy) < REST_SPEED && Math.hypot(chunk.vx, chunk.vz) < REST_SLIDE) {
|
|
99473
|
-
chunk.rest = true;
|
|
99474
|
-
chunk.rx = Math.round(chunk.rx / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99475
|
-
chunk.rz = Math.round(chunk.rz / QUARTER_TURN3) * QUARTER_TURN3;
|
|
99476
|
-
}
|
|
99477
|
-
}
|
|
99478
|
-
function leaveTrail(core, chunk, dt) {
|
|
99479
|
-
chunk.trail -= dt;
|
|
99480
|
-
if (chunk.trail > 0) return;
|
|
99481
|
-
chunk.trail = TRAIL_STEP;
|
|
99482
|
-
const random = chunk.rng;
|
|
99483
|
-
addSpark(core, {
|
|
99484
|
-
x: chunk.x,
|
|
99485
|
-
y: chunk.y,
|
|
99486
|
-
z: chunk.z,
|
|
99487
|
-
vx: chunk.vx * 0.15,
|
|
99488
|
-
vy: chunk.vy * 0.15,
|
|
99489
|
-
vz: chunk.vz * 0.15,
|
|
99490
|
-
life: random.between(0.25, 0.45),
|
|
99491
|
-
w: 0.05 + chunk.sx * 0.2,
|
|
99492
|
-
st: 0.05,
|
|
99493
|
-
kind: 0,
|
|
99494
|
-
g: 0,
|
|
99495
|
-
drag: 1,
|
|
99496
|
-
source: chunk.source
|
|
99497
|
-
});
|
|
99498
|
-
if (random.next() < 0.25) {
|
|
99499
|
-
addPuff(core, random, { x: chunk.x, y: chunk.y, z: chunk.z, s0: 0.04, s1: 0.14 + chunk.sx * 0.3, sg: 0.15, life: random.between(1, 1.6), drag: 2, buoy: 0.6, color: SMOKE_COLORS.grey, kind: 0, source: chunk.source });
|
|
99500
|
-
}
|
|
99501
|
-
}
|
|
99502
|
-
function updateChunks(core, dt) {
|
|
99503
|
-
for (const chunk of core.chunks.items) {
|
|
99504
|
-
chunk.t += dt;
|
|
99505
|
-
if (chunk.rest) continue;
|
|
99506
|
-
chunk.vy -= core.gravity * dt;
|
|
99507
|
-
chunk.x += chunk.vx * dt;
|
|
99508
|
-
chunk.y += chunk.vy * dt;
|
|
99509
|
-
chunk.z += chunk.vz * dt;
|
|
99510
|
-
chunk.rx += chunk.ax * dt;
|
|
99511
|
-
chunk.ry += chunk.ay * dt;
|
|
99512
|
-
chunk.rz += chunk.az * dt;
|
|
99513
|
-
const floor2 = chunk.sy * 0.45 + core.groundAt(chunk.x, chunk.z);
|
|
99514
|
-
if (chunk.y < floor2) bounce2(core, chunk, floor2);
|
|
99515
|
-
if (chunk.hot && chunk.t < TRAIL_SECONDS && core.layers.smoke) leaveTrail(core, chunk, dt);
|
|
99516
|
-
}
|
|
99517
|
-
}
|
|
99518
99768
|
var DECAY = { shake: 5, white: 7, red: 2.2, side: 3, chroma: 3, desat: 0.7, gasSeconds: 5, beat: 6 };
|
|
99519
99769
|
var INITIAL_FLASH_DECAY = 6;
|
|
99520
99770
|
function createScreenState() {
|
|
@@ -104691,7 +104941,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104691
104941
|
if (oneHand) placeOnBody({ THREE, hand, holder, frame: options.bodyHold?.() ?? eyeFrame(), rear: modelRear, lengthMetres: session.lengthMetres, handgun: true, right: heldAnchor(held), left: null, grip: BODY_HOLD.dualGrip, ...side === "L" ? { mirror: true } : {} });
|
|
104692
104942
|
else placeOnBody({ THREE, hand, holder, frame: options.bodyHold?.() ?? eyeFrame(), rear: modelRear, lengthMetres: session.lengthMetres, handgun: family === "pistol" || family === "revolver", hip: session.model.parts.carry === "hip", right: hold?.right ?? null, left: hold?.left ?? null });
|
|
104693
104943
|
hand.updateMatrixWorld(true);
|
|
104694
|
-
lift += (liftToKeepInView() - lift) * Math.min(1, dt * HAND_IN_VIEW.rate);
|
|
104944
|
+
lift += ((options.bodyHold?.() ? 0 : liftToKeepInView()) - lift) * Math.min(1, dt * HAND_IN_VIEW.rate);
|
|
104695
104945
|
if (lift > 1e-4) hand.position.addScaledVector(up.set(0, 1, 0).applyQuaternion(camera2.quaternion), lift);
|
|
104696
104946
|
hand.updateMatrixWorld(true);
|
|
104697
104947
|
pullFromWall(dt);
|