@adatechnology/game-vfx 0.15.0 → 0.17.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
@@ -20,6 +20,17 @@ type Follow = {
20
20
  readonly z: number;
21
21
  };
22
22
  };
23
+ /**
24
+ * A burning body a fire follows (`FireOptions.follow`): its base centre (`x`, `y` the bottom, `z`), its half width and its height, all read every frame. The fire
25
+ * keeps the body's size as it burns away or falls apart: flames leave the whole of its height, not a layer at its foot, and the smoke rises off its top.
26
+ */
27
+ interface FireBody {
28
+ readonly x: number;
29
+ readonly y: number;
30
+ readonly z: number;
31
+ readonly radius: number;
32
+ readonly height: number;
33
+ }
23
34
  /** A residual fire left behind by an explosion (L798 `residual`), or started by `world.fire`. */
24
35
  interface FireSpec {
25
36
  /** Offsets from the blast point. */
@@ -268,6 +279,8 @@ interface Fire {
268
279
  y: number;
269
280
  z: number;
270
281
  r: number;
282
+ /** Height of what burns (m): the flames leave the whole of it, from `y` to `y + h`, and the smoke rises off its top. 0 is a flat fire (a pool, a patch of ground). */
283
+ h: number;
271
284
  r0: number;
272
285
  grow: number;
273
286
  life: number;
@@ -277,7 +290,7 @@ interface Fire {
277
290
  smoke: number;
278
291
  smokeAcc: number;
279
292
  fade: number;
280
- follow: Follow | null;
293
+ follow: Follow | FireBody | null;
281
294
  fx: number;
282
295
  fy: number;
283
296
  fz: number;
@@ -540,8 +553,20 @@ interface Confiner {
540
553
  * walls (a puff is a ball, not a point: its middle stops before its edge goes through the glass).
541
554
  */
542
555
  confine(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, pad: number, dt: number): boolean;
556
+ /** `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. */
557
+ confineMove(move: ConfineMove, dt: number): boolean;
543
558
  readonly out: ConfineResult;
544
559
  }
560
+ /** One particle's step for {@link Confiner.confineMove}: from `(x0, y0, z0)` to `(x1, y1, z1)`, kept `pad` metres off the walls. */
561
+ interface ConfineMove {
562
+ x0: number;
563
+ y0: number;
564
+ z0: number;
565
+ x1: number;
566
+ y1: number;
567
+ z1: number;
568
+ pad: number;
569
+ }
545
570
  /**
546
571
  * The closed spaces of a world by id. Each step of a carried particle that would cross a wall is tested: through an opening it passes (a hole only at
547
572
  * its rate), through a closed wall only at the leak; otherwise it stays on its side, put back on the wall and sliding along it.
@@ -554,6 +579,8 @@ declare class Enclosures implements Confiner {
554
579
  private readonly l0;
555
580
  private readonly l1;
556
581
  private readonly q;
582
+ private readonly h;
583
+ private readonly move;
557
584
  constructor(seed?: number);
558
585
  get empty(): boolean;
559
586
  get size(): number;
@@ -570,7 +597,14 @@ declare class Enclosures implements Confiner {
570
597
  /** The opening the wall point `q` (local) is in lets it through now. */
571
598
  private through;
572
599
  confine(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, pad: number, dt: number): boolean;
600
+ confineMove(move: ConfineMove, dt: number): boolean;
573
601
  }
602
+ /** {@link slideAlong} written back into the particle's own velocity, nothing allocated. */
603
+ declare function slideInto(out: ConfineResult, velocity: {
604
+ vx: number;
605
+ vy: number;
606
+ vz: number;
607
+ }): void;
574
608
  /** Takes the part of a velocity that runs into the wall away (what is left slides along it). */
575
609
  declare function slideAlong(out: ConfineResult, vx: number, vy: number, vz: number): [number, number, number];
576
610
 
@@ -861,6 +895,22 @@ interface WorkshopContext {
861
895
  readonly trace: WorkshopTrace | undefined;
862
896
  /** The closed spaces the carried sprites (smoke, dust, steam) do not cross; absent: none. */
863
897
  readonly confiner?: Confiner;
898
+ /**
899
+ * The debris pieces touch what is round them (the host turned it on, `WorkshopEngine.setDebrisContacts`): they pile on the pieces at rest under them and
900
+ * do not go through `obstacles` (the player), which push them. Absent: they only bounce on the ground, as the Workshop page (its recording) does.
901
+ */
902
+ debrisContacts?: {
903
+ readonly obstacles: () => readonly DebrisObstacle[];
904
+ };
905
+ }
906
+ /** An upright body the debris pieces stop against and are pushed off by (a person standing): a vertical cylinder. */
907
+ interface DebrisObstacle {
908
+ readonly x: number;
909
+ readonly z: number;
910
+ /** Height of its foot and of its top, metres. */
911
+ readonly bottom: number;
912
+ readonly top: number;
913
+ readonly radius: number;
864
914
  }
865
915
 
866
916
  /** A unit quaternion `[x, y, z, w]`. */
@@ -908,6 +958,7 @@ declare class DebrisPool {
908
958
  count: number;
909
959
  private next;
910
960
  private readonly direction;
961
+ private readonly resting;
911
962
  constructor(context: WorkshopContext);
912
963
  spawn(options: DebrisSpawn): void;
913
964
  clear(): void;
@@ -979,6 +1030,8 @@ declare class RainField {
979
1030
  puddles: readonly Puddle[];
980
1031
  /** Replaces the puddle test (a game knows its own wet spots). */
981
1032
  puddleAt: ((x: number, z: number) => boolean) | undefined;
1033
+ /** Top (world y) of the roof or slab over (x, z), `undefined` for open sky: a streak that falls under it is gone, with no splash and no ring. Unset: nothing is roofed. */
1034
+ coverTopAt: ((x: number, z: number) => number | undefined) | undefined;
982
1035
  constructor(engine: WorkshopEngine);
983
1036
  /** `initRain` (W321): `count` streaks (thinned by the quality), each drawn at a random place in the box. */
984
1037
  init(count: number, wind: number): void;
@@ -991,6 +1044,7 @@ declare class RainField {
991
1044
  update(dt: number, splash: boolean, camera: Vec3Tuple): void;
992
1045
  /** `rain.visible = false; RN.on = false` (W440): the field stops; the streaks stay where they were. */
993
1046
  clear(): void;
1047
+ private restart;
994
1048
  private set;
995
1049
  }
996
1050
 
@@ -1251,6 +1305,11 @@ declare class WorkshopEngine {
1251
1305
  placement: Placement | undefined;
1252
1306
  private readonly accumulators;
1253
1307
  constructor(options: WorkshopOptions);
1308
+ /**
1309
+ * Turns on the touch of the debris pieces (a game's world; the Workshop page's recording has none): they pile on the pieces at rest under them, and the
1310
+ * upright bodies `obstacles` answers (the player, asked once a frame while a piece moves) stop them and push them. `null` turns it off.
1311
+ */
1312
+ setDebrisContacts(obstacles: (() => readonly DebrisObstacle[]) | null): void;
1254
1313
  get random(): RandomStream;
1255
1314
  get quality(): number;
1256
1315
  setQuality(level: number): void;
@@ -1779,6 +1838,8 @@ interface ExplosionOptions {
1779
1838
  interface FireOptions {
1780
1839
  readonly point: Vec3Like;
1781
1840
  readonly radius: number;
1841
+ /** Height of what burns (m, default 0): flames leave the whole of it and the smoke rises off its top. A `FireBody` to `follow` sets it every frame. */
1842
+ readonly height?: number;
1782
1843
  readonly life: number;
1783
1844
  /** Flames per second per square-ish metre (the Lab's `rate`, default 22) and smoke puffs (default .6). */
1784
1845
  readonly rate?: number;
@@ -1788,8 +1849,8 @@ interface FireOptions {
1788
1849
  readonly grow?: number;
1789
1850
  /** `0xRRGGBB` of the smoke (default soot black). */
1790
1851
  readonly smokeColor?: number;
1791
- /** Moves with a thing (a burning part): the fire sits at its position plus `offset`. */
1792
- readonly follow?: Follow;
1852
+ /** Moves with a thing (a burning part): the fire sits at its position plus `offset`; a `FireBody` also gives it its radius and height every frame. */
1853
+ readonly follow?: Follow | FireBody;
1793
1854
  readonly offset?: Vec3Like;
1794
1855
  readonly seed?: number;
1795
1856
  /** The thing that burns (a world object's id): `clearSource` puts the fire out and takes away the flames, smoke and embers it gave off. */
@@ -1920,6 +1981,12 @@ type DebrisEffectFamily = (typeof DEBRIS_EFFECT_FAMILIES)[number];
1920
1981
  /** The variables a host sets (`PlayOptions.values`) to draw the debris and the dust in the colour of the material that broke. */
1921
1982
  declare const DEBRIS_COLOR_VARIABLE = "debrisColor";
1922
1983
  declare const DUST_COLOR_VARIABLE = "dustColor";
1984
+ /**
1985
+ * Set (to 1) by a host that draws the pieces of what broke itself (the destruction renderer: its fragments and the loose parts in physics): the breach and
1986
+ * collapse effects then raise only their dust, without the stand-in blocks they throw for a scene that has none, which would lie beside the real pieces
1987
+ * at a size and shape the material does not break into.
1988
+ */
1989
+ declare const PIECES_DRAWN_VARIABLE = "piecesDrawn";
1923
1990
  /** The stage, breach and collapse effects of every family, and the rebar laid bare. */
1924
1991
  declare const MATERIAL_EVENT_EFFECTS: readonly EffectDef[];
1925
1992
 
@@ -2435,4 +2502,4 @@ declare function resolveWaterShotProfile(profile: string | WaterShotProfile, tab
2435
2502
  /** Changes a profile table without touching the kit's: `null` removes an entry, a partial entry is merged over the old one. */
2436
2503
  declare function patchWaterShotProfiles(base: Readonly<Record<string, WaterShotProfile>>, changes: Readonly<Record<string, Partial<WaterShotProfile> | null>>): Record<string, WaterShotProfile>;
2437
2504
 
2438
- export { AREA_CAP_GAME, type AreaCap, type AreaCapTracker, type Behavior, type BehaviorHost, type BlastLight, type BloodMark, type Carrier, type Chunk, type ConfineResult, type Confiner, type CueRequest, DEBRIS_COLOR_VARIABLE, DEBRIS_EFFECT_FAMILIES, DUST_COLOR_VARIABLE, type DebrisEffectFamily, 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 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, PROFILES, type Placement, type PlayOptions, type PostProcess, type Puddle, type Puff, 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 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, streamFor, updateScreen, waterShotClassOf, workshopGround };
2505
+ 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, type Placement, type PlayOptions, type PostProcess, type Puddle, type Puff, 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 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 };