@adatechnology/game-vfx 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -629,6 +629,11 @@ interface PuffCut {
629
629
  nz: number;
630
630
  d: number;
631
631
  }
632
+ /**
633
+ * The faces a puff is cut at, at most: three, the walls of a corner (two walls and the ceiling, or a wall, a door's jamb and its head). With two, a puff in a
634
+ * corner kept the two nearest and the third wall's other side showed it (smoke over a shut door, seen from the next room).
635
+ */
636
+ declare const PUFF_CUTS = 3;
632
637
  /** How far a puff's drawn surface reaches from its middle, in sizes: the renderer bulges the ball by up to this much (`game-vfx-three`'s puff shader). */
633
638
  declare const PUFF_REACH = 1.28;
634
639
 
@@ -685,7 +690,7 @@ interface Puff {
685
690
  * The faces of the walls (host solids, closed spaces) within the puff's reach, up to two (a wall and the skirting in front of it): the drawn ball is cut at
686
691
  * them, so smoke against a wall flattens on it instead of growing through to its other side. See `puff-cuts.ts`.
687
692
  */
688
- readonly cuts: readonly [PuffCut, PuffCut];
693
+ readonly cuts: readonly [PuffCut, PuffCut, PuffCut];
689
694
  }
690
695
 
691
696
  /** A shock wave: an air shell that grows to the lethal radius in 120 ms, and a dust ring on the ground (L319-348). The last block is what the renderer reads. */
@@ -1693,6 +1698,8 @@ declare const SPRITE_KINDS: Readonly<Record<SpriteKind, SpriteKindDef>>;
1693
1698
  /** A copy of the kinds with some changed (a partial replaces the fields it names), added or removed (`null`); a game tunes its sprites without touching the core. */
1694
1699
  declare function patchSpriteKinds(base: Readonly<Record<string, SpriteKindDef>>, changes: Readonly<Record<string, Partial<SpriteKindDef> | SpriteKindDef | null>>): Record<string, SpriteKindDef>;
1695
1700
 
1701
+ /** The offset of the face a sprite with no wall is cut at (`SpriteKindPool.cutA`, `cutB`, `cutC`): so far below that no point of it is. */
1702
+ declare const NO_CUT = -1000000000;
1696
1703
  /** Per-spawn overrides. */
1697
1704
  interface SpriteSpawnOptions {
1698
1705
  /** `0xRRGGBB`: replaces the kind's colour ramp. */
@@ -1742,6 +1749,14 @@ declare class SpriteKindPool {
1742
1749
  readonly color: Float32Array;
1743
1750
  readonly alpha: Float32Array;
1744
1751
  readonly size: Float32Array;
1752
+ /**
1753
+ * The faces of the walls each carried sprite (smoke, steam, dust) is cut at, three of them (`PUFF_CUTS`: a corner), four numbers a sprite in each: unit normal towards the sprite and offset
1754
+ * (`n · point`), `(0, 0, 0, NO_CUT)` for none. The renderer drops the part of the drawn square behind a face: a puff against a wall flattens on it and
1755
+ * shows nothing on the wall's other side, as a puff's ball does (`Puff.cuts`).
1756
+ */
1757
+ readonly cutA: Float32Array;
1758
+ readonly cutB: Float32Array;
1759
+ readonly cutC: Float32Array;
1745
1760
  private next;
1746
1761
  private high;
1747
1762
  private readonly velocity;
@@ -1765,6 +1780,13 @@ declare class SpriteKindPool {
1765
1780
  private readonly ground;
1766
1781
  constructor(capacity: number, defs: readonly SpriteKindDef[], owners: string[], sources?: SpriteSources);
1767
1782
  spawn(kind: number, p: readonly number[], v: readonly number[], random: () => number, options?: SpriteSpawnOptions): void;
1783
+ /** Sprite `i` cut at no wall. */
1784
+ private uncut;
1785
+ /**
1786
+ * Looks for the walls carried sprite `i` reaches (as a puff's ball does: `lookForWalls`), `met` the face its step was just stopped at, and keeps them in `cuts`.
1787
+ * The sprite's faces go into the reused `VIEW` and come back out: no object a sprite.
1788
+ */
1789
+ private cutAtWalls;
1768
1790
  private ownerIndex;
1769
1791
  private sourceIndex;
1770
1792
  /** Kills the live sprites made for `source`; returns how many went. */
@@ -2540,4 +2562,4 @@ declare function resolveWaterShotProfile(profile: string | WaterShotProfile, tab
2540
2562
  /** Changes a profile table without touching the kit's: `null` removes an entry, a partial entry is merged over the old one. */
2541
2563
  declare function patchWaterShotProfiles(base: Readonly<Record<string, WaterShotProfile>>, changes: Readonly<Record<string, Partial<WaterShotProfile> | null>>): Record<string, WaterShotProfile>;
2542
2564
 
2543
- export { AREA_CAP_GAME, type AreaCap, type AreaCapTracker, type Behavior, type BehaviorHost, type BlastLight, type BloodMark, type Carrier, type Chunk, type ConfineMove, type ConfineResult, type Confiner, type CueRequest, DEBRIS_COLOR_VARIABLE, DEBRIS_EFFECT_FAMILIES, DUST_COLOR_VARIABLE, type DebrisEffectFamily, type DebrisObstacle, type DebrisSpawn, type Decal, type DecalOptions, type DirtMark, EVENT_BUDGET, EVENT_EFFECTS, EVENT_EFFECTS_MAP, EXPLOSIONS, EXPLOSION_ALIASES, EffectCamera, type EffectDef, EffectInstance, type EffectPlayer, type EffectPlayerOptions, EffectRunner, type EffectRunnerOptions, type EffectStep, type EffectTexts, type EffectTrack, type EffectView, Enclosures, type ExplosionCall, type ExplosionDef, type ExplosionOptions, type Fire, type FireBody, type FireLight, type FireOptions, type FireSpec, type Follow, GAME_EFFECTS, type GameEvent, type Glow, type GroundField, type GroundFieldOptions, type InstanceDeps, type InstanceSetup, type KindPoolHost, LOD_GAME, LOD_LAB, type LandListener, type LensBlob, type LightGlow, type LightPool, type LodBands, MATERIAL_EVENT_EFFECTS, type Mark, type MarkEvent, type MarkStore, type MeshParticle, MeshPool, type MeshShape, type MeshSpawn, type MushroomSpec, type MutableVec3, OrderedPool, PIECES_DRAWN_VARIABLE, PROFILES, PUFF_REACH, type Placement, type PlayOptions, type PostProcess, type Puddle, type Puff, type PuffCut, type Quaternion, RAIN_CAPACITY, RainField, type RandomStream, type Rgb, type Ring, type RockMark, SCRAPE_LIMIT, SMOKE_COLORS, SPRITE_KINDS, type Schedule, type ScorchMark, type ScrapeMark, type ScreenState, type SheetLabels, type Shock, type Spark, type SpriteGround, type SpriteKind, type SpriteKindDef, SpriteKindPool, SpriteKindSystem, type SpriteKindSystemOptions, type SpriteSpawn, type SpriteSpawnOptions, type SpriteSystem, VFX_LAYERS, VIEWMODEL_EFFECTS, type Vec3Like, type Vec3Tuple, type VfxEnclosure, type VfxEnclosureBox, type VfxLayer, type VfxLocale, type VfxOptions, type VfxPoolsView, type VfxProfile, type VfxProfileName, type VfxSideRequest, type VfxSolidQuery, type VfxStats, type VfxStrings, type VfxTrace, type VfxWorld, WATER_BLASTS, WATER_BLAST_KINDS, WATER_LIMITS, WATER_SHOT_BY_CALIBER, WATER_SHOT_PROFILES, WORKSHOP_BEHAVIORS, WORKSHOP_EFFECTS, WORKSHOP_PUDDLES, type WaterBlastCharge, type WaterBlastKind, type WaterBlastKindId, type WaterBlastParams, type WaterBlastPlan, type WaterBubble, type WaterColumn, type WaterDrop, type WaterEffects, type WaterEffectsLimits, type WaterEffectsOptions, type WaterEffectsStats, type WaterFoam, type WaterMist, type WaterRing, type WaterRound, type WaterShotClass, type WaterShotParams, type WaterShotPlan, type WaterShotProfile, type WaterVec3, type WaterWave, type WaterWaveSample, type WorkshopContext, WorkshopEngine, type WorkshopOptions, type WorkshopTrace, colorOfChunk, composeExplosion, createAreaCap, createEffectPlayer, createGroundField, createSchedule, createScreenState, createVfx, createWaterEffects, createWorkshopBehaviors, effectForEvent, estimateCost, explosionEffectIds, hexToLinearRgb, hexToRgb, inPuddle, lcg, lehmer, locales, lodScale, patchEffects, patchExplosions, patchSpriteKinds, patchWaterShotProfiles, planWaterBlast, planWaterShot, resolveStrings, resolveWaterBlast, resolveWaterShotProfile, slideAlong, slideInto, streamFor, updateScreen, waterShotClassOf, workshopGround };
2565
+ export { AREA_CAP_GAME, type AreaCap, type AreaCapTracker, type Behavior, type BehaviorHost, type BlastLight, type BloodMark, type Carrier, type Chunk, type ConfineMove, type ConfineResult, type Confiner, type CueRequest, DEBRIS_COLOR_VARIABLE, DEBRIS_EFFECT_FAMILIES, DUST_COLOR_VARIABLE, type DebrisEffectFamily, type DebrisObstacle, type DebrisSpawn, type Decal, type DecalOptions, type DirtMark, EVENT_BUDGET, EVENT_EFFECTS, EVENT_EFFECTS_MAP, EXPLOSIONS, EXPLOSION_ALIASES, EffectCamera, type EffectDef, EffectInstance, type EffectPlayer, type EffectPlayerOptions, EffectRunner, type EffectRunnerOptions, type EffectStep, type EffectTexts, type EffectTrack, type EffectView, Enclosures, type ExplosionCall, type ExplosionDef, type ExplosionOptions, type Fire, type FireBody, type FireLight, type FireOptions, type FireSpec, type Follow, GAME_EFFECTS, type GameEvent, type Glow, type GroundField, type GroundFieldOptions, type InstanceDeps, type InstanceSetup, type KindPoolHost, LOD_GAME, LOD_LAB, type LandListener, type LensBlob, type LightGlow, type LightPool, type LodBands, MATERIAL_EVENT_EFFECTS, type Mark, type MarkEvent, type MarkStore, type MeshParticle, MeshPool, type MeshShape, type MeshSpawn, type MushroomSpec, type MutableVec3, OrderedPool, PIECES_DRAWN_VARIABLE, PROFILES, PUFF_CUTS, PUFF_REACH, type Placement, type PlayOptions, type PostProcess, type Puddle, type Puff, type PuffCut, type Quaternion, RAIN_CAPACITY, RainField, type RandomStream, type Rgb, type Ring, type RockMark, SCRAPE_LIMIT, SMOKE_COLORS, SPRITE_KINDS, NO_CUT as SPRITE_NO_CUT, type Schedule, type ScorchMark, type ScrapeMark, type ScreenState, type SheetLabels, type Shock, type Spark, type SpriteGround, type SpriteKind, type SpriteKindDef, SpriteKindPool, SpriteKindSystem, type SpriteKindSystemOptions, type SpriteSpawn, type SpriteSpawnOptions, type SpriteSystem, VFX_LAYERS, VIEWMODEL_EFFECTS, type Vec3Like, type Vec3Tuple, type VfxEnclosure, type VfxEnclosureBox, type VfxLayer, type VfxLocale, type VfxOptions, type VfxPoolsView, type VfxProfile, type VfxProfileName, type VfxSideRequest, type VfxSolidQuery, type VfxStats, type VfxStrings, type VfxTrace, type VfxWorld, WATER_BLASTS, WATER_BLAST_KINDS, WATER_LIMITS, WATER_SHOT_BY_CALIBER, WATER_SHOT_PROFILES, WORKSHOP_BEHAVIORS, WORKSHOP_EFFECTS, WORKSHOP_PUDDLES, type WaterBlastCharge, type WaterBlastKind, type WaterBlastKindId, type WaterBlastParams, type WaterBlastPlan, type WaterBubble, type WaterColumn, type WaterDrop, type WaterEffects, type WaterEffectsLimits, type WaterEffectsOptions, type WaterEffectsStats, type WaterFoam, type WaterMist, type WaterRing, type WaterRound, type WaterShotClass, type WaterShotParams, type WaterShotPlan, type WaterShotProfile, type WaterVec3, type WaterWave, type WaterWaveSample, type WorkshopContext, WorkshopEngine, type WorkshopOptions, type WorkshopTrace, colorOfChunk, composeExplosion, createAreaCap, createEffectPlayer, createGroundField, createSchedule, createScreenState, createVfx, createWaterEffects, createWorkshopBehaviors, effectForEvent, estimateCost, explosionEffectIds, hexToLinearRgb, hexToRgb, inPuddle, lcg, lehmer, locales, lodScale, patchEffects, patchExplosions, patchSpriteKinds, patchWaterShotProfiles, planWaterBlast, planWaterShot, resolveStrings, resolveWaterBlast, resolveWaterShotProfile, slideAlong, slideInto, streamFor, updateScreen, waterShotClassOf, workshopGround };
@@ -44,12 +44,14 @@ var GameVfx = (() => {
44
44
  OrderedPool: () => OrderedPool,
45
45
  PIECES_DRAWN_VARIABLE: () => PIECES_DRAWN_VARIABLE,
46
46
  PROFILES: () => PROFILES,
47
+ PUFF_CUTS: () => PUFF_CUTS,
47
48
  PUFF_REACH: () => PUFF_REACH,
48
49
  RAIN_CAPACITY: () => RAIN_CAPACITY,
49
50
  RainField: () => RainField,
50
51
  SCRAPE_LIMIT: () => SCRAPE_LIMIT,
51
52
  SMOKE_COLORS: () => SMOKE_COLORS,
52
53
  SPRITE_KINDS: () => SPRITE_KINDS,
54
+ SPRITE_NO_CUT: () => NO_CUT,
53
55
  SpriteKindPool: () => SpriteKindPool,
54
56
  SpriteKindSystem: () => SpriteKindSystem,
55
57
  VFX_LAYERS: () => VFX_LAYERS,
@@ -1773,8 +1775,9 @@ var GameVfx = (() => {
1773
1775
  }
1774
1776
 
1775
1777
  // src/pools/puff-cuts.ts
1778
+ var PUFF_CUTS = 3;
1776
1779
  var PUFF_REACH = 1.28;
1777
- var PROBES = [{ x: 1, y: 0, z: 0 }, { x: -1, y: 0, z: 0 }, { x: 0, y: 0, z: 1 }, { x: 0, y: 0, z: -1 }, { x: 0, y: 1, z: 0 }];
1780
+ var PROBES = [Float64Array.of(1, 0, 0), Float64Array.of(-1, 0, 0), Float64Array.of(0, 0, 1), Float64Array.of(0, 0, -1), Float64Array.of(0, 1, 0)];
1778
1781
  var PROBES_PER_SECOND = 60;
1779
1782
  var FRAMES_PER_PROBE = 3;
1780
1783
  var GROUND_FACING = 0.7;
@@ -1793,41 +1796,44 @@ var GameVfx = (() => {
1793
1796
  return new KeptCut();
1794
1797
  }
1795
1798
  function clearCuts(puff3) {
1796
- puff3.cuts[0].on = false;
1797
- puff3.cuts[1].on = false;
1799
+ for (let i = 0; i < PUFF_CUTS; i++) puff3.cuts[i].on = false;
1798
1800
  }
1799
- var WrittenWay = class {
1800
- constructor() {
1801
- __publicField(this, "x", 0.5);
1802
- __publicField(this, "y", 0.5);
1803
- __publicField(this, "z", 0.5);
1804
- }
1805
- };
1806
- var WAY = new WrittenWay();
1801
+ var WAY = new Float64Array(3);
1802
+ var PASSED = 0.02;
1807
1803
  function probe(confiner, puff3, way) {
1808
- const reach = puff3.size * PUFF_REACH;
1804
+ const reach = puff3.size * (puff3.reachOfSize ?? PUFF_REACH);
1809
1805
  if (!(reach > 0)) return false;
1810
1806
  PROBE.x0 = puff3.x;
1811
1807
  PROBE.y0 = puff3.y;
1812
1808
  PROBE.z0 = puff3.z;
1813
- PROBE.x1 = puff3.x + way.x * reach;
1814
- PROBE.y1 = puff3.y + way.y * reach;
1815
- PROBE.z1 = puff3.z + way.z * reach;
1809
+ PROBE.x1 = puff3.x + way[0] * reach;
1810
+ PROBE.y1 = puff3.y + way[1] * reach;
1811
+ PROBE.z1 = puff3.z + way[2] * reach;
1812
+ PROBE.pad = 0;
1813
+ return confiner.confineMove(PROBE, 0) && confiner.out.ny <= GROUND_FACING;
1814
+ }
1815
+ function probeAgain(confiner, puff3, way) {
1816
+ const reach = puff3.size * (puff3.reachOfSize ?? PUFF_REACH);
1817
+ if (!(reach > 0)) return false;
1818
+ PROBE.x0 = puff3.x - way[0] * PASSED;
1819
+ PROBE.y0 = puff3.y - way[1] * PASSED;
1820
+ PROBE.z0 = puff3.z - way[2] * PASSED;
1821
+ PROBE.x1 = puff3.x + way[0] * reach;
1822
+ PROBE.y1 = puff3.y + way[1] * reach;
1823
+ PROBE.z1 = puff3.z + way[2] * reach;
1816
1824
  PROBE.pad = 0;
1817
1825
  return confiner.confineMove(PROBE, 0) && confiner.out.ny <= GROUND_FACING;
1818
1826
  }
1819
1827
  var isFartherFrom = (puff3, a, b) => a.nx * puff3.x + a.ny * puff3.y + a.nz * puff3.z - a.d > b.nx * puff3.x + b.ny * puff3.y + b.nz * puff3.z - b.d;
1820
- var isBehind = (puff3, face) => face.nx * puff3.x + face.ny * puff3.y + face.nz * puff3.z < face.d;
1828
+ var isBehind = (puff3, face) => face.nx * puff3.x + face.ny * puff3.y + face.nz * puff3.z < face.d - PASSED;
1821
1829
  var sameWall = (cut, face) => cut.on && cut.nx * face.nx + cut.ny * face.ny + cut.nz * face.nz > SAME_WALL;
1822
1830
  function cutFor(puff3, face) {
1823
- const first = puff3.cuts[0];
1824
- const second = puff3.cuts[1];
1825
- if (sameWall(first, face)) return first;
1826
- if (sameWall(second, face)) return second;
1827
- if (!first.on) return first;
1828
- if (!second.on) return second;
1829
- const farther = isFartherFrom(puff3, first, second) ? first : second;
1830
- return isFartherFrom(puff3, farther, face) ? farther : void 0;
1831
+ const cuts = puff3.cuts;
1832
+ for (let i = 0; i < PUFF_CUTS; i++) if (sameWall(cuts[i], face)) return cuts[i];
1833
+ for (let i = 0; i < PUFF_CUTS; i++) if (!cuts[i].on) return cuts[i];
1834
+ let farthest = cuts[0];
1835
+ for (let i = 1; i < PUFF_CUTS; i++) if (isFartherFrom(puff3, cuts[i], farthest)) farthest = cuts[i];
1836
+ return isFartherFrom(puff3, farthest, face) ? farthest : void 0;
1831
1837
  }
1832
1838
  function cutAtFace(puff3, face) {
1833
1839
  if (face.ny > GROUND_FACING) return;
@@ -1850,28 +1856,35 @@ var GameVfx = (() => {
1850
1856
  function backward(puff3) {
1851
1857
  const speed = Math.sqrt(puff3.vx * puff3.vx + puff3.vy * puff3.vy + puff3.vz * puff3.vz);
1852
1858
  if (!(speed > 0)) return null;
1853
- WAY.x = -puff3.vx / speed;
1854
- WAY.y = -puff3.vy / speed;
1855
- WAY.z = -puff3.vz / speed;
1859
+ WAY[0] = -puff3.vx / speed;
1860
+ WAY[1] = -puff3.vy / speed;
1861
+ WAY[2] = -puff3.vz / speed;
1856
1862
  return WAY;
1857
1863
  }
1858
1864
  function along(cut, sign) {
1859
- WAY.x = sign * cut.nx;
1860
- WAY.y = sign * cut.ny;
1861
- WAY.z = sign * cut.nz;
1865
+ WAY[0] = sign * cut.nx;
1866
+ WAY[1] = sign * cut.ny;
1867
+ WAY[2] = sign * cut.nz;
1862
1868
  return WAY;
1863
1869
  }
1864
1870
  function dropPassed(confiner, puff3) {
1865
- for (let i = 0; i < 2; i++) {
1871
+ for (let i = 0; i < PUFF_CUTS; i++) {
1866
1872
  const cut = puff3.cuts[i];
1867
1873
  if (!cut.on || !isBehind(puff3, cut)) continue;
1868
1874
  cut.on = false;
1875
+ const nx = cut.nx;
1876
+ const ny = cut.ny;
1877
+ const nz = cut.nz;
1869
1878
  cutAt(confiner, puff3, along(cut, 1));
1879
+ WAY[0] = -nx;
1880
+ WAY[1] = -ny;
1881
+ WAY[2] = -nz;
1882
+ cutAt(confiner, puff3, WAY);
1870
1883
  }
1871
1884
  }
1872
1885
  function keep(confiner, puff3, cut) {
1873
1886
  if (!cut.on) return;
1874
- if (!probe(confiner, puff3, along(cut, -1))) {
1887
+ if (!probeAgain(confiner, puff3, along(cut, -1))) {
1875
1888
  cut.on = false;
1876
1889
  return;
1877
1890
  }
@@ -1887,12 +1900,12 @@ var GameVfx = (() => {
1887
1900
  return;
1888
1901
  }
1889
1902
  if (turn % FRAMES_PER_PROBE !== 0) return;
1890
- const slot = turn / FRAMES_PER_PROBE % (PROBES.length + 3);
1891
- if (slot < 2) keep(confiner, puff3, puff3.cuts[slot]);
1892
- else if (slot === 2) {
1903
+ const slot = (turn / FRAMES_PER_PROBE | 0) % (PROBES.length + PUFF_CUTS + 1);
1904
+ if (slot < PUFF_CUTS) keep(confiner, puff3, puff3.cuts[slot]);
1905
+ else if (slot === PUFF_CUTS) {
1893
1906
  const back = backward(puff3);
1894
1907
  if (back) cutAt(confiner, puff3, back);
1895
- } else cutAt(confiner, puff3, PROBES[slot - 3]);
1908
+ } else cutAt(confiner, puff3, PROBES[slot - PUFF_CUTS - 1]);
1896
1909
  }
1897
1910
 
1898
1911
  // src/pools/puffs.ts
@@ -1936,7 +1949,7 @@ var GameVfx = (() => {
1936
1949
  heat: 0,
1937
1950
  size: 0,
1938
1951
  source: void 0,
1939
- cuts: [createCut(), createCut()]
1952
+ cuts: [createCut(), createCut(), createCut()]
1940
1953
  }));
1941
1954
  }
1942
1955
  function spawnPuff(pool, random, init) {
@@ -1988,7 +2001,9 @@ var GameVfx = (() => {
1988
2001
  puff3.z = ring2.z + Math.sin(puff3.ph) * radius + wind.z * ringTime * 0.6;
1989
2002
  puff3.y = centerY + minorRadius * Math.sin(theta);
1990
2003
  }
1991
- function moveFree(puff3, dt, age, heat, wind) {
2004
+ function moveFree(puff3, dt, wind) {
2005
+ const age = puff3.age;
2006
+ const heat = puff3.heat;
1992
2007
  const damping = Math.exp(-puff3.drag * dt);
1993
2008
  puff3.vx *= damping;
1994
2009
  puff3.vy *= damping;
@@ -2013,13 +2028,13 @@ var GameVfx = (() => {
2013
2028
  pool.compact(ageOrKeep2, dt);
2014
2029
  const confining = confiner !== void 0 && !confiner.empty;
2015
2030
  for (const puff3 of pool.items) {
2016
- const age = puff3.t / puff3.life;
2017
- const heat = puff3.h0 > 0 ? puff3.h0 * Math.pow(Math.max(0, 1 - puff3.t / puff3.hl), 1.25) : 0;
2031
+ puff3.age = puff3.t / puff3.life;
2032
+ puff3.heat = puff3.h0 > 0 ? puff3.h0 * Math.pow(Math.max(0, 1 - puff3.t / puff3.hl), 1.25) : 0;
2018
2033
  MOVE.x0 = puff3.x;
2019
2034
  MOVE.y0 = puff3.y;
2020
2035
  MOVE.z0 = puff3.z;
2021
2036
  if (puff3.ring) moveOnRing(puff3, puff3.ring, wind);
2022
- else moveFree(puff3, dt, age, heat, wind);
2037
+ else moveFree(puff3, dt, wind);
2023
2038
  const carried = confining && CARRIED_KINDS[puff3.kind];
2024
2039
  if (carried && confine(confiner, puff3, dt)) {
2025
2040
  const out = confiner.out;
@@ -2031,8 +2046,6 @@ var GameVfx = (() => {
2031
2046
  }
2032
2047
  const size = puff3.s0 + (puff3.s1 - puff3.s0) * (1 - Math.exp(-puff3.t * puff3.gk)) + puff3.sg * Math.min(puff3.t, GROWTH_CAP_SECONDS);
2033
2048
  puff3.size = size * Math.min(1, puff3.t * ARRIVAL_FRAME + ARRIVAL_BASE);
2034
- puff3.age = age;
2035
- puff3.heat = heat;
2036
2049
  if (carried) lookForWalls(confiner, puff3);
2037
2050
  else clearCuts(puff3);
2038
2051
  }
@@ -6593,6 +6606,23 @@ var GameVfx = (() => {
6593
6606
  var STEP = { x0: 0.5, y0: 0.5, z0: 0.5, x1: 0.5, y1: 0.5, z1: 0.5, pad: 0.5 };
6594
6607
  var GROUND_RESAMPLE = 0.1;
6595
6608
  var VELOCITY = { vx: 0.5, vy: 0.5, vz: 0.5 };
6609
+ var SPRITE_REACH = 1;
6610
+ var NO_CUT = -1e9;
6611
+ var SpriteCutView = class {
6612
+ constructor() {
6613
+ __publicField(this, "x", 0.5);
6614
+ __publicField(this, "y", 0.5);
6615
+ __publicField(this, "z", 0.5);
6616
+ __publicField(this, "vx", 0.5);
6617
+ __publicField(this, "vy", 0.5);
6618
+ __publicField(this, "vz", 0.5);
6619
+ __publicField(this, "t", 0.5);
6620
+ __publicField(this, "size", 0.5);
6621
+ __publicField(this, "reachOfSize", SPRITE_REACH);
6622
+ __publicField(this, "cuts", [createCut(), createCut(), createCut()]);
6623
+ }
6624
+ };
6625
+ var VIEW = new SpriteCutView();
6596
6626
  var clamp4 = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
6597
6627
  var lerp4 = (a, b, t) => a + (b - a) * t;
6598
6628
  function rgb(hex) {
@@ -6621,6 +6651,14 @@ var GameVfx = (() => {
6621
6651
  __publicField(this, "color");
6622
6652
  __publicField(this, "alpha");
6623
6653
  __publicField(this, "size");
6654
+ /**
6655
+ * The faces of the walls each carried sprite (smoke, steam, dust) is cut at, three of them (`PUFF_CUTS`: a corner), four numbers a sprite in each: unit normal towards the sprite and offset
6656
+ * (`n · point`), `(0, 0, 0, NO_CUT)` for none. The renderer drops the part of the drawn square behind a face: a puff against a wall flattens on it and
6657
+ * shows nothing on the wall's other side, as a puff's ball does (`Puff.cuts`).
6658
+ */
6659
+ __publicField(this, "cutA");
6660
+ __publicField(this, "cutB");
6661
+ __publicField(this, "cutC");
6624
6662
  __publicField(this, "next", 0);
6625
6663
  __publicField(this, "high", 0);
6626
6664
  __publicField(this, "velocity");
@@ -6647,6 +6685,10 @@ var GameVfx = (() => {
6647
6685
  this.color = new Float32Array(n * 3);
6648
6686
  this.alpha = new Float32Array(n);
6649
6687
  this.size = new Float32Array(n);
6688
+ this.cutA = new Float32Array(n * 4);
6689
+ this.cutB = new Float32Array(n * 4);
6690
+ this.cutC = new Float32Array(n * 4);
6691
+ for (let i = 0; i < n; i++) this.uncut(i);
6650
6692
  this.velocity = new Float32Array(n * 3);
6651
6693
  this.age = new Float32Array(n);
6652
6694
  this.life = new Float32Array(n);
@@ -6695,6 +6737,51 @@ var GameVfx = (() => {
6695
6737
  this.ground[i * 3] = Number.NaN;
6696
6738
  this.size[i] = this.size0[i];
6697
6739
  this.alpha[i] = 0;
6740
+ this.uncut(i);
6741
+ }
6742
+ /** Sprite `i` cut at no wall. */
6743
+ uncut(i) {
6744
+ this.cutA.fill(0, i * 4, i * 4 + 3);
6745
+ this.cutA[i * 4 + 3] = NO_CUT;
6746
+ this.cutB.fill(0, i * 4, i * 4 + 3);
6747
+ this.cutB[i * 4 + 3] = NO_CUT;
6748
+ this.cutC.fill(0, i * 4, i * 4 + 3);
6749
+ this.cutC[i * 4 + 3] = NO_CUT;
6750
+ }
6751
+ /**
6752
+ * Looks for the walls carried sprite `i` reaches (as a puff's ball does: `lookForWalls`), `met` the face its step was just stopped at, and keeps them in `cuts`.
6753
+ * The sprite's faces go into the reused `VIEW` and come back out: no object a sprite.
6754
+ */
6755
+ cutAtWalls(i, confiner, met) {
6756
+ const o = i * 4;
6757
+ const i3 = i * 3;
6758
+ VIEW.x = this.position[i3];
6759
+ VIEW.y = this.position[i3 + 1];
6760
+ VIEW.z = this.position[i3 + 2];
6761
+ VIEW.vx = this.velocity[i3];
6762
+ VIEW.vy = this.velocity[i3 + 1];
6763
+ VIEW.vz = this.velocity[i3 + 2];
6764
+ VIEW.t = this.age[i];
6765
+ VIEW.size = this.size[i];
6766
+ for (let k = 0; k < PUFF_CUTS; k++) {
6767
+ const cut = VIEW.cuts[k];
6768
+ const faces = k === 0 ? this.cutA : k === 1 ? this.cutB : this.cutC;
6769
+ cut.on = faces[o + 3] !== NO_CUT;
6770
+ cut.nx = faces[o];
6771
+ cut.ny = faces[o + 1];
6772
+ cut.nz = faces[o + 2];
6773
+ cut.d = faces[o + 3];
6774
+ }
6775
+ if (met) cutFrom(VIEW, met);
6776
+ lookForWalls(confiner, VIEW);
6777
+ for (let k = 0; k < PUFF_CUTS; k++) {
6778
+ const cut = VIEW.cuts[k];
6779
+ const faces = k === 0 ? this.cutA : k === 1 ? this.cutB : this.cutC;
6780
+ faces[o] = cut.on ? cut.nx : 0;
6781
+ faces[o + 1] = cut.on ? cut.ny : 0;
6782
+ faces[o + 2] = cut.on ? cut.nz : 0;
6783
+ faces[o + 3] = cut.on ? cut.d : NO_CUT;
6784
+ }
6698
6785
  }
6699
6786
  ownerIndex(name) {
6700
6787
  let index = this.owners.indexOf(name);
@@ -6785,7 +6872,9 @@ var GameVfx = (() => {
6785
6872
  let y = this.position[i3 + 1] + vy2 * dt;
6786
6873
  let z = this.position[i3 + 2] + vz2 * dt;
6787
6874
  const confiner = host.confiner;
6788
- if (def.carried && confiner && !confiner.empty) {
6875
+ const confining = def.carried && confiner !== void 0 && !confiner.empty;
6876
+ let met = false;
6877
+ if (confining) {
6789
6878
  STEP.x0 = this.position[i3];
6790
6879
  STEP.y0 = this.position[i3 + 1];
6791
6880
  STEP.z0 = this.position[i3 + 2];
@@ -6794,6 +6883,7 @@ var GameVfx = (() => {
6794
6883
  STEP.z1 = z;
6795
6884
  STEP.pad = this.size0[i] * (1 + (def.grow - 1) * t) * PAD_OF_SIZE2;
6796
6885
  if (confiner.confineMove(STEP, dt)) {
6886
+ met = true;
6797
6887
  const out = confiner.out;
6798
6888
  x = out.x;
6799
6889
  y = out.y;
@@ -6842,6 +6932,8 @@ var GameVfx = (() => {
6842
6932
  this.position[i3 + 1] = y;
6843
6933
  this.position[i3 + 2] = z;
6844
6934
  this.size[i] = this.size0[i] * lerp4(1, def.grow, t);
6935
+ if (confining) this.cutAtWalls(i, confiner, met ? confiner.out : null);
6936
+ else if (def.carried && (this.cutA[i * 4 + 3] !== NO_CUT || this.cutB[i * 4 + 3] !== NO_CUT || this.cutC[i * 4 + 3] !== NO_CUT)) this.uncut(i);
6845
6937
  this.color[i3] = lerp4(this.rgbStart[i3], this.rgbEnd[i3], t);
6846
6938
  this.color[i3 + 1] = lerp4(this.rgbStart[i3 + 1], this.rgbEnd[i3 + 1], t);
6847
6939
  this.color[i3 + 2] = lerp4(this.rgbStart[i3 + 2], this.rgbEnd[i3 + 2], t);