@adatechnology/game-vfx 0.10.0 → 0.11.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
@@ -397,7 +397,20 @@ interface BloodMark {
397
397
  readonly scaleZ: number;
398
398
  readonly rotation: number;
399
399
  }
400
- type Mark = ScorchMark | DirtMark | RockMark | BloodMark;
400
+ /** A scratch a dragged piece leaves on the floor (`VfxWorld.scrape`): a thin strip along the drag, lighter or darker than the floor. */
401
+ interface ScrapeMark {
402
+ readonly kind: 'scrape';
403
+ /** Middle of the strip, on the floor. */
404
+ readonly x: number;
405
+ readonly y: number;
406
+ readonly z: number;
407
+ readonly length: number;
408
+ readonly width: number;
409
+ /** Turn of the strip about the vertical: 0 runs along +x. */
410
+ readonly rotation: number;
411
+ readonly color: number;
412
+ }
413
+ type Mark = ScorchMark | DirtMark | RockMark | BloodMark | ScrapeMark;
401
414
  type MarkEvent = {
402
415
  readonly type: 'add';
403
416
  readonly mark: Mark;
@@ -409,6 +422,7 @@ interface MarkStore {
409
422
  /** Goes up on every mark added or cleared. */
410
423
  readonly version: number;
411
424
  readonly bloodCount: number;
425
+ readonly scrapeCount: number;
412
426
  /** The counter that lifts each decal a hair higher than the last (the Lab's `decalY`). */
413
427
  lift: number;
414
428
  add(mark: Mark): void;
@@ -416,6 +430,8 @@ interface MarkStore {
416
430
  /** Tells a renderer the moment a mark is made (the ground it conforms to is the ground of that moment) or taken away. */
417
431
  subscribe(listener: (event: MarkEvent) => void): () => void;
418
432
  }
433
+ /** Scratches kept on the floor; past it the oldest goes, so dragging furniture all day costs no more than this. */
434
+ declare const SCRAPE_LIMIT = 400;
419
435
 
420
436
  /** The position a glow follows (a chunk, or anything with `x`, `y`, `z`). */
421
437
  interface FollowPoint {
@@ -1768,6 +1784,8 @@ interface VfxWorld {
1768
1784
  fires(): readonly Fire[];
1769
1785
  /** Hears every mark the moment it is made, and when they are cleared. Returns the function that stops listening. */
1770
1786
  onMarks(listener: (event: MarkEvent) => void): () => void;
1787
+ /** Scratches the floor where a piece was dragged (`ScrapeMark`): it stays, the oldest going past `SCRAPE_LIMIT`. */
1788
+ scrape(mark: Omit<ScrapeMark, 'kind'>): void;
1771
1789
  /** Seconds the world has run since it was created or cleared. */
1772
1790
  time(): number;
1773
1791
  /** The state of the shared stream (`randomMode: 'shared'`): what a golden compares after a run. */
@@ -1971,4 +1989,4 @@ declare const SMOKE_COLORS: {
1971
1989
  readonly gas: Rgb;
1972
1990
  };
1973
1991
 
1974
- export { AREA_CAP_GAME, type AreaCap, type AreaCapTracker, type Behavior, type BehaviorHost, type BlastLight, type BloodMark, type Chunk, type ConfineResult, type Confiner, type CueRequest, 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 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, 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, SMOKE_COLORS, SPRITE_KINDS, type Schedule, type ScorchMark, 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, WORKSHOP_BEHAVIORS, WORKSHOP_EFFECTS, WORKSHOP_PUDDLES, type WorkshopContext, WorkshopEngine, type WorkshopOptions, type WorkshopTrace, colorOfChunk, composeExplosion, createAreaCap, createEffectPlayer, createGroundField, createSchedule, createScreenState, createVfx, createWorkshopBehaviors, effectForEvent, estimateCost, hexToLinearRgb, hexToRgb, inPuddle, lcg, lehmer, locales, lodScale, patchEffects, patchExplosions, patchSpriteKinds, resolveStrings, slideAlong, streamFor, updateScreen, workshopGround };
1992
+ export { AREA_CAP_GAME, type AreaCap, type AreaCapTracker, type Behavior, type BehaviorHost, type BlastLight, type BloodMark, type Chunk, type ConfineResult, type Confiner, type CueRequest, 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 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, 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, WORKSHOP_BEHAVIORS, WORKSHOP_EFFECTS, WORKSHOP_PUDDLES, type WorkshopContext, WorkshopEngine, type WorkshopOptions, type WorkshopTrace, colorOfChunk, composeExplosion, createAreaCap, createEffectPlayer, createGroundField, createSchedule, createScreenState, createVfx, createWorkshopBehaviors, effectForEvent, estimateCost, hexToLinearRgb, hexToRgb, inPuddle, lcg, lehmer, locales, lodScale, patchEffects, patchExplosions, patchSpriteKinds, resolveStrings, slideAlong, streamFor, updateScreen, workshopGround };
@@ -41,6 +41,7 @@ var GameVfx = (() => {
41
41
  PROFILES: () => PROFILES,
42
42
  RAIN_CAPACITY: () => RAIN_CAPACITY,
43
43
  RainField: () => RainField,
44
+ SCRAPE_LIMIT: () => SCRAPE_LIMIT,
44
45
  SMOKE_COLORS: () => SMOKE_COLORS,
45
46
  SPRITE_KINDS: () => SPRITE_KINDS,
46
47
  SpriteKindPool: () => SpriteKindPool,
@@ -5411,12 +5412,14 @@ var GameVfx = (() => {
5411
5412
 
5412
5413
  // src/marks.ts
5413
5414
  var BLOOD_LIMIT = 450;
5415
+ var SCRAPE_LIMIT = 400;
5414
5416
  var SCORCH_VARIANTS = 3;
5415
5417
  var RIM_COLORS = [2829359, 3815478];
5416
5418
  function createMarkStore() {
5417
5419
  const entries = [];
5418
5420
  let version = 0;
5419
5421
  let bloodCount = 0;
5422
+ let scrapeCount = 0;
5420
5423
  const listeners = /* @__PURE__ */ new Set();
5421
5424
  return {
5422
5425
  entries,
@@ -5426,16 +5429,25 @@ var GameVfx = (() => {
5426
5429
  get bloodCount() {
5427
5430
  return bloodCount;
5428
5431
  },
5432
+ get scrapeCount() {
5433
+ return scrapeCount;
5434
+ },
5429
5435
  lift: 0,
5430
5436
  add(mark) {
5437
+ if (mark.kind === "scrape" && scrapeCount >= SCRAPE_LIMIT) {
5438
+ entries.splice(entries.findIndex((m) => m.kind === "scrape"), 1);
5439
+ scrapeCount--;
5440
+ }
5431
5441
  entries.push(mark);
5432
5442
  if (mark.kind === "blood") bloodCount++;
5443
+ if (mark.kind === "scrape") scrapeCount++;
5433
5444
  version++;
5434
5445
  for (const listener of listeners) listener({ type: "add", mark });
5435
5446
  },
5436
5447
  clear() {
5437
5448
  entries.length = 0;
5438
5449
  bloodCount = 0;
5450
+ scrapeCount = 0;
5439
5451
  this.lift = 0;
5440
5452
  version++;
5441
5453
  for (const listener of listeners) listener({ type: "clear" });
@@ -5495,6 +5507,9 @@ var GameVfx = (() => {
5495
5507
  const scaleZ = spec.radius * random.between(1.2, 2);
5496
5508
  store.add({ kind: "blood", x: spec.x, y, z: spec.z, scaleX, scaleZ, rotation: random.next() * 6 });
5497
5509
  }
5510
+ function addScrape(store, spec) {
5511
+ store.add({ kind: "scrape", ...spec, y: spec.y + 2e-3 + nextLift(store) * 2e-4 });
5512
+ }
5498
5513
 
5499
5514
  // src/pools/rings.ts
5500
5515
  function createRingPool(capacity) {
@@ -6345,8 +6360,8 @@ var GameVfx = (() => {
6345
6360
  id: "dust",
6346
6361
  additive: false,
6347
6362
  life: [
6348
- 1,
6349
- 2
6363
+ 2,
6364
+ 5
6350
6365
  ],
6351
6366
  size: [
6352
6367
  0.08,
@@ -6413,8 +6428,8 @@ var GameVfx = (() => {
6413
6428
  id: "chips",
6414
6429
  additive: false,
6415
6430
  life: [
6416
- 0.8,
6417
- 1.5
6431
+ 2,
6432
+ 4
6418
6433
  ],
6419
6434
  size: [
6420
6435
  0.025,
@@ -7843,6 +7858,7 @@ var GameVfx = (() => {
7843
7858
  }),
7844
7859
  fires: () => core.fires.items,
7845
7860
  onMarks: (listener) => core.marks.subscribe(listener),
7861
+ scrape: (mark) => addScrape(core.marks, mark),
7846
7862
  time: () => core.clock.time,
7847
7863
  randomState: () => sharedRandom.state,
7848
7864
  clear() {