@adatechnology/game-vfx 0.7.0 → 0.8.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/dist/index.d.ts CHANGED
@@ -710,6 +710,8 @@ interface VfxCore {
710
710
  forcedLod: number | null;
711
711
  };
712
712
  groundAt(x: number, z: number): number;
713
+ /** A surface that keeps no mark here (`VfxOptions.marklessAt`). */
714
+ marklessAt?: (x: number, z: number) => boolean;
713
715
  emit(request: VfxSideRequest): void;
714
716
  }
715
717
 
@@ -1650,6 +1652,8 @@ interface VfxOptions {
1650
1652
  readonly areaCap?: AreaCap | false;
1651
1653
  /** Height of the ground for what bounces. Default: the `ground` field, else flat at 0. */
1652
1654
  readonly groundAt?: (x: number, z: number) => number;
1655
+ /** A surface that keeps no mark here (water): a blast over it leaves no crater, scorch or rim of rock. */
1656
+ readonly marklessAt?: (x: number, z: number) => boolean;
1653
1657
  /** A deformable ground the craters dig into (see `createGroundField`). */
1654
1658
  readonly ground?: GroundField;
1655
1659
  readonly wind?: Vec3Like;
@@ -1754,6 +1758,8 @@ interface VfxWorld {
1754
1758
  screen(): Readonly<ScreenState>;
1755
1759
  stats(): VfxStats;
1756
1760
  pools(): VfxPoolsView;
1761
+ /** The host's own ground height (`VfxOptions.groundAt`), or undefined when the effects land on the vfx `ground` field: what a renderer lays the scorch and dirt marks on, so they line a crater the host's terrain dug. */
1762
+ readonly hostGroundAt: ((x: number, z: number) => number) | undefined;
1757
1763
  /** The live lingering fires, oldest first. */
1758
1764
  fires(): readonly Fire[];
1759
1765
  /** Hears every mark the moment it is made, and when they are cleared. Returns the function that stops listening. */
@@ -5881,13 +5881,14 @@ var GameVfx = (() => {
5881
5881
  function composeAfterEffects(context) {
5882
5882
  const { core, def, random, x, y, z } = context;
5883
5883
  const mark = def.mark;
5884
- if (mark.crater && mark.dent && y < 1.2) {
5884
+ const keepsMarks = !core.marklessAt?.(x, z);
5885
+ if (keepsMarks && mark.crater && mark.dent && y < 1.2) {
5885
5886
  core.emit({ type: "crater", x, z, radius: mark.crater, depth: mark.dent });
5886
5887
  core.trace?.crater?.(x, z, mark.crater, mark.dent);
5887
5888
  addCrater(core.marks, core.ground, random, { x, z, radius: mark.crater, depth: mark.dent, marks: core.layers.mark });
5888
5889
  if (core.layers.shrapnel) composeRimDebris(context);
5889
5890
  }
5890
- if (mark.scorch && y < 1.2 && core.layers.mark) {
5891
+ if (keepsMarks && mark.scorch && y < 1.2 && core.layers.mark) {
5891
5892
  core.trace?.scorch?.(x, z, mark.scorch);
5892
5893
  addScorch(core.marks, random, x, z, mark.scorch);
5893
5894
  }
@@ -7682,6 +7683,7 @@ var GameVfx = (() => {
7682
7683
  spawned: { puffs: 0, sparks: 0, chunks: 0, lights: 0 },
7683
7684
  clock: { time: 0, lastBlast: -1, lod: 1, forcedLod: null },
7684
7685
  groundAt,
7686
+ ...options.marklessAt ? { marklessAt: options.marklessAt } : {},
7685
7687
  emit: (request) => options.onRequest?.(request)
7686
7688
  };
7687
7689
  function definitionOf(id) {
@@ -7708,6 +7710,7 @@ var GameVfx = (() => {
7708
7710
  return player ?? (player = createEffectPlayer({ engine: workshop(), effects, view }));
7709
7711
  }
7710
7712
  return {
7713
+ hostGroundAt: options.groundAt,
7711
7714
  play(id, point, playOptions = {}) {
7712
7715
  if (!(id in effects)) return null;
7713
7716
  const seed = playOptions.seed ?? (randomMode === "shared" ? void 0 : Math.imul(++handles.events, AUTO_SEED) + (options.seed ?? 0));