@adatechnology/game-vfx 0.7.0 → 0.9.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 +10 -0
- package/dist/index.global.js +6 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -710,6 +710,10 @@ 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;
|
|
715
|
+
/** Ground a blast opens a dirt crater in (`VfxOptions.cratersAt`). */
|
|
716
|
+
cratersAt?: (x: number, z: number) => boolean;
|
|
713
717
|
emit(request: VfxSideRequest): void;
|
|
714
718
|
}
|
|
715
719
|
|
|
@@ -1650,6 +1654,10 @@ interface VfxOptions {
|
|
|
1650
1654
|
readonly areaCap?: AreaCap | false;
|
|
1651
1655
|
/** Height of the ground for what bounces. Default: the `ground` field, else flat at 0. */
|
|
1652
1656
|
readonly groundAt?: (x: number, z: number) => number;
|
|
1657
|
+
/** A surface that keeps no mark here (water): a blast over it leaves no crater, scorch or rim of rock. */
|
|
1658
|
+
readonly marklessAt?: (x: number, z: number) => boolean;
|
|
1659
|
+
/** Ground a blast opens a dirt crater in (soil, sand, snow). Where it answers false (rock, asphalt, a slab) a blast leaves only soot. Default everywhere. */
|
|
1660
|
+
readonly cratersAt?: (x: number, z: number) => boolean;
|
|
1653
1661
|
/** A deformable ground the craters dig into (see `createGroundField`). */
|
|
1654
1662
|
readonly ground?: GroundField;
|
|
1655
1663
|
readonly wind?: Vec3Like;
|
|
@@ -1754,6 +1762,8 @@ interface VfxWorld {
|
|
|
1754
1762
|
screen(): Readonly<ScreenState>;
|
|
1755
1763
|
stats(): VfxStats;
|
|
1756
1764
|
pools(): VfxPoolsView;
|
|
1765
|
+
/** 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. */
|
|
1766
|
+
readonly hostGroundAt: ((x: number, z: number) => number) | undefined;
|
|
1757
1767
|
/** The live lingering fires, oldest first. */
|
|
1758
1768
|
fires(): readonly Fire[];
|
|
1759
1769
|
/** Hears every mark the moment it is made, and when they are cleared. Returns the function that stops listening. */
|
package/dist/index.global.js
CHANGED
|
@@ -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
|
-
|
|
5884
|
+
const keepsMarks = !core.marklessAt?.(x, z);
|
|
5885
|
+
if (keepsMarks && mark.crater && mark.dent && y < 1.2 && (core.cratersAt?.(x, z) ?? true)) {
|
|
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,8 @@ 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 } : {},
|
|
7687
|
+
...options.cratersAt ? { cratersAt: options.cratersAt } : {},
|
|
7685
7688
|
emit: (request) => options.onRequest?.(request)
|
|
7686
7689
|
};
|
|
7687
7690
|
function definitionOf(id) {
|
|
@@ -7708,6 +7711,7 @@ var GameVfx = (() => {
|
|
|
7708
7711
|
return player ?? (player = createEffectPlayer({ engine: workshop(), effects, view }));
|
|
7709
7712
|
}
|
|
7710
7713
|
return {
|
|
7714
|
+
hostGroundAt: options.groundAt,
|
|
7711
7715
|
play(id, point, playOptions = {}) {
|
|
7712
7716
|
if (!(id in effects)) return null;
|
|
7713
7717
|
const seed = playOptions.seed ?? (randomMode === "shared" ? void 0 : Math.imul(++handles.events, AUTO_SEED) + (options.seed ?? 0));
|