@adatechnology/game-vfx 0.20.1 → 0.21.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 +6 -2
- package/dist/index.d.ts +24 -7
- package/dist/index.global.js +83 -33
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +83 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,10 +109,14 @@ the pool to the tank and the blast at 7.2 s), played when the leak catches fire.
|
|
|
109
109
|
|
|
110
110
|
`world.enclose(id, { center, halfSize, orientation, openings, leak })` declares a closed space: a turned box the smoke, dust, steam and gas do not
|
|
111
111
|
cross. It works on all three particle systems: the puffs (kinds smoke, dust and gas; not blood or bile), the sprite kinds marked `carried`
|
|
112
|
-
(`smoke`, `dust`, `steam`, `ash`) and the Workshop's light
|
|
112
|
+
(`smoke`, `dust`, `steam`, `ash` and `fire`: a flame is burning gas) and the Workshop's light sprites of both blends (`g` under 3; embers and drops fall
|
|
113
|
+
and are not held). A step that would cross a wall is put back on the
|
|
113
114
|
wall and slides along it; it passes only inside an opening (an opening with a `rate` passes that share per second of what presses on it, like a
|
|
114
115
|
bullet hole), or through a closed wall at `leak` per second (the gaps of a shut door). What starts inside stays inside. A puff stops about a third
|
|
115
|
-
of its size off a wall it is outside of, so its edge does not show through the glass.
|
|
116
|
+
of its size off a wall it is outside of, so its edge does not show through the glass. Held inside, it stays half its size off the closed walls
|
|
117
|
+
(`ConfineMove.inner`), so a flame under a roof does not show over it; it leaves freely by a plain opening, and through a rated gap it is outside the
|
|
118
|
+
wall at once. A space whose roof is not flat gives its line as `ceiling` (heights over the centre at equal steps along the box's x: a car's roof
|
|
119
|
+
coming down to the windshield): what is in the box over that line is outside the space. Call `enclose` again each time the space moves or opens;
|
|
116
120
|
`enclose(id, null)` ends it, and `clear()` keeps the spaces (they are the scene, not effects). The same shape is `Enclosure` of the contracts,
|
|
117
121
|
and `game-vfx-three`'s renderer forwards `EffectSink.enclose` here.
|
|
118
122
|
|
package/dist/index.d.ts
CHANGED
|
@@ -322,6 +322,11 @@ interface ConfineMove {
|
|
|
322
322
|
y1: number;
|
|
323
323
|
z1: number;
|
|
324
324
|
pad: number;
|
|
325
|
+
/**
|
|
326
|
+
* Inside a closed space: how far off its walls the particle is kept, metres (its own half size, so none of its body stands out through them). Negative: `pad`.
|
|
327
|
+
* Outside a solid a soft puff comes up closer than its half size (`pad`); inside a car that much of it showed over the roof.
|
|
328
|
+
*/
|
|
329
|
+
inner: number;
|
|
325
330
|
}
|
|
326
331
|
/**
|
|
327
332
|
* The host's solid world as the air sees it (the walls, slabs and furniture of a destruction world): whether the straight step of `move` from
|
|
@@ -349,6 +354,12 @@ interface VfxEnclosure {
|
|
|
349
354
|
readonly openings?: readonly VfxEnclosureBox[];
|
|
350
355
|
/** Share per second of what presses on a closed wall that seeps through (default 0: sealed). */
|
|
351
356
|
readonly leak?: number;
|
|
357
|
+
/**
|
|
358
|
+
* The roof when it is not flat: its height over the box's centre (metres, at most `halfSize[1]`) at equal steps along the box's own x, from
|
|
359
|
+
* `-halfSize[0]` to `+halfSize[0]`, a straight line between two samples (a car's roof coming down to the windshield and the rear glass, a hood coming
|
|
360
|
+
* down to its nose). What is in the box over it is outside the space.
|
|
361
|
+
*/
|
|
362
|
+
readonly ceiling?: readonly number[];
|
|
352
363
|
}
|
|
353
364
|
/** Stops what the air carries at the walls of the closed spaces. `confine` answers `true` and fills `out` when a step was stopped. */
|
|
354
365
|
interface Confiner {
|
|
@@ -356,9 +367,10 @@ interface Confiner {
|
|
|
356
367
|
readonly empty: boolean;
|
|
357
368
|
/**
|
|
358
369
|
* The step of one particle from `(x0, y0, z0)` to `(x1, y1, z1)` over `dt` seconds. `pad` (metres) keeps an outside particle that far off the
|
|
359
|
-
* walls (a puff is a ball, not a point: its middle stops before its edge goes through the glass).
|
|
370
|
+
* walls (a puff is a ball, not a point: its middle stops before its edge goes through the glass). `inner` (metres, default `pad`) keeps one held
|
|
371
|
+
* inside that far off them: half its size, and none of it shows through the roof.
|
|
360
372
|
*/
|
|
361
|
-
confine(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, pad: number, dt: number): boolean;
|
|
373
|
+
confine(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, pad: number, dt: number, inner?: number): boolean;
|
|
362
374
|
/** `confine` with the step in an object the caller reuses: eight numbers passed to a call are boxed on the heap, one object is not. `move` is only read during the call: it is not kept. */
|
|
363
375
|
confineMove(move: ConfineMove, dt: number): boolean;
|
|
364
376
|
readonly out: ConfineResult;
|
|
@@ -375,6 +387,13 @@ declare class Enclosures implements Confiner {
|
|
|
375
387
|
private readonly l0;
|
|
376
388
|
private readonly l1;
|
|
377
389
|
private readonly q;
|
|
390
|
+
/** Of the step being tested, per local axis: the walls (`wallLo`, `wallHi`) and how far a particle held inside may go (`lo`, `hi`). */
|
|
391
|
+
private readonly wallLo;
|
|
392
|
+
private readonly wallHi;
|
|
393
|
+
private readonly lo;
|
|
394
|
+
private readonly hi;
|
|
395
|
+
/** The last `through` passed by a plain opening (no rate), not by a gap's or the leak's chance. */
|
|
396
|
+
private plain;
|
|
378
397
|
private readonly h;
|
|
379
398
|
private readonly move;
|
|
380
399
|
private readonly solids;
|
|
@@ -395,7 +414,7 @@ declare class Enclosures implements Confiner {
|
|
|
395
414
|
private chance;
|
|
396
415
|
/** The opening the wall point `q` (local) is in lets it through now. */
|
|
397
416
|
private through;
|
|
398
|
-
confine(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, pad: number, dt: number): boolean;
|
|
417
|
+
confine(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, pad: number, dt: number, inner?: number): boolean;
|
|
399
418
|
confineMove(move: ConfineMove, dt: number): boolean;
|
|
400
419
|
private confineSpaces;
|
|
401
420
|
}
|
|
@@ -1158,7 +1177,6 @@ interface DecalFromSprite {
|
|
|
1158
1177
|
declare class SpritePool {
|
|
1159
1178
|
readonly capacity: number;
|
|
1160
1179
|
private readonly context;
|
|
1161
|
-
private readonly carried;
|
|
1162
1180
|
count: number;
|
|
1163
1181
|
readonly position: Float32Array;
|
|
1164
1182
|
readonly velocity: Float32Array;
|
|
@@ -1182,8 +1200,7 @@ declare class SpritePool {
|
|
|
1182
1200
|
private readonly scalarArrays;
|
|
1183
1201
|
private readonly direction;
|
|
1184
1202
|
private readonly unit;
|
|
1185
|
-
|
|
1186
|
-
constructor(capacity: number, context: WorkshopContext, carried?: boolean);
|
|
1203
|
+
constructor(capacity: number, context: WorkshopContext);
|
|
1187
1204
|
spawn(options: SpriteSpawn): void;
|
|
1188
1205
|
kill(index: number): void;
|
|
1189
1206
|
clear(): void;
|
|
@@ -1691,7 +1708,7 @@ interface SpriteKindDef {
|
|
|
1691
1708
|
readonly ground: SpriteGround;
|
|
1692
1709
|
readonly flutter?: number;
|
|
1693
1710
|
readonly flicker?: number;
|
|
1694
|
-
/** Carried by the air (smoke, dust, steam, ash): a closed space (`VfxWorld.enclose`, a shut car) keeps it out, or in. */
|
|
1711
|
+
/** Carried by the air (smoke, dust, steam, ash, and a flame, which is burning gas): a closed space (`VfxWorld.enclose`, a shut car) keeps it out, or in. */
|
|
1695
1712
|
readonly carried?: boolean;
|
|
1696
1713
|
}
|
|
1697
1714
|
declare const SPRITE_KINDS: Readonly<Record<SpriteKind, SpriteKindDef>>;
|
package/dist/index.global.js
CHANGED
|
@@ -1562,6 +1562,13 @@ var GameVfx = (() => {
|
|
|
1562
1562
|
};
|
|
1563
1563
|
|
|
1564
1564
|
// src/enclosures.ts
|
|
1565
|
+
function ceilingAt(s, x) {
|
|
1566
|
+
const c = s.ceiling;
|
|
1567
|
+
if (!c) return s.hy;
|
|
1568
|
+
const t = Math.min(1, Math.max(0, (x + s.hx) / (2 * s.hx))) * (c.length - 1);
|
|
1569
|
+
const i = Math.min(c.length - 2, Math.floor(t));
|
|
1570
|
+
return c[i] + (c[i + 1] - c[i]) * (t - i);
|
|
1571
|
+
}
|
|
1565
1572
|
var SKIN2 = 5e-3;
|
|
1566
1573
|
function rotation(q) {
|
|
1567
1574
|
const [x, y, z, w] = q ?? [0, 0, 0, 1];
|
|
@@ -1591,8 +1598,15 @@ var GameVfx = (() => {
|
|
|
1591
1598
|
__publicField(this, "l0", new Float64Array(3));
|
|
1592
1599
|
__publicField(this, "l1", new Float64Array(3));
|
|
1593
1600
|
__publicField(this, "q", new Float64Array(3));
|
|
1601
|
+
/** Of the step being tested, per local axis: the walls (`wallLo`, `wallHi`) and how far a particle held inside may go (`lo`, `hi`). */
|
|
1602
|
+
__publicField(this, "wallLo", new Float64Array(3));
|
|
1603
|
+
__publicField(this, "wallHi", new Float64Array(3));
|
|
1604
|
+
__publicField(this, "lo", new Float64Array(3));
|
|
1605
|
+
__publicField(this, "hi", new Float64Array(3));
|
|
1606
|
+
/** The last `through` passed by a plain opening (no rate), not by a gap's or the leak's chance. */
|
|
1607
|
+
__publicField(this, "plain", false);
|
|
1594
1608
|
__publicField(this, "h", new Float64Array(3));
|
|
1595
|
-
__publicField(this, "move", { x0: 0, y0: 0, z0: 0, x1: 0, y1: 0, z1: 0, pad: 0 });
|
|
1609
|
+
__publicField(this, "move", { x0: 0, y0: 0, z0: 0, x1: 0, y1: 0, z1: 0, pad: 0, inner: -1 });
|
|
1596
1610
|
__publicField(this, "solids", new Solids());
|
|
1597
1611
|
this.random = lehmer(seed);
|
|
1598
1612
|
}
|
|
@@ -1623,7 +1637,9 @@ var GameVfx = (() => {
|
|
|
1623
1637
|
r: rotation(enclosure.orientation),
|
|
1624
1638
|
radius: Math.hypot(hx, hy, hz),
|
|
1625
1639
|
openings: enclosure.openings ?? [],
|
|
1626
|
-
leak: Math.max(0, enclosure.leak ?? 0)
|
|
1640
|
+
leak: Math.max(0, enclosure.leak ?? 0),
|
|
1641
|
+
// a roof no higher than the box, and never under its floor
|
|
1642
|
+
ceiling: enclosure.ceiling && enclosure.ceiling.length >= 2 && Math.abs(hx) > 0 ? Float64Array.from(enclosure.ceiling, (y) => Math.min(Math.abs(hy), Math.max(-Math.abs(hy), y))) : null
|
|
1627
1643
|
};
|
|
1628
1644
|
const old = this.spaces.get(id);
|
|
1629
1645
|
this.spaces.set(id, space);
|
|
@@ -1634,7 +1650,7 @@ var GameVfx = (() => {
|
|
|
1634
1650
|
get(id) {
|
|
1635
1651
|
const s = this.spaces.get(id);
|
|
1636
1652
|
if (!s) return void 0;
|
|
1637
|
-
return { center: [s.cx, s.cy, s.cz], halfSize: [s.hx, s.hy, s.hz], openings: s.openings, leak: s.leak };
|
|
1653
|
+
return { center: [s.cx, s.cy, s.cz], halfSize: [s.hx, s.hy, s.hz], openings: s.openings, leak: s.leak, ...s.ceiling ? { ceiling: [...s.ceiling] } : {} };
|
|
1638
1654
|
}
|
|
1639
1655
|
ids() {
|
|
1640
1656
|
return [...this.spaces.keys()];
|
|
@@ -1647,7 +1663,7 @@ var GameVfx = (() => {
|
|
|
1647
1663
|
inside(x, y, z) {
|
|
1648
1664
|
for (const s of this.list) {
|
|
1649
1665
|
this.toLocal(s, x, y, z, this.l0);
|
|
1650
|
-
if (Math.abs(this.l0[0]) <= s.hx &&
|
|
1666
|
+
if (Math.abs(this.l0[0]) <= s.hx && this.l0[1] >= -s.hy && this.l0[1] <= ceilingAt(s, this.l0[0]) && Math.abs(this.l0[2]) <= s.hz) return true;
|
|
1651
1667
|
}
|
|
1652
1668
|
return false;
|
|
1653
1669
|
}
|
|
@@ -1666,13 +1682,18 @@ var GameVfx = (() => {
|
|
|
1666
1682
|
}
|
|
1667
1683
|
/** The opening the wall point `q` (local) is in lets it through now. */
|
|
1668
1684
|
through(s, q, dt) {
|
|
1685
|
+
this.plain = false;
|
|
1669
1686
|
for (const o of s.openings) {
|
|
1670
1687
|
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;
|
|
1671
|
-
if (o.rate === void 0
|
|
1688
|
+
if (o.rate === void 0) {
|
|
1689
|
+
this.plain = true;
|
|
1690
|
+
return true;
|
|
1691
|
+
}
|
|
1692
|
+
if (this.chance(o.rate, dt)) return true;
|
|
1672
1693
|
}
|
|
1673
1694
|
return this.chance(s.leak, dt);
|
|
1674
1695
|
}
|
|
1675
|
-
confine(x0, y0, z0, x1, y1, z1, pad, dt) {
|
|
1696
|
+
confine(x0, y0, z0, x1, y1, z1, pad, dt, inner = -1) {
|
|
1676
1697
|
const move = this.move;
|
|
1677
1698
|
move.x0 = x0;
|
|
1678
1699
|
move.y0 = y0;
|
|
@@ -1681,6 +1702,7 @@ var GameVfx = (() => {
|
|
|
1681
1702
|
move.y1 = y1;
|
|
1682
1703
|
move.z1 = z1;
|
|
1683
1704
|
move.pad = pad;
|
|
1705
|
+
move.inner = inner;
|
|
1684
1706
|
return this.confineMove(move, dt);
|
|
1685
1707
|
}
|
|
1686
1708
|
confineMove(move, dt) {
|
|
@@ -1692,6 +1714,7 @@ var GameVfx = (() => {
|
|
|
1692
1714
|
if (list.length === 0) return false;
|
|
1693
1715
|
const { x0, y0, z0, x1, y1, z1 } = move;
|
|
1694
1716
|
const p = Math.min(Math.max(0, move.pad), MAX_PAD);
|
|
1717
|
+
const inner = move.inner < 0 ? p : move.inner;
|
|
1695
1718
|
const l0 = this.l0;
|
|
1696
1719
|
const l1 = this.l1;
|
|
1697
1720
|
const q = this.q;
|
|
@@ -1712,40 +1735,65 @@ var GameVfx = (() => {
|
|
|
1712
1735
|
h[0] = s.hx;
|
|
1713
1736
|
h[1] = s.hy;
|
|
1714
1737
|
h[2] = s.hz;
|
|
1715
|
-
const
|
|
1738
|
+
const top0 = ceilingAt(s, l0[0]);
|
|
1739
|
+
const top = ceilingAt(s, l1[0]);
|
|
1740
|
+
const in0 = Math.abs(l0[0]) <= s.hx && l0[1] >= -s.hy && l0[1] <= top0 && Math.abs(l0[2]) <= s.hz;
|
|
1716
1741
|
let axis2 = 0;
|
|
1717
1742
|
let sign = 1;
|
|
1743
|
+
let outward = false;
|
|
1744
|
+
let face = 0;
|
|
1718
1745
|
if (in0) {
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1746
|
+
const { wallLo, wallHi, lo, hi } = this;
|
|
1747
|
+
let pressing = false;
|
|
1748
|
+
for (let a = 0; a < 3; a++) {
|
|
1749
|
+
wallLo[a] = -h[a];
|
|
1750
|
+
wallHi[a] = a === 1 ? top : h[a];
|
|
1751
|
+
const off = Math.min(inner, (wallHi[a] - wallLo[a]) * 0.25);
|
|
1752
|
+
lo[a] = wallLo[a] + off;
|
|
1753
|
+
hi[a] = wallHi[a] - off;
|
|
1754
|
+
if (l1[a] > hi[a] || l1[a] < lo[a]) pressing = true;
|
|
1755
|
+
}
|
|
1756
|
+
if (!pressing) continue;
|
|
1722
1757
|
let worst = -Infinity;
|
|
1758
|
+
let gated = false;
|
|
1723
1759
|
for (let a = 0; a < 3; a++) {
|
|
1724
|
-
const over = Math.
|
|
1760
|
+
const over = Math.max(l1[a] - hi[a], lo[a] - l1[a]);
|
|
1761
|
+
q[a] = over > 0 ? l1[a] < lo[a] ? wallLo[a] : wallHi[a] : l1[a];
|
|
1725
1762
|
if (over > worst) {
|
|
1726
1763
|
worst = over;
|
|
1727
1764
|
axis2 = a;
|
|
1728
1765
|
}
|
|
1729
1766
|
}
|
|
1730
|
-
sign = l1[axis2] <
|
|
1731
|
-
|
|
1732
|
-
|
|
1767
|
+
sign = l1[axis2] < lo[axis2] ? -1 : 1;
|
|
1768
|
+
face = sign > 0 ? wallHi[axis2] : -wallLo[axis2];
|
|
1769
|
+
if (this.through(s, q, dt)) {
|
|
1770
|
+
if (this.plain) continue;
|
|
1771
|
+
gated = true;
|
|
1772
|
+
l1[axis2] = sign * (face + SKIN2);
|
|
1773
|
+
} else {
|
|
1774
|
+
for (let a = 0; a < 3; a++) l1[a] = Math.min(Math.min(hi[a], wallHi[a] - SKIN2), Math.max(Math.max(lo[a], wallLo[a] + SKIN2), l1[a]));
|
|
1775
|
+
sign = -sign;
|
|
1776
|
+
}
|
|
1777
|
+
outward = gated;
|
|
1733
1778
|
} else {
|
|
1734
|
-
const padded0 = Math.abs(l0[0]) <= s.hx + p &&
|
|
1779
|
+
const padded0 = Math.abs(l0[0]) <= s.hx + p && l0[1] >= -s.hy - p && l0[1] <= top0 + p && Math.abs(l0[2]) <= s.hz + p;
|
|
1735
1780
|
const bound = padded0 ? 0 : p;
|
|
1736
|
-
if (!(Math.abs(l1[0]) <= s.hx + bound &&
|
|
1737
|
-
|
|
1781
|
+
if (!(Math.abs(l1[0]) <= s.hx + bound && l1[1] >= -s.hy - bound && l1[1] <= top + bound && Math.abs(l1[2]) <= s.hz + bound)) continue;
|
|
1782
|
+
q[0] = Math.min(h[0], Math.max(-h[0], l1[0]));
|
|
1783
|
+
q[1] = Math.min(top, Math.max(-h[1], l1[1]));
|
|
1784
|
+
q[2] = Math.min(h[2], Math.max(-h[2], l1[2]));
|
|
1738
1785
|
if (this.through(s, q, dt)) continue;
|
|
1739
1786
|
let worst = -Infinity;
|
|
1740
1787
|
for (let a = 0; a < 3; a++) {
|
|
1741
|
-
const over = Math.abs(l0[a]) - (h[a] + bound);
|
|
1788
|
+
const over = a === 1 ? Math.max(l0[1] - (top0 + bound), -l0[1] - (h[1] + bound)) : Math.abs(l0[a]) - (h[a] + bound);
|
|
1742
1789
|
if (over > worst) {
|
|
1743
1790
|
worst = over;
|
|
1744
1791
|
axis2 = a;
|
|
1745
1792
|
}
|
|
1746
1793
|
}
|
|
1747
|
-
sign = l0[axis2] < 0 ? -1 : 1;
|
|
1748
|
-
|
|
1794
|
+
sign = axis2 === 1 ? l0[1] - top0 >= -l0[1] - h[1] ? 1 : -1 : l0[axis2] < 0 ? -1 : 1;
|
|
1795
|
+
face = axis2 === 1 && sign > 0 ? top : h[axis2];
|
|
1796
|
+
l1[axis2] = sign * (face + bound + SKIN2);
|
|
1749
1797
|
}
|
|
1750
1798
|
const r = s.r;
|
|
1751
1799
|
const out = this.out;
|
|
@@ -1755,7 +1803,7 @@ var GameVfx = (() => {
|
|
|
1755
1803
|
out.nx = r[axis2] * sign;
|
|
1756
1804
|
out.ny = r[3 + axis2] * sign;
|
|
1757
1805
|
out.nz = r[6 + axis2] * sign;
|
|
1758
|
-
out.d = out.nx * s.cx + out.ny * s.cy + out.nz * s.cz + (in0 ? -
|
|
1806
|
+
out.d = out.nx * s.cx + out.ny * s.cy + out.nz * s.cz + (in0 && !outward ? -face : face);
|
|
1759
1807
|
return true;
|
|
1760
1808
|
}
|
|
1761
1809
|
return false;
|
|
@@ -1782,7 +1830,7 @@ var GameVfx = (() => {
|
|
|
1782
1830
|
var FRAMES_PER_PROBE = 3;
|
|
1783
1831
|
var GROUND_FACING = 0.7;
|
|
1784
1832
|
var SAME_WALL = 0.9;
|
|
1785
|
-
var PROBE = { x0: 0.5, y0: 0.5, z0: 0.5, x1: 0.5, y1: 0.5, z1: 0.5, pad: 0.5 };
|
|
1833
|
+
var PROBE = { x0: 0.5, y0: 0.5, z0: 0.5, x1: 0.5, y1: 0.5, z1: 0.5, pad: 0.5, inner: -0.5 };
|
|
1786
1834
|
var KeptCut = class {
|
|
1787
1835
|
constructor() {
|
|
1788
1836
|
__publicField(this, "on", false);
|
|
@@ -1916,7 +1964,7 @@ var GameVfx = (() => {
|
|
|
1916
1964
|
var GROWTH_CAP_SECONDS = 3.5;
|
|
1917
1965
|
var CARRIED_KINDS = [true, true, false, true, false];
|
|
1918
1966
|
var PAD_OF_SIZE = 0.35;
|
|
1919
|
-
var MOVE = { x0: 0, y0: 0, z0: 0, x1: 0, y1: 0, z1: 0, pad: 0 };
|
|
1967
|
+
var MOVE = { x0: 0, y0: 0, z0: 0, x1: 0, y1: 0, z1: 0, pad: 0, inner: 0 };
|
|
1920
1968
|
function createPuffPool(capacity) {
|
|
1921
1969
|
const placeholder = { next: () => 0, between: (min2) => min2, direction: (out) => out, state: 0 };
|
|
1922
1970
|
return new OrderedPool(capacity, () => ({
|
|
@@ -2022,6 +2070,7 @@ var GameVfx = (() => {
|
|
|
2022
2070
|
MOVE.y1 = puff3.y;
|
|
2023
2071
|
MOVE.z1 = puff3.z;
|
|
2024
2072
|
MOVE.pad = puff3.size * PAD_OF_SIZE;
|
|
2073
|
+
MOVE.inner = puff3.size * 0.5;
|
|
2025
2074
|
return confiner.confineMove(MOVE, dt);
|
|
2026
2075
|
}
|
|
2027
2076
|
function updatePuffs(pool, dt, wind, confiner) {
|
|
@@ -5978,7 +6027,7 @@ var GameVfx = (() => {
|
|
|
5978
6027
|
var TRAIL_STEP = 0.025;
|
|
5979
6028
|
var QUARTER_TURN3 = Math.PI / 2;
|
|
5980
6029
|
var TOP_FACING = 0.7;
|
|
5981
|
-
var MOVE2 = { x0: 0.5, y0: 0.5, z0: 0.5, x1: 0.5, y1: 0.5, z1: 0.5, pad: 0.5 };
|
|
6030
|
+
var MOVE2 = { x0: 0.5, y0: 0.5, z0: 0.5, x1: 0.5, y1: 0.5, z1: 0.5, pad: 0.5, inner: -0.5 };
|
|
5982
6031
|
function bounce(core, chunk, floor2) {
|
|
5983
6032
|
chunk.y = floor2;
|
|
5984
6033
|
if (chunk.blood && !chunk.splat && core.layers.mark) {
|
|
@@ -6191,7 +6240,7 @@ var GameVfx = (() => {
|
|
|
6191
6240
|
screen2.flashDecay = 0.5;
|
|
6192
6241
|
}
|
|
6193
6242
|
}
|
|
6194
|
-
var BIRTH = { x0: 0, y0: 0, z0: 0, x1: 0, y1: 0, z1: 0, pad: 0 };
|
|
6243
|
+
var BIRTH = { x0: 0, y0: 0, z0: 0, x1: 0, y1: 0, z1: 0, pad: 0, inner: -1 };
|
|
6195
6244
|
function bornFrom(core, puff3, ox, oy, oz) {
|
|
6196
6245
|
const confiner = core.confiner;
|
|
6197
6246
|
if (confiner.empty) return;
|
|
@@ -6603,7 +6652,7 @@ var GameVfx = (() => {
|
|
|
6603
6652
|
|
|
6604
6653
|
// src/sprites/kind-pool.ts
|
|
6605
6654
|
var PAD_OF_SIZE2 = 0.35;
|
|
6606
|
-
var STEP = { x0: 0.5, y0: 0.5, z0: 0.5, x1: 0.5, y1: 0.5, z1: 0.5, pad: 0.5 };
|
|
6655
|
+
var STEP = { x0: 0.5, y0: 0.5, z0: 0.5, x1: 0.5, y1: 0.5, z1: 0.5, pad: 0.5, inner: 0.5 };
|
|
6607
6656
|
var GROUND_RESAMPLE = 0.1;
|
|
6608
6657
|
var VELOCITY = { vx: 0.5, vy: 0.5, vz: 0.5 };
|
|
6609
6658
|
var SPRITE_REACH = 1;
|
|
@@ -6882,6 +6931,7 @@ var GameVfx = (() => {
|
|
|
6882
6931
|
STEP.y1 = y;
|
|
6883
6932
|
STEP.z1 = z;
|
|
6884
6933
|
STEP.pad = this.size0[i] * (1 + (def.grow - 1) * t) * PAD_OF_SIZE2;
|
|
6934
|
+
STEP.inner = STEP.pad * (0.5 / PAD_OF_SIZE2);
|
|
6885
6935
|
if (confiner.confineMove(STEP, dt)) {
|
|
6886
6936
|
met = true;
|
|
6887
6937
|
const out = confiner.out;
|
|
@@ -6970,7 +7020,8 @@ var GameVfx = (() => {
|
|
|
6970
7020
|
fadeIn: 0.12,
|
|
6971
7021
|
cone: 0.7,
|
|
6972
7022
|
ground: "none",
|
|
6973
|
-
flicker: 0.35
|
|
7023
|
+
flicker: 0.35,
|
|
7024
|
+
carried: true
|
|
6974
7025
|
},
|
|
6975
7026
|
smoke: {
|
|
6976
7027
|
id: "smoke",
|
|
@@ -7832,12 +7883,11 @@ var GameVfx = (() => {
|
|
|
7832
7883
|
var BYTE_MAX2 = 255;
|
|
7833
7884
|
var CARRIED_GRAVITY = 3;
|
|
7834
7885
|
var PAD_OF_SIZE3 = 0.35;
|
|
7886
|
+
var INNER_OF_SIZE = 0.5;
|
|
7835
7887
|
var SpritePool = class {
|
|
7836
|
-
|
|
7837
|
-
constructor(capacity, context, carried = false) {
|
|
7888
|
+
constructor(capacity, context) {
|
|
7838
7889
|
__publicField(this, "capacity", capacity);
|
|
7839
7890
|
__publicField(this, "context", context);
|
|
7840
|
-
__publicField(this, "carried", carried);
|
|
7841
7891
|
__publicField(this, "count", 0);
|
|
7842
7892
|
__publicField(this, "position");
|
|
7843
7893
|
__publicField(this, "velocity");
|
|
@@ -7958,9 +8008,9 @@ var GameVfx = (() => {
|
|
|
7958
8008
|
position[offset] += velocity[offset] * dt;
|
|
7959
8009
|
position[offset + 1] += velocity[offset + 1] * dt;
|
|
7960
8010
|
position[offset + 2] += velocity[offset + 2] * dt;
|
|
7961
|
-
if (
|
|
8011
|
+
if (confiner && !confiner.empty && Math.abs(this.gravity[index]) < CARRIED_GRAVITY) {
|
|
7962
8012
|
const size = this.startSize[index] * (1 + (this.growth[index] - 1) * age);
|
|
7963
|
-
if (confiner.confine(x0, y0, z0, position[offset], position[offset + 1], position[offset + 2], size * PAD_OF_SIZE3, dt)) {
|
|
8013
|
+
if (confiner.confine(x0, y0, z0, position[offset], position[offset + 1], position[offset + 2], size * PAD_OF_SIZE3, dt, size * INNER_OF_SIZE)) {
|
|
7964
8014
|
const out = confiner.out;
|
|
7965
8015
|
position[offset] = out.x;
|
|
7966
8016
|
position[offset + 1] = out.y;
|
|
@@ -8264,7 +8314,7 @@ var GameVfx = (() => {
|
|
|
8264
8314
|
const profile = options.profile ?? PROFILES.high;
|
|
8265
8315
|
this.context = { random: options.random, groundAt: options.groundAt ?? workshopGround, quality: { level: 0, mult: 1 }, trace: options.trace, ...options.confiner ? { confiner: options.confiner } : {} };
|
|
8266
8316
|
this.add = new SpritePool(profile.sprites.add, this.context);
|
|
8267
|
-
this.normal = new SpritePool(profile.sprites.normal, this.context
|
|
8317
|
+
this.normal = new SpritePool(profile.sprites.normal, this.context);
|
|
8268
8318
|
this.streaks = new StreakPool(profile.streaks, this.context);
|
|
8269
8319
|
this.debris = new DebrisPool(this.context);
|
|
8270
8320
|
this.decals = new DecalPool(this.context);
|