@adatechnology/game-vfx 0.5.0 → 0.7.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/README.md +11 -0
- package/dist/index.d.ts +94 -2
- package/dist/index.global.js +378 -114
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +378 -114
- package/dist/index.js.map +1 -1
- package/package.json +2 -5
package/dist/index.js
CHANGED
|
@@ -1320,12 +1320,262 @@ function updateGlows(pool, dt) {
|
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
1322
|
|
|
1323
|
+
// src/random.ts
|
|
1324
|
+
var LEHMER_MULTIPLIER = 16807;
|
|
1325
|
+
var LEHMER_MODULUS = 2147483647;
|
|
1326
|
+
var LCG_MULTIPLIER = 1664525;
|
|
1327
|
+
var LCG_INCREMENT = 1013904223;
|
|
1328
|
+
var LCG_RANGE = 4294967296;
|
|
1329
|
+
var HASH_MIX = 2654435761;
|
|
1330
|
+
function normalizeLehmerSeed(seed) {
|
|
1331
|
+
const whole = Math.floor(Math.abs(seed)) % (LEHMER_MODULUS - 1);
|
|
1332
|
+
return whole === 0 ? 1 : whole;
|
|
1333
|
+
}
|
|
1334
|
+
function lehmer(seed) {
|
|
1335
|
+
let state = normalizeLehmerSeed(seed);
|
|
1336
|
+
const next = () => {
|
|
1337
|
+
state = state * LEHMER_MULTIPLIER % LEHMER_MODULUS;
|
|
1338
|
+
return (state - 1) / (LEHMER_MODULUS - 1);
|
|
1339
|
+
};
|
|
1340
|
+
return {
|
|
1341
|
+
next,
|
|
1342
|
+
between: (min2, max2) => min2 + (max2 - min2) * next(),
|
|
1343
|
+
direction(out) {
|
|
1344
|
+
const up = next() * 2 - 1;
|
|
1345
|
+
const angle = next() * Math.PI * 2;
|
|
1346
|
+
const ring2 = Math.sqrt(1 - up * up);
|
|
1347
|
+
out.x = ring2 * Math.cos(angle);
|
|
1348
|
+
out.y = up;
|
|
1349
|
+
out.z = ring2 * Math.sin(angle);
|
|
1350
|
+
return out;
|
|
1351
|
+
},
|
|
1352
|
+
get state() {
|
|
1353
|
+
return state;
|
|
1354
|
+
}
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
function lcg(seed) {
|
|
1358
|
+
let state = seed >>> 0;
|
|
1359
|
+
const next = () => {
|
|
1360
|
+
state = Math.imul(state, LCG_MULTIPLIER) + LCG_INCREMENT >>> 0;
|
|
1361
|
+
return state / LCG_RANGE;
|
|
1362
|
+
};
|
|
1363
|
+
return {
|
|
1364
|
+
next,
|
|
1365
|
+
between: (min2, max2) => min2 + (max2 - min2) * next(),
|
|
1366
|
+
direction(out) {
|
|
1367
|
+
const up = next() * 2 - 1;
|
|
1368
|
+
const angle = next() * Math.PI * 2;
|
|
1369
|
+
const ring2 = Math.sqrt(1 - up * up);
|
|
1370
|
+
out.x = ring2 * Math.cos(angle);
|
|
1371
|
+
out.y = up;
|
|
1372
|
+
out.z = ring2 * Math.sin(angle);
|
|
1373
|
+
return out;
|
|
1374
|
+
},
|
|
1375
|
+
get state() {
|
|
1376
|
+
return state;
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
function mixEventSeed(eventSeed) {
|
|
1381
|
+
let mixed = Math.imul((eventSeed | 0) ^ HASH_MIX, 2246822507);
|
|
1382
|
+
mixed ^= mixed >>> 13;
|
|
1383
|
+
mixed = Math.imul(mixed, 3266489909);
|
|
1384
|
+
mixed ^= mixed >>> 16;
|
|
1385
|
+
return (mixed >>> 0) % (LEHMER_MODULUS - 1) + 1;
|
|
1386
|
+
}
|
|
1387
|
+
function streamFor(eventSeed) {
|
|
1388
|
+
return lehmer(mixEventSeed(eventSeed));
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
// src/enclosures.ts
|
|
1392
|
+
var SKIN = 5e-3;
|
|
1393
|
+
var MAX_PAD = 0.45;
|
|
1394
|
+
function rotation(q) {
|
|
1395
|
+
const [x, y, z, w] = q ?? [0, 0, 0, 1];
|
|
1396
|
+
const n = Math.hypot(x, y, z, w) || 1;
|
|
1397
|
+
const qx = x / n;
|
|
1398
|
+
const qy = y / n;
|
|
1399
|
+
const qz = z / n;
|
|
1400
|
+
const qw = w / n;
|
|
1401
|
+
return new Float64Array([
|
|
1402
|
+
1 - 2 * (qy * qy + qz * qz),
|
|
1403
|
+
2 * (qx * qy - qz * qw),
|
|
1404
|
+
2 * (qx * qz + qy * qw),
|
|
1405
|
+
2 * (qx * qy + qz * qw),
|
|
1406
|
+
1 - 2 * (qx * qx + qz * qz),
|
|
1407
|
+
2 * (qy * qz - qx * qw),
|
|
1408
|
+
2 * (qx * qz - qy * qw),
|
|
1409
|
+
2 * (qy * qz + qx * qw),
|
|
1410
|
+
1 - 2 * (qx * qx + qy * qy)
|
|
1411
|
+
]);
|
|
1412
|
+
}
|
|
1413
|
+
var Enclosures = class {
|
|
1414
|
+
constructor(seed = 20973) {
|
|
1415
|
+
__publicField(this, "spaces", /* @__PURE__ */ new Map());
|
|
1416
|
+
__publicField(this, "list", []);
|
|
1417
|
+
__publicField(this, "random");
|
|
1418
|
+
__publicField(this, "out", { x: 0, y: 0, z: 0, nx: 0, ny: 0, nz: 0 });
|
|
1419
|
+
__publicField(this, "l0", new Float64Array(3));
|
|
1420
|
+
__publicField(this, "l1", new Float64Array(3));
|
|
1421
|
+
__publicField(this, "q", new Float64Array(3));
|
|
1422
|
+
this.random = lehmer(seed);
|
|
1423
|
+
}
|
|
1424
|
+
get empty() {
|
|
1425
|
+
return this.list.length === 0;
|
|
1426
|
+
}
|
|
1427
|
+
get size() {
|
|
1428
|
+
return this.list.length;
|
|
1429
|
+
}
|
|
1430
|
+
/** Declares, moves or (with `null`) ends the space `id`. */
|
|
1431
|
+
set(id, enclosure) {
|
|
1432
|
+
if (!enclosure) {
|
|
1433
|
+
if (this.spaces.delete(id)) this.list = [...this.spaces.values()];
|
|
1434
|
+
return;
|
|
1435
|
+
}
|
|
1436
|
+
const [hx, hy, hz] = enclosure.halfSize;
|
|
1437
|
+
const space = {
|
|
1438
|
+
cx: enclosure.center[0],
|
|
1439
|
+
cy: enclosure.center[1],
|
|
1440
|
+
cz: enclosure.center[2],
|
|
1441
|
+
hx: Math.abs(hx),
|
|
1442
|
+
hy: Math.abs(hy),
|
|
1443
|
+
hz: Math.abs(hz),
|
|
1444
|
+
r: rotation(enclosure.orientation),
|
|
1445
|
+
radius: Math.hypot(hx, hy, hz),
|
|
1446
|
+
openings: enclosure.openings ?? [],
|
|
1447
|
+
leak: Math.max(0, enclosure.leak ?? 0)
|
|
1448
|
+
};
|
|
1449
|
+
const old = this.spaces.get(id);
|
|
1450
|
+
this.spaces.set(id, space);
|
|
1451
|
+
const at3 = old ? this.list.indexOf(old) : -1;
|
|
1452
|
+
if (at3 >= 0) this.list[at3] = space;
|
|
1453
|
+
else this.list.push(space);
|
|
1454
|
+
}
|
|
1455
|
+
get(id) {
|
|
1456
|
+
const s = this.spaces.get(id);
|
|
1457
|
+
if (!s) return void 0;
|
|
1458
|
+
return { center: [s.cx, s.cy, s.cz], halfSize: [s.hx, s.hy, s.hz], openings: s.openings, leak: s.leak };
|
|
1459
|
+
}
|
|
1460
|
+
ids() {
|
|
1461
|
+
return [...this.spaces.keys()];
|
|
1462
|
+
}
|
|
1463
|
+
clear() {
|
|
1464
|
+
this.spaces.clear();
|
|
1465
|
+
this.list = [];
|
|
1466
|
+
}
|
|
1467
|
+
/** Whether a point is inside any space (on the inside of its walls). */
|
|
1468
|
+
inside(x, y, z) {
|
|
1469
|
+
for (const s of this.list) {
|
|
1470
|
+
this.toLocal(s, x, y, z, this.l0);
|
|
1471
|
+
if (Math.abs(this.l0[0]) <= s.hx && Math.abs(this.l0[1]) <= s.hy && Math.abs(this.l0[2]) <= s.hz) return true;
|
|
1472
|
+
}
|
|
1473
|
+
return false;
|
|
1474
|
+
}
|
|
1475
|
+
toLocal(s, x, y, z, out) {
|
|
1476
|
+
const dx = x - s.cx;
|
|
1477
|
+
const dy = y - s.cy;
|
|
1478
|
+
const dz = z - s.cz;
|
|
1479
|
+
const r = s.r;
|
|
1480
|
+
out[0] = r[0] * dx + r[3] * dy + r[6] * dz;
|
|
1481
|
+
out[1] = r[1] * dx + r[4] * dy + r[7] * dz;
|
|
1482
|
+
out[2] = r[2] * dx + r[5] * dy + r[8] * dz;
|
|
1483
|
+
}
|
|
1484
|
+
/** Passes at `rate` per second. */
|
|
1485
|
+
chance(rate, dt) {
|
|
1486
|
+
return rate > 0 && this.random.next() < 1 - Math.exp(-rate * dt);
|
|
1487
|
+
}
|
|
1488
|
+
/** The opening the wall point `q` (local) is in lets it through now. */
|
|
1489
|
+
through(s, q, dt) {
|
|
1490
|
+
for (const o of s.openings) {
|
|
1491
|
+
if (Math.abs(q[0] - o.center[0]) > o.halfSize[0] || Math.abs(q[1] - o.center[1]) > o.halfSize[1] || Math.abs(q[2] - o.center[2]) > o.halfSize[2]) continue;
|
|
1492
|
+
if (o.rate === void 0 || this.chance(o.rate, dt)) return true;
|
|
1493
|
+
}
|
|
1494
|
+
return this.chance(s.leak, dt);
|
|
1495
|
+
}
|
|
1496
|
+
confine(x0, y0, z0, x1, y1, z1, pad, dt) {
|
|
1497
|
+
const list = this.list;
|
|
1498
|
+
if (list.length === 0) return false;
|
|
1499
|
+
const p = Math.min(Math.max(0, pad), MAX_PAD);
|
|
1500
|
+
const l0 = this.l0;
|
|
1501
|
+
const l1 = this.l1;
|
|
1502
|
+
const q = this.q;
|
|
1503
|
+
for (const s of list) {
|
|
1504
|
+
const reach = s.radius + p + 0.05;
|
|
1505
|
+
const dx = x1 - s.cx;
|
|
1506
|
+
const dy = y1 - s.cy;
|
|
1507
|
+
const dz = z1 - s.cz;
|
|
1508
|
+
if (dx * dx + dy * dy + dz * dz > reach * reach) {
|
|
1509
|
+
const ex = x0 - s.cx;
|
|
1510
|
+
const ey = y0 - s.cy;
|
|
1511
|
+
const ez = z0 - s.cz;
|
|
1512
|
+
if (ex * ex + ey * ey + ez * ez > reach * reach) continue;
|
|
1513
|
+
}
|
|
1514
|
+
this.toLocal(s, x0, y0, z0, l0);
|
|
1515
|
+
this.toLocal(s, x1, y1, z1, l1);
|
|
1516
|
+
const h = [s.hx, s.hy, s.hz];
|
|
1517
|
+
const in0 = Math.abs(l0[0]) <= s.hx && Math.abs(l0[1]) <= s.hy && Math.abs(l0[2]) <= s.hz;
|
|
1518
|
+
let axis2 = 0;
|
|
1519
|
+
let sign = 1;
|
|
1520
|
+
if (in0) {
|
|
1521
|
+
if (Math.abs(l1[0]) <= s.hx && Math.abs(l1[1]) <= s.hy && Math.abs(l1[2]) <= s.hz) continue;
|
|
1522
|
+
for (let a = 0; a < 3; a++) q[a] = Math.min(h[a], Math.max(-h[a], l1[a]));
|
|
1523
|
+
if (this.through(s, q, dt)) continue;
|
|
1524
|
+
let worst = -Infinity;
|
|
1525
|
+
for (let a = 0; a < 3; a++) {
|
|
1526
|
+
const over = Math.abs(l1[a]) - h[a];
|
|
1527
|
+
if (over > worst) {
|
|
1528
|
+
worst = over;
|
|
1529
|
+
axis2 = a;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
sign = l1[axis2] < 0 ? -1 : 1;
|
|
1533
|
+
for (let a = 0; a < 3; a++) l1[a] = Math.min(h[a] - SKIN, Math.max(-(h[a] - SKIN), l1[a]));
|
|
1534
|
+
sign = -sign;
|
|
1535
|
+
} else {
|
|
1536
|
+
const padded0 = Math.abs(l0[0]) <= s.hx + p && Math.abs(l0[1]) <= s.hy + p && Math.abs(l0[2]) <= s.hz + p;
|
|
1537
|
+
const bound = padded0 ? 0 : p;
|
|
1538
|
+
if (!(Math.abs(l1[0]) <= s.hx + bound && Math.abs(l1[1]) <= s.hy + bound && Math.abs(l1[2]) <= s.hz + bound)) continue;
|
|
1539
|
+
for (let a = 0; a < 3; a++) q[a] = Math.min(h[a], Math.max(-h[a], l1[a]));
|
|
1540
|
+
if (this.through(s, q, dt)) continue;
|
|
1541
|
+
let worst = -Infinity;
|
|
1542
|
+
for (let a = 0; a < 3; a++) {
|
|
1543
|
+
const over = Math.abs(l0[a]) - (h[a] + bound);
|
|
1544
|
+
if (over > worst) {
|
|
1545
|
+
worst = over;
|
|
1546
|
+
axis2 = a;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
sign = l0[axis2] < 0 ? -1 : 1;
|
|
1550
|
+
l1[axis2] = sign * (h[axis2] + bound + SKIN);
|
|
1551
|
+
}
|
|
1552
|
+
const r = s.r;
|
|
1553
|
+
const out = this.out;
|
|
1554
|
+
out.x = s.cx + r[0] * l1[0] + r[1] * l1[1] + r[2] * l1[2];
|
|
1555
|
+
out.y = s.cy + r[3] * l1[0] + r[4] * l1[1] + r[5] * l1[2];
|
|
1556
|
+
out.z = s.cz + r[6] * l1[0] + r[7] * l1[1] + r[8] * l1[2];
|
|
1557
|
+
out.nx = r[axis2] * sign;
|
|
1558
|
+
out.ny = r[3 + axis2] * sign;
|
|
1559
|
+
out.nz = r[6 + axis2] * sign;
|
|
1560
|
+
return true;
|
|
1561
|
+
}
|
|
1562
|
+
return false;
|
|
1563
|
+
}
|
|
1564
|
+
};
|
|
1565
|
+
function slideAlong(out, vx2, vy2, vz2) {
|
|
1566
|
+
const into = vx2 * out.nx + vy2 * out.ny + vz2 * out.nz;
|
|
1567
|
+
if (into >= 0) return [vx2, vy2, vz2];
|
|
1568
|
+
return [vx2 - into * out.nx, vy2 - into * out.ny, vz2 - into * out.nz];
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1323
1571
|
// src/pools/puffs.ts
|
|
1324
1572
|
var FLOOR_FRACTION = 0.4;
|
|
1325
1573
|
var FLOOR_BOUNCE = -0.2;
|
|
1326
1574
|
var ARRIVAL_FRAME = 30;
|
|
1327
1575
|
var ARRIVAL_BASE = 0.3;
|
|
1328
1576
|
var GROWTH_CAP_SECONDS = 3.5;
|
|
1577
|
+
var CARRIED_KINDS = [true, true, false, true, false];
|
|
1578
|
+
var PAD_OF_SIZE = 0.35;
|
|
1329
1579
|
function createPuffPool(capacity) {
|
|
1330
1580
|
const placeholder = { next: () => 0, between: (min2) => min2, direction: (out) => out, state: 0 };
|
|
1331
1581
|
return new OrderedPool(capacity, () => ({
|
|
@@ -1420,13 +1670,24 @@ function moveFree(puff3, dt, age, heat, wind) {
|
|
|
1420
1670
|
if (puff3.vy < 0) puff3.vy *= FLOOR_BOUNCE;
|
|
1421
1671
|
}
|
|
1422
1672
|
}
|
|
1423
|
-
function updatePuffs(pool, dt, wind) {
|
|
1673
|
+
function updatePuffs(pool, dt, wind, confiner) {
|
|
1424
1674
|
pool.compact(ageOrKeep2, dt);
|
|
1675
|
+
const confining = confiner !== void 0 && !confiner.empty;
|
|
1425
1676
|
for (const puff3 of pool.items) {
|
|
1426
1677
|
const age = puff3.t / puff3.life;
|
|
1427
1678
|
const heat = puff3.h0 > 0 ? puff3.h0 * Math.pow(Math.max(0, 1 - puff3.t / puff3.hl), 1.25) : 0;
|
|
1679
|
+
const x0 = puff3.x;
|
|
1680
|
+
const y0 = puff3.y;
|
|
1681
|
+
const z0 = puff3.z;
|
|
1428
1682
|
if (puff3.ring) moveOnRing(puff3, puff3.ring, wind);
|
|
1429
1683
|
else moveFree(puff3, dt, age, heat, wind);
|
|
1684
|
+
if (confining && CARRIED_KINDS[puff3.kind] && confiner.confine(x0, y0, z0, puff3.x, puff3.y, puff3.z, puff3.size * PAD_OF_SIZE, dt)) {
|
|
1685
|
+
const out = confiner.out;
|
|
1686
|
+
puff3.x = out.x;
|
|
1687
|
+
puff3.y = out.y;
|
|
1688
|
+
puff3.z = out.z;
|
|
1689
|
+
[puff3.vx, puff3.vy, puff3.vz] = slideAlong(out, puff3.vx, puff3.vy, puff3.vz);
|
|
1690
|
+
}
|
|
1430
1691
|
const size = puff3.s0 + (puff3.s1 - puff3.s0) * (1 - Math.exp(-puff3.t * puff3.gk)) + puff3.sg * Math.min(puff3.t, GROWTH_CAP_SECONDS);
|
|
1431
1692
|
puff3.size = size * Math.min(1, puff3.t * ARRIVAL_FRAME + ARRIVAL_BASE);
|
|
1432
1693
|
puff3.age = age;
|
|
@@ -1980,10 +2241,10 @@ var SCREAMER_SHRIEK = {
|
|
|
1980
2241
|
};
|
|
1981
2242
|
|
|
1982
2243
|
// src/effects/props.ts
|
|
1983
|
-
function localToWorld(translation,
|
|
2244
|
+
function localToWorld(translation, rotation2, local2) {
|
|
1984
2245
|
const [x, y, z] = local2;
|
|
1985
|
-
const [a, c, e] = [Math.cos(
|
|
1986
|
-
const [b, d, f] = [Math.sin(
|
|
2246
|
+
const [a, c, e] = [Math.cos(rotation2[0]), Math.cos(rotation2[1]), Math.cos(rotation2[2])];
|
|
2247
|
+
const [b, d, f] = [Math.sin(rotation2[0]), Math.sin(rotation2[1]), Math.sin(rotation2[2])];
|
|
1987
2248
|
const [ae, af, be, bf] = [a * e, a * f, b * e, b * f];
|
|
1988
2249
|
return [
|
|
1989
2250
|
c * e * x + -c * f * y + d * z + translation[0],
|
|
@@ -2343,22 +2604,22 @@ var SHOPFRONT_GLASS = {
|
|
|
2343
2604
|
};
|
|
2344
2605
|
|
|
2345
2606
|
// src/effects/vector-math.ts
|
|
2346
|
-
function normalized(
|
|
2347
|
-
const length = Math.sqrt(
|
|
2607
|
+
function normalized(vector2) {
|
|
2608
|
+
const length = Math.sqrt(vector2[0] * vector2[0] + vector2[1] * vector2[1] + vector2[2] * vector2[2]) || 1;
|
|
2348
2609
|
const inverse = 1 / length;
|
|
2349
|
-
return [
|
|
2610
|
+
return [vector2[0] * inverse, vector2[1] * inverse, vector2[2] * inverse];
|
|
2350
2611
|
}
|
|
2351
|
-
function plus(
|
|
2352
|
-
return [
|
|
2612
|
+
function plus(vector2, x, y, z) {
|
|
2613
|
+
return [vector2[0] + x, vector2[1] + y, vector2[2] + z];
|
|
2353
2614
|
}
|
|
2354
|
-
function scaledBy(
|
|
2355
|
-
return [
|
|
2615
|
+
function scaledBy(vector2, factor) {
|
|
2616
|
+
return [vector2[0] * factor, vector2[1] * factor, vector2[2] * factor];
|
|
2356
2617
|
}
|
|
2357
|
-
function plusScaled(
|
|
2358
|
-
return [
|
|
2618
|
+
function plusScaled(vector2, direction, factor) {
|
|
2619
|
+
return [vector2[0] + direction[0] * factor, vector2[1] + direction[1] * factor, vector2[2] + direction[2] * factor];
|
|
2359
2620
|
}
|
|
2360
|
-
function negated(
|
|
2361
|
-
return [-
|
|
2621
|
+
function negated(vector2) {
|
|
2622
|
+
return [-vector2[0], -vector2[1], -vector2[2]];
|
|
2362
2623
|
}
|
|
2363
2624
|
|
|
2364
2625
|
// src/effects/destruction/door-stages.ts
|
|
@@ -3727,10 +3988,35 @@ var VEHICLE_EFFECTS = [
|
|
|
3727
3988
|
aliasOf(FUEL_LEAK, "vehicle_leak_ignited", {})
|
|
3728
3989
|
];
|
|
3729
3990
|
|
|
3991
|
+
// src/effects/particles/single-particles.ts
|
|
3992
|
+
var vector = [variable("vx"), variable("vy"), variable("vz")];
|
|
3993
|
+
var range = (name) => [variable(name), variable(name)];
|
|
3994
|
+
var singleParticle = (id, system) => ({
|
|
3995
|
+
id,
|
|
3996
|
+
pageId: `particle:${id}`,
|
|
3997
|
+
team: "world",
|
|
3998
|
+
budget: { particles: 1, lights: 0 },
|
|
3999
|
+
loop: 1e-3,
|
|
4000
|
+
timeline: [
|
|
4001
|
+
spawn(system, {
|
|
4002
|
+
p: [0, 0, 0],
|
|
4003
|
+
v: vector,
|
|
4004
|
+
life: range("life"),
|
|
4005
|
+
size: range("size"),
|
|
4006
|
+
grow: variable("grow"),
|
|
4007
|
+
c0: variable("color"),
|
|
4008
|
+
a: variable("alpha"),
|
|
4009
|
+
g: variable("gravity"),
|
|
4010
|
+
drag: variable("drag")
|
|
4011
|
+
})
|
|
4012
|
+
]
|
|
4013
|
+
});
|
|
4014
|
+
var SINGLE_PARTICLE_EFFECTS = [singleParticle("particle_puff", "normal"), singleParticle("particle_glow", "add"), singleParticle("particle_streak", "streak")];
|
|
4015
|
+
|
|
3730
4016
|
// src/effects/catalog.ts
|
|
3731
4017
|
var ALL_EFFECTS = [BLOOD_HIT, HEADSHOT, DISMEMBER, BLOATER_CLOUD, SCREAMER_SHRIEK, CORPSE_DECAY, REANIMATION, EYES_IN_FOG, MUZZLE_FLASH, IMPACT_BY_MATERIAL, PENETRATION, CASINGS_AND_MAGAZINE, MOLOTOV, GRENADE, EXPLOSIVE_BARREL, SHOPFRONT_GLASS, DOOR_STAGES, BUILDING_COLLAPSE, BLOCK_WALL, METAL_DOOR_EFFECT, IRON_RAILING, WOODEN_FENCE, HIT_POINT_BREAKAGE, PRESSURE_CYLINDERS, BUILDING_FIRE, RAIN_AND_PUDDLES, FOG_AND_ASH, SCRAPING_SPARKS, ENGINE_SMOKE, FUEL_LEAK, CAR_EXPLOSION, WINDSHIELD, HEADLIGHTS_IN_RAIN, DAMAGE_AND_BITE, INFECTION_PHASES, PANIC, BLOATER_BLINDNESS, CAMPFIRE, COUGH_AND_BREATH];
|
|
3732
4018
|
var WORKSHOP_EFFECTS = Object.fromEntries(ALL_EFFECTS.map((effect) => [effect.id, effect]));
|
|
3733
|
-
var GAME_EFFECTS = { ...WORKSHOP_EFFECTS, ...Object.fromEntries([...EVENT_EFFECTS, ...VIEWMODEL_EFFECTS, ...VEHICLE_EFFECTS].map((effect) => [effect.id, effect])) };
|
|
4019
|
+
var GAME_EFFECTS = { ...WORKSHOP_EFFECTS, ...Object.fromEntries([...EVENT_EFFECTS, ...VIEWMODEL_EFFECTS, ...VEHICLE_EFFECTS, ...SINGLE_PARTICLE_EFFECTS].map((effect) => [effect.id, effect])) };
|
|
3734
4020
|
function patchEffects(base, changes) {
|
|
3735
4021
|
const result = { ...base };
|
|
3736
4022
|
for (const [id, change] of Object.entries(changes)) {
|
|
@@ -3740,74 +4026,6 @@ function patchEffects(base, changes) {
|
|
|
3740
4026
|
return result;
|
|
3741
4027
|
}
|
|
3742
4028
|
|
|
3743
|
-
// src/random.ts
|
|
3744
|
-
var LEHMER_MULTIPLIER = 16807;
|
|
3745
|
-
var LEHMER_MODULUS = 2147483647;
|
|
3746
|
-
var LCG_MULTIPLIER = 1664525;
|
|
3747
|
-
var LCG_INCREMENT = 1013904223;
|
|
3748
|
-
var LCG_RANGE = 4294967296;
|
|
3749
|
-
var HASH_MIX = 2654435761;
|
|
3750
|
-
function normalizeLehmerSeed(seed) {
|
|
3751
|
-
const whole = Math.floor(Math.abs(seed)) % (LEHMER_MODULUS - 1);
|
|
3752
|
-
return whole === 0 ? 1 : whole;
|
|
3753
|
-
}
|
|
3754
|
-
function lehmer(seed) {
|
|
3755
|
-
let state = normalizeLehmerSeed(seed);
|
|
3756
|
-
const next = () => {
|
|
3757
|
-
state = state * LEHMER_MULTIPLIER % LEHMER_MODULUS;
|
|
3758
|
-
return (state - 1) / (LEHMER_MODULUS - 1);
|
|
3759
|
-
};
|
|
3760
|
-
return {
|
|
3761
|
-
next,
|
|
3762
|
-
between: (min2, max2) => min2 + (max2 - min2) * next(),
|
|
3763
|
-
direction(out) {
|
|
3764
|
-
const up = next() * 2 - 1;
|
|
3765
|
-
const angle = next() * Math.PI * 2;
|
|
3766
|
-
const ring2 = Math.sqrt(1 - up * up);
|
|
3767
|
-
out.x = ring2 * Math.cos(angle);
|
|
3768
|
-
out.y = up;
|
|
3769
|
-
out.z = ring2 * Math.sin(angle);
|
|
3770
|
-
return out;
|
|
3771
|
-
},
|
|
3772
|
-
get state() {
|
|
3773
|
-
return state;
|
|
3774
|
-
}
|
|
3775
|
-
};
|
|
3776
|
-
}
|
|
3777
|
-
function lcg(seed) {
|
|
3778
|
-
let state = seed >>> 0;
|
|
3779
|
-
const next = () => {
|
|
3780
|
-
state = Math.imul(state, LCG_MULTIPLIER) + LCG_INCREMENT >>> 0;
|
|
3781
|
-
return state / LCG_RANGE;
|
|
3782
|
-
};
|
|
3783
|
-
return {
|
|
3784
|
-
next,
|
|
3785
|
-
between: (min2, max2) => min2 + (max2 - min2) * next(),
|
|
3786
|
-
direction(out) {
|
|
3787
|
-
const up = next() * 2 - 1;
|
|
3788
|
-
const angle = next() * Math.PI * 2;
|
|
3789
|
-
const ring2 = Math.sqrt(1 - up * up);
|
|
3790
|
-
out.x = ring2 * Math.cos(angle);
|
|
3791
|
-
out.y = up;
|
|
3792
|
-
out.z = ring2 * Math.sin(angle);
|
|
3793
|
-
return out;
|
|
3794
|
-
},
|
|
3795
|
-
get state() {
|
|
3796
|
-
return state;
|
|
3797
|
-
}
|
|
3798
|
-
};
|
|
3799
|
-
}
|
|
3800
|
-
function mixEventSeed(eventSeed) {
|
|
3801
|
-
let mixed = Math.imul((eventSeed | 0) ^ HASH_MIX, 2246822507);
|
|
3802
|
-
mixed ^= mixed >>> 13;
|
|
3803
|
-
mixed = Math.imul(mixed, 3266489909);
|
|
3804
|
-
mixed ^= mixed >>> 16;
|
|
3805
|
-
return (mixed >>> 0) % (LEHMER_MODULUS - 1) + 1;
|
|
3806
|
-
}
|
|
3807
|
-
function streamFor(eventSeed) {
|
|
3808
|
-
return lehmer(mixEventSeed(eventSeed));
|
|
3809
|
-
}
|
|
3810
|
-
|
|
3811
4029
|
// src/effects/builders/impact-table.ts
|
|
3812
4030
|
var TABLE = {
|
|
3813
4031
|
concrete: { dust: 9078138, chip: 7236195, spark: 2 },
|
|
@@ -4507,8 +4725,8 @@ function resolve(value, context) {
|
|
|
4507
4725
|
var UP12 = [0, 1, 0];
|
|
4508
4726
|
var ZERO = [0, 0, 0];
|
|
4509
4727
|
var FULL_TURN_DRAWN = 6.283;
|
|
4510
|
-
function scaledSizes(
|
|
4511
|
-
return [
|
|
4728
|
+
function scaledSizes(range2, factor) {
|
|
4729
|
+
return [range2[0] * Math.sqrt(factor), range2[1] * Math.sqrt(factor)];
|
|
4512
4730
|
}
|
|
4513
4731
|
function fireEmit(engine, key, dt, centre, radius, factor, options = {}) {
|
|
4514
4732
|
const wind = options.wind ?? ZERO;
|
|
@@ -5158,8 +5376,8 @@ function nextLift(store) {
|
|
|
5158
5376
|
function addScorch(store, random, x, z, radius) {
|
|
5159
5377
|
const variant = Math.floor(random.next() * SCORCH_VARIANTS);
|
|
5160
5378
|
const lift = 0.03 + nextLift(store) * 1e-3;
|
|
5161
|
-
const
|
|
5162
|
-
store.add({ kind: "scorch", x, z, radius, variant, lift, rotation });
|
|
5379
|
+
const rotation2 = random.next() * 6;
|
|
5380
|
+
store.add({ kind: "scorch", x, z, radius, variant, lift, rotation: rotation2 });
|
|
5163
5381
|
}
|
|
5164
5382
|
function addRimRocks(store, ground, random, x, z, radius) {
|
|
5165
5383
|
const count = Math.round(6 + radius * 7);
|
|
@@ -5188,8 +5406,8 @@ function addRimRocks(store, ground, random, x, z, radius) {
|
|
|
5188
5406
|
function addCrater(store, ground, random, spec) {
|
|
5189
5407
|
ground?.dent(random, spec.x, spec.z, spec.radius, spec.depth);
|
|
5190
5408
|
if (!spec.marks) return;
|
|
5191
|
-
const
|
|
5192
|
-
store.add({ kind: "dirt", x: spec.x, z: spec.z, radius: spec.radius * 1.02, lift: 0.045, rotation });
|
|
5409
|
+
const rotation2 = random.next() * 6;
|
|
5410
|
+
store.add({ kind: "dirt", x: spec.x, z: spec.z, radius: spec.radius * 1.02, lift: 0.045, rotation: rotation2 });
|
|
5193
5411
|
addRimRocks(store, ground, random, spec.x, spec.z, spec.radius);
|
|
5194
5412
|
}
|
|
5195
5413
|
function addBloodSplat(store, ground, random, spec) {
|
|
@@ -5757,6 +5975,7 @@ function updateScreen(state, dt) {
|
|
|
5757
5975
|
}
|
|
5758
5976
|
|
|
5759
5977
|
// src/sprites/kind-pool.ts
|
|
5978
|
+
var PAD_OF_SIZE2 = 0.35;
|
|
5760
5979
|
var clamp4 = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
|
|
5761
5980
|
var lerp4 = (a, b, t) => a + (b - a) * t;
|
|
5762
5981
|
function rgb(hex) {
|
|
@@ -5917,9 +6136,20 @@ var SpriteKindPool = class {
|
|
|
5917
6136
|
vy2 *= k;
|
|
5918
6137
|
vz2 *= k;
|
|
5919
6138
|
}
|
|
5920
|
-
|
|
6139
|
+
let x = this.position[i3] + vx2 * dt;
|
|
5921
6140
|
let y = this.position[i3 + 1] + vy2 * dt;
|
|
5922
|
-
|
|
6141
|
+
let z = this.position[i3 + 2] + vz2 * dt;
|
|
6142
|
+
const confiner = host.confiner;
|
|
6143
|
+
if (def.carried && confiner && !confiner.empty) {
|
|
6144
|
+
const pad = this.size0[i] * lerp4(1, def.grow, t) * PAD_OF_SIZE2;
|
|
6145
|
+
if (confiner.confine(this.position[i3], this.position[i3 + 1], this.position[i3 + 2], x, y, z, pad, dt)) {
|
|
6146
|
+
const out = confiner.out;
|
|
6147
|
+
x = out.x;
|
|
6148
|
+
y = out.y;
|
|
6149
|
+
z = out.z;
|
|
6150
|
+
[vx2, vy2, vz2] = slideAlong(out, vx2, vy2, vz2);
|
|
6151
|
+
}
|
|
6152
|
+
}
|
|
5923
6153
|
if (def.ground !== "none") {
|
|
5924
6154
|
const own = this.floor[i];
|
|
5925
6155
|
const gy = Number.isNaN(own) ? host.groundAt(x, z) + 5e-3 : own;
|
|
@@ -6007,7 +6237,8 @@ var sprite_kinds_default = {
|
|
|
6007
6237
|
alpha: 0.35,
|
|
6008
6238
|
fadeIn: 0.15,
|
|
6009
6239
|
cone: 0.6,
|
|
6010
|
-
ground: "none"
|
|
6240
|
+
ground: "none",
|
|
6241
|
+
carried: true
|
|
6011
6242
|
},
|
|
6012
6243
|
sparks: {
|
|
6013
6244
|
id: "sparks",
|
|
@@ -6051,7 +6282,8 @@ var sprite_kinds_default = {
|
|
|
6051
6282
|
alpha: 0.4,
|
|
6052
6283
|
fadeIn: 0.1,
|
|
6053
6284
|
cone: 0.4,
|
|
6054
|
-
ground: "none"
|
|
6285
|
+
ground: "none",
|
|
6286
|
+
carried: true
|
|
6055
6287
|
},
|
|
6056
6288
|
shards: {
|
|
6057
6289
|
id: "shards",
|
|
@@ -6209,7 +6441,8 @@ var sprite_kinds_default = {
|
|
|
6209
6441
|
fadeIn: 0.1,
|
|
6210
6442
|
cone: 0.5,
|
|
6211
6443
|
ground: "stop",
|
|
6212
|
-
flutter: 0.6
|
|
6444
|
+
flutter: 0.6,
|
|
6445
|
+
carried: true
|
|
6213
6446
|
},
|
|
6214
6447
|
steam: {
|
|
6215
6448
|
id: "steam",
|
|
@@ -6231,7 +6464,8 @@ var sprite_kinds_default = {
|
|
|
6231
6464
|
alpha: 0.35,
|
|
6232
6465
|
fadeIn: 0.15,
|
|
6233
6466
|
cone: 0.6,
|
|
6234
|
-
ground: "none"
|
|
6467
|
+
ground: "none",
|
|
6468
|
+
carried: true
|
|
6235
6469
|
},
|
|
6236
6470
|
flash: {
|
|
6237
6471
|
id: "flash",
|
|
@@ -6376,7 +6610,8 @@ var SpriteKindSystem = class {
|
|
|
6376
6610
|
const host = {
|
|
6377
6611
|
groundAt: this.options.groundAt,
|
|
6378
6612
|
gravity: this.options.gravity,
|
|
6379
|
-
land: (owner, x, y, z, color, tag) => this.listeners.get(owner)?.(x, y, z, color, tag)
|
|
6613
|
+
land: (owner, x, y, z, color, tag) => this.listeners.get(owner)?.(x, y, z, color, tag),
|
|
6614
|
+
...this.options.confiner ? { confiner: this.options.confiner } : {}
|
|
6380
6615
|
};
|
|
6381
6616
|
if (this.additive.live > 0 || this.additive.drawCount > 0) this.additive.update(dt, host);
|
|
6382
6617
|
if (this.normal.live > 0 || this.normal.drawCount > 0) this.normal.update(dt, host);
|
|
@@ -6391,9 +6626,9 @@ var SpriteKindSystem = class {
|
|
|
6391
6626
|
var TWO_PI_ROUNDED = 6.2832;
|
|
6392
6627
|
var WIDE_CONE = 3.1;
|
|
6393
6628
|
var UP13 = [0, 1, 0];
|
|
6394
|
-
function drawRange(random,
|
|
6395
|
-
if (Array.isArray(
|
|
6396
|
-
return
|
|
6629
|
+
function drawRange(random, range2) {
|
|
6630
|
+
if (Array.isArray(range2)) return random.between(range2[0], range2[1]);
|
|
6631
|
+
return range2 || 0;
|
|
6397
6632
|
}
|
|
6398
6633
|
function randomUnit(random, out) {
|
|
6399
6634
|
const up = random.next() * 2 - 1;
|
|
@@ -6588,8 +6823,8 @@ var DecalPool = class {
|
|
|
6588
6823
|
* Takes away the marks inside a box: world `center`, `half` extents along the axes of the world `rotation` (a quaternion, x y z w; none means the
|
|
6589
6824
|
* world axes). The surface they were on is gone (a brick came out of a wall with its bullet holes). Returns how many went.
|
|
6590
6825
|
*/
|
|
6591
|
-
clearInside(center, half,
|
|
6592
|
-
const qx = -
|
|
6826
|
+
clearInside(center, half, rotation2 = [0, 0, 0, 1]) {
|
|
6827
|
+
const qx = -rotation2[0], qy = -rotation2[1], qz = -rotation2[2], qw = rotation2[3];
|
|
6593
6828
|
let gone = 0;
|
|
6594
6829
|
for (const decal2 of this.decals) {
|
|
6595
6830
|
if (!decal2.on) continue;
|
|
@@ -6714,10 +6949,14 @@ var MeshPool = class {
|
|
|
6714
6949
|
var DEFAULT_FADE_IN = 0.1;
|
|
6715
6950
|
var FLOATS_PER_VECTOR = 3;
|
|
6716
6951
|
var BYTE_MAX2 = 255;
|
|
6952
|
+
var CARRIED_GRAVITY = 3;
|
|
6953
|
+
var PAD_OF_SIZE3 = 0.35;
|
|
6717
6954
|
var SpritePool = class {
|
|
6718
|
-
|
|
6955
|
+
/** `carried`: the normal-blend pool (smoke, dust, steam), whose light sprites go round the closed spaces; the additive one (flames, sparks) does not. */
|
|
6956
|
+
constructor(capacity, context, carried = false) {
|
|
6719
6957
|
__publicField(this, "capacity", capacity);
|
|
6720
6958
|
__publicField(this, "context", context);
|
|
6959
|
+
__publicField(this, "carried", carried);
|
|
6721
6960
|
__publicField(this, "count", 0);
|
|
6722
6961
|
__publicField(this, "position");
|
|
6723
6962
|
__publicField(this, "velocity");
|
|
@@ -6818,6 +7057,7 @@ var SpritePool = class {
|
|
|
6818
7057
|
}
|
|
6819
7058
|
update(dt, leaveDecal) {
|
|
6820
7059
|
const { position, velocity } = this;
|
|
7060
|
+
const confiner = this.context.confiner;
|
|
6821
7061
|
for (let index = this.count - 1; index >= 0; index--) {
|
|
6822
7062
|
this.life[index] -= dt;
|
|
6823
7063
|
if (this.life[index] <= 0) {
|
|
@@ -6831,9 +7071,25 @@ var SpritePool = class {
|
|
|
6831
7071
|
velocity[offset] *= factor;
|
|
6832
7072
|
velocity[offset + 1] *= factor;
|
|
6833
7073
|
velocity[offset + 2] *= factor;
|
|
7074
|
+
const x0 = position[offset];
|
|
7075
|
+
const y0 = position[offset + 1];
|
|
7076
|
+
const z0 = position[offset + 2];
|
|
6834
7077
|
position[offset] += velocity[offset] * dt;
|
|
6835
7078
|
position[offset + 1] += velocity[offset + 1] * dt;
|
|
6836
7079
|
position[offset + 2] += velocity[offset + 2] * dt;
|
|
7080
|
+
if (this.carried && confiner && !confiner.empty && Math.abs(this.gravity[index]) < CARRIED_GRAVITY) {
|
|
7081
|
+
const size = this.startSize[index] * (1 + (this.growth[index] - 1) * age);
|
|
7082
|
+
if (confiner.confine(x0, y0, z0, position[offset], position[offset + 1], position[offset + 2], size * PAD_OF_SIZE3, dt)) {
|
|
7083
|
+
const out = confiner.out;
|
|
7084
|
+
position[offset] = out.x;
|
|
7085
|
+
position[offset + 1] = out.y;
|
|
7086
|
+
position[offset + 2] = out.z;
|
|
7087
|
+
const [vx2, vy2, vz2] = slideAlong(out, velocity[offset], velocity[offset + 1], velocity[offset + 2]);
|
|
7088
|
+
velocity[offset] = vx2;
|
|
7089
|
+
velocity[offset + 1] = vy2;
|
|
7090
|
+
velocity[offset + 2] = vz2;
|
|
7091
|
+
}
|
|
7092
|
+
}
|
|
6837
7093
|
const mode = this.groundMode[index];
|
|
6838
7094
|
if (mode) {
|
|
6839
7095
|
const groundHeight = this.context.groundAt(position[offset], position[offset + 2]);
|
|
@@ -7118,9 +7374,9 @@ var WorkshopEngine = class {
|
|
|
7118
7374
|
__publicField(this, "placement");
|
|
7119
7375
|
__publicField(this, "accumulators", /* @__PURE__ */ new Map());
|
|
7120
7376
|
const profile = options.profile ?? PROFILES.high;
|
|
7121
|
-
this.context = { random: options.random, groundAt: options.groundAt ?? workshopGround, quality: { level: 0, mult: 1 }, trace: options.trace };
|
|
7377
|
+
this.context = { random: options.random, groundAt: options.groundAt ?? workshopGround, quality: { level: 0, mult: 1 }, trace: options.trace, ...options.confiner ? { confiner: options.confiner } : {} };
|
|
7122
7378
|
this.add = new SpritePool(profile.sprites.add, this.context);
|
|
7123
|
-
this.normal = new SpritePool(profile.sprites.normal, this.context);
|
|
7379
|
+
this.normal = new SpritePool(profile.sprites.normal, this.context, true);
|
|
7124
7380
|
this.streaks = new StreakPool(profile.streaks, this.context);
|
|
7125
7381
|
this.debris = new DebrisPool(this.context);
|
|
7126
7382
|
this.decals = new DecalPool(this.context);
|
|
@@ -7156,13 +7412,13 @@ var WorkshopEngine = class {
|
|
|
7156
7412
|
return [origin[0] + cos2 * x + sin2 * z, origin[1] + point[1] - anchor[1], origin[2] - sin2 * x + cos2 * z];
|
|
7157
7413
|
}
|
|
7158
7414
|
/** A direction or velocity of the recipe's space in the world. */
|
|
7159
|
-
turn(
|
|
7415
|
+
turn(vector2) {
|
|
7160
7416
|
const placement = this.placement;
|
|
7161
|
-
if (!placement) return
|
|
7162
|
-
if (placement.orientation) return rotate(placement.orientation,
|
|
7417
|
+
if (!placement) return vector2;
|
|
7418
|
+
if (placement.orientation) return rotate(placement.orientation, vector2);
|
|
7163
7419
|
const cos2 = Math.cos(placement.yaw);
|
|
7164
7420
|
const sin2 = Math.sin(placement.yaw);
|
|
7165
|
-
return [cos2 *
|
|
7421
|
+
return [cos2 * vector2[0] + sin2 * vector2[2], vector2[1], -sin2 * vector2[0] + cos2 * vector2[2]];
|
|
7166
7422
|
}
|
|
7167
7423
|
placed(options) {
|
|
7168
7424
|
if (!this.placement) return options;
|
|
@@ -7312,12 +7568,14 @@ function createVfx(options = {}) {
|
|
|
7312
7568
|
const groundAt = options.groundAt ?? (ground ? (x, z) => ground.heightAt(x, z) : () => 0);
|
|
7313
7569
|
const handles = { next: 0, events: 0 };
|
|
7314
7570
|
const low = options.profile === "low";
|
|
7571
|
+
const enclosures = new Enclosures(20973 + (options.seed ?? 0));
|
|
7315
7572
|
const spriteSystem = new SpriteKindSystem({
|
|
7316
7573
|
capacity: options.sprites?.capacity ?? (low ? 1250 : 2500),
|
|
7317
7574
|
density: options.sprites?.density ?? (low ? 0.6 : 1),
|
|
7318
7575
|
seed: 2654435761 + (options.seed ?? 0),
|
|
7319
7576
|
groundAt,
|
|
7320
7577
|
gravity: options.gravity ?? DEFAULT_GRAVITY,
|
|
7578
|
+
confiner: enclosures,
|
|
7321
7579
|
...options.sprites?.kinds ? { kinds: options.sprites.kinds } : {}
|
|
7322
7580
|
});
|
|
7323
7581
|
const core = {
|
|
@@ -7367,7 +7625,7 @@ function createVfx(options = {}) {
|
|
|
7367
7625
|
return [camera2.x, camera2.y, camera2.z];
|
|
7368
7626
|
}, forward: (local2) => [local2[0] ?? 0, local2[1] ?? 0, local2[2] ?? 0] };
|
|
7369
7627
|
function workshop() {
|
|
7370
|
-
return engine ?? (engine = new WorkshopEngine({ random: sharedRandom, profile, groundAt }));
|
|
7628
|
+
return engine ?? (engine = new WorkshopEngine({ random: sharedRandom, profile, groundAt, confiner: enclosures }));
|
|
7371
7629
|
}
|
|
7372
7630
|
function effectPlayer() {
|
|
7373
7631
|
return player ?? (player = createEffectPlayer({ engine: workshop(), effects, view }));
|
|
@@ -7426,6 +7684,10 @@ function createVfx(options = {}) {
|
|
|
7426
7684
|
puff3.vz += dz * strength;
|
|
7427
7685
|
}
|
|
7428
7686
|
},
|
|
7687
|
+
enclose(id, enclosure) {
|
|
7688
|
+
enclosures.set(id, enclosure);
|
|
7689
|
+
},
|
|
7690
|
+
enclosures: () => enclosures,
|
|
7429
7691
|
stop(handle) {
|
|
7430
7692
|
player?.stop(handle);
|
|
7431
7693
|
const fires = core.fires;
|
|
@@ -7453,7 +7715,7 @@ function createVfx(options = {}) {
|
|
|
7453
7715
|
core.clock.time += dt;
|
|
7454
7716
|
core.schedule.update(core.clock.time);
|
|
7455
7717
|
updateRings(core.rings, dt);
|
|
7456
|
-
updatePuffs(core.puffs, dt, wind);
|
|
7718
|
+
updatePuffs(core.puffs, dt, wind, enclosures);
|
|
7457
7719
|
updateSparks(core.sparks, { dt, groundAt });
|
|
7458
7720
|
updateGlows(core.glows, dt);
|
|
7459
7721
|
updateShocks(core.shocks, core.puffs.items, dt);
|
|
@@ -8365,10 +8627,10 @@ var START_TARGET = [0, 1, 0];
|
|
|
8365
8627
|
function subtract(a, b) {
|
|
8366
8628
|
return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
|
8367
8629
|
}
|
|
8368
|
-
function unit(
|
|
8369
|
-
const length = Math.sqrt(
|
|
8630
|
+
function unit(vector2) {
|
|
8631
|
+
const length = Math.sqrt(vector2[0] * vector2[0] + vector2[1] * vector2[1] + vector2[2] * vector2[2]) || 1;
|
|
8370
8632
|
const inverse = 1 / length;
|
|
8371
|
-
return [
|
|
8633
|
+
return [vector2[0] * inverse, vector2[1] * inverse, vector2[2] * inverse];
|
|
8372
8634
|
}
|
|
8373
8635
|
function crossProduct(a, b) {
|
|
8374
8636
|
return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
|
|
@@ -8596,6 +8858,7 @@ export {
|
|
|
8596
8858
|
EffectCamera,
|
|
8597
8859
|
EffectInstance,
|
|
8598
8860
|
EffectRunner,
|
|
8861
|
+
Enclosures,
|
|
8599
8862
|
GAME_EFFECTS,
|
|
8600
8863
|
LOD_GAME,
|
|
8601
8864
|
LOD_LAB,
|
|
@@ -8636,6 +8899,7 @@ export {
|
|
|
8636
8899
|
patchExplosions,
|
|
8637
8900
|
patchSpriteKinds,
|
|
8638
8901
|
resolveStrings,
|
|
8902
|
+
slideAlong,
|
|
8639
8903
|
streamFor,
|
|
8640
8904
|
updateScreen,
|
|
8641
8905
|
workshopGround
|