@adatechnology/game-destruction-three 1.2.0 → 1.3.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 +50 -1
- package/dist/index.global.js +617 -114
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +587 -88
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -331,6 +331,48 @@ interface JitWarmUpReport {
|
|
|
331
331
|
*/
|
|
332
332
|
declare const warmUpDestructionJit: (THREE: ThreeNamespace, makeRenderer: (options: RendererOptions) => DestructionRenderer, options?: JitWarmUpOptions) => JitWarmUpReport | undefined;
|
|
333
333
|
|
|
334
|
+
/**
|
|
335
|
+
* The rules of the kit that move a piece by themselves (not a shot, a blast or a contact of the engine): each write they make in a piece's velocity goes through
|
|
336
|
+
* `KitEnergyLedger.begin`/`end` with its name, so what each one gave is measured and counted (spec 021).
|
|
337
|
+
*/
|
|
338
|
+
declare const KIT_RULE: {
|
|
339
|
+
/** A piece that lost a leg and is balanced on the line between the ones left is started down over it (`renderer.ts`). */
|
|
340
|
+
readonly GO_OVER_IF_BALANCED: "goOverIfBalanced";
|
|
341
|
+
/** What stood on ground that went (a hole under a foot) is started down over the gap (`renderer.ts`). */
|
|
342
|
+
readonly CHECK_UNDERMINED: "checkUndermined";
|
|
343
|
+
/** Furniture made a piece balanced on an edge of its feet is started over it (`EDGE_NUDGE`, `renderer.ts`). */
|
|
344
|
+
readonly LOOSEN_IF_FOOTLESS: "loosenIfFootless";
|
|
345
|
+
/** A piece of the engine balanced on a narrow support is turned about its edge (`engine-pieces.ts`). */
|
|
346
|
+
readonly TOPPLE: "topple";
|
|
347
|
+
};
|
|
348
|
+
type KitRule = (typeof KIT_RULE)[keyof typeof KIT_RULE];
|
|
349
|
+
/**
|
|
350
|
+
* The resolution of the ruler, as energy height (m): below it a piece is at rest when a rule pushes it (what the rules give from there on is one episode), and a give within it of
|
|
351
|
+
* the fall is no energy made. The 1 mm of spec 008's ruler (`C1_ALLOWANCE`): the push that keeps a lying top balanced gives some thousandths of it.
|
|
352
|
+
*/
|
|
353
|
+
declare const KIT_ENERGY_RESOLUTION = 0.001;
|
|
354
|
+
/** One rule gave a piece more energy in one episode than the piece's own fall would (J). */
|
|
355
|
+
type KitEnergyOver = {
|
|
356
|
+
readonly rule: KitRule;
|
|
357
|
+
readonly objectId: string;
|
|
358
|
+
/** Kinetic energy the rule gave the piece since it was last at rest (J). */
|
|
359
|
+
readonly given: number;
|
|
360
|
+
/** Energy the piece's own weight can release from where it was (J, `fallEnergyOf`): the most a rule that only starts a fall may give. */
|
|
361
|
+
readonly fall: number;
|
|
362
|
+
};
|
|
363
|
+
/** What one rule did, over the life of the ledger. */
|
|
364
|
+
type KitRuleTally = {
|
|
365
|
+
readonly rule: KitRule;
|
|
366
|
+
/** Writes it made. */
|
|
367
|
+
readonly pushes: number;
|
|
368
|
+
/** Episodes in which it gave more than the piece's own fall. */
|
|
369
|
+
readonly overs: number;
|
|
370
|
+
/** Its largest give against the fall of the piece and the ruler's resolution (given / (fall + m g `KIT_ENERGY_RESOLUTION`); 0 before any push; over 1 is energy made). */
|
|
371
|
+
readonly worstShare: number;
|
|
372
|
+
/** The episode of that largest share. */
|
|
373
|
+
readonly worst: KitEnergyOver | null;
|
|
374
|
+
};
|
|
375
|
+
|
|
334
376
|
/**
|
|
335
377
|
* Public types of @adatechnology/game-destruction-three.
|
|
336
378
|
*
|
|
@@ -541,6 +583,11 @@ interface RendererOptions {
|
|
|
541
583
|
* own load path and are not checked.
|
|
542
584
|
*/
|
|
543
585
|
onBrokenChecked?: (objectId: string, released: boolean) => void;
|
|
586
|
+
/**
|
|
587
|
+
* A rule of the kit that moves a piece by itself (starting the fall of what lost a leg or its ground, the push over an edge: `KIT_RULE`) gave a piece more kinetic energy since it
|
|
588
|
+
* was last at rest than the piece's own fall would release: energy the kit made, which is a bug of that rule. Nothing is cut; the host logs it. `DestructionRenderer.kitEnergy` counts them.
|
|
589
|
+
*/
|
|
590
|
+
onKitEnergy?: (over: KitEnergyOver) => void;
|
|
544
591
|
/**
|
|
545
592
|
* Called when a sound should play; the host maps keys to audio (e.g. `impact_metal`, `shatter_glass`, `ignite`, `explode`). `burn_loop` is sent when a part starts to burn and `burn_end` when it burns out or is put out.
|
|
546
593
|
* An impact or a break also sends `detail.keys`, the keys to try before `key`, most specific first (`impact_concrete_ballistic`, `impact_concrete`, `impact_masonry_ballistic`, `impact_masonry`).
|
|
@@ -702,6 +749,8 @@ interface DestructionRenderer {
|
|
|
702
749
|
setHostSolids(id: string, source: (() => readonly HostSolid[]) | null): void;
|
|
703
750
|
/** Push a piece (throws, blasts). */
|
|
704
751
|
impulse(objectId: string, impulse: Vec3, point?: Vec3): void;
|
|
752
|
+
/** What each rule of the kit that moves a piece by itself (`KIT_RULE`) gave the pieces it pushed, against their own fall (see `onKitEnergy`). */
|
|
753
|
+
kitEnergy(): KitRuleTally[];
|
|
705
754
|
/** Integrate fragments, pieces and particles; apply pending visual changes. Call once per frame after `world.update`. */
|
|
706
755
|
update(dt: number): void;
|
|
707
756
|
/** With `interpolate`: the awake pieces and fragments drawn `alpha` (0 to 1) of the way from the pose before the last step to the step's. Call in the present phase; 1 draws the step's pose. */
|
|
@@ -1249,4 +1298,4 @@ declare function blastFireSampleBank(manifest: SfxManifest, options?: BlastFireS
|
|
|
1249
1298
|
/** Every particle kind the renderer can emit (the game's sprite kinds, see `@adatechnology/game-vfx`). */
|
|
1250
1299
|
type ParticleKind = SpriteKind;
|
|
1251
1300
|
|
|
1252
|
-
export { BIG_BLAST_RADIUS, BLAST_DEBRIS_DEFAULTS, BLAST_FALLOFF, BLAST_FAR_DISTANCE, BLAST_FAR_FALLOFF, BLAST_FIRE_SAMPLES, BLAST_KINDS, BLAST_KIND_OF, BLAST_RAYS_PER_FRAME, BLAST_SOUNDS, BLAST_SOUND_OF, BLAST_WAVE_PARTS_PER_FRAME, BURN_LOOP, type BindOptions, type BlastDebrisOptions, type BlastFireSampleBankOptions, type BlastFireSampleDefaults, type BlastKind, type BlastPacer, type BlastPacerOptions, type BlastWake, DEFAULT_CRACKLES, DEFAULT_FIRE, DEFAULT_INDOOR_CONFINEMENT, DESTRUCTION_SOUND_BANK, DESTRUCTION_SOUND_KEYS, DESTRUCTION_VOICE_GROUPS, DRAG_SOUNDS, type DebrisCostOptions, type DebrisCostSample, type DeferredQueueRegistration, type DestructionRenderer, type DestructionSound, type DestructionSoundOptions, type DestructionSoundStyle, EVENT_APPLY_WEIGHT, EVENT_CLASS, EXPLOSION_BOOM, type EventClass, type ExplodeOptions, type ExplosionWorkOptions, FIRE_FADE_SECONDS, FIRE_FALLOFF, FIRE_LOOP, FIRE_SOUNDS, type FarDebrisAction, type FarDebrisOptions, type FragmentLifeRule, GRENADE_PIN_PULL, GROUND_WORKER_FRAMES, type GroundPatchRead, type GroundTileJob, type GroundTileResult, type GroundWorkerPort, IMPACT_BURST_GROUP, IMPACT_FAMILY_TAGS, IMPACT_SOUNDS, IMPACT_SOUND_KEYS, type ImpactFamily, type ImpactKeys, type JitWarmUpOptions, type JitWarmUpReport, type LooseBody, type LoosenCause, MIN_PIECE_MASS_KG, type MakePieceOptions, type Mesh, type MeshRange, type Object3D, type PacedBlast, type PartHint, type ParticleKind, PhysicsOptionError, type Piece, type PiecePhysics, type Quality, ROCKET_MOTOR_LOOP, type RendererOptions, type ResolvedBlastDebris, SCENE_SOUNDS, SETTLED_BATCH_DEFAULTS, SETTLED_BATCH_ORIGIN, SMOKE_HISS_LOOP, STRUCTURAL_UNITS_PER_FRAME, SUGGESTED_MAX_AWAKE_FRAGMENTS, SUGGESTED_MAX_AWAKE_PIECES, type SettledBatchOptions, type SettledBatchStats, type SolidBox, type SoundDetail, type SoundKeyRule, type SpecFromObjectOptions, type SpecFromObjectResult, type StaticPartJob, type ThreeNamespace, WORK_UNIT_DEFAULTS, type WorkUnitCosts, bandLength, blastFireSampleBank, blastSoundIds, breakSoundKeys, computeGroundTile, createBlastPacer, createCoordinatorGroundPort, createDestructionRenderer, createDestructionSound, createInlineGroundPort, createMainThreadGroundPort, createWorkerGroundPort, dragSoundKey, eventApplyWeight, groundTilesKind, heatColor, impactFamily, impactKey, impactSoundIds, impactSoundKeys, installGroundWorker, measureStaticPart, readGroundBand, readGroundPatch, resolveBlastDebris, resolveWorkUnitCosts, ricochetSoundKeys, shotKey, specFromObject3D, splitWorkUnits, staticCollidersKind, warmUpDestructionJit };
|
|
1301
|
+
export { BIG_BLAST_RADIUS, BLAST_DEBRIS_DEFAULTS, BLAST_FALLOFF, BLAST_FAR_DISTANCE, BLAST_FAR_FALLOFF, BLAST_FIRE_SAMPLES, BLAST_KINDS, BLAST_KIND_OF, BLAST_RAYS_PER_FRAME, BLAST_SOUNDS, BLAST_SOUND_OF, BLAST_WAVE_PARTS_PER_FRAME, BURN_LOOP, type BindOptions, type BlastDebrisOptions, type BlastFireSampleBankOptions, type BlastFireSampleDefaults, type BlastKind, type BlastPacer, type BlastPacerOptions, type BlastWake, DEFAULT_CRACKLES, DEFAULT_FIRE, DEFAULT_INDOOR_CONFINEMENT, DESTRUCTION_SOUND_BANK, DESTRUCTION_SOUND_KEYS, DESTRUCTION_VOICE_GROUPS, DRAG_SOUNDS, type DebrisCostOptions, type DebrisCostSample, type DeferredQueueRegistration, type DestructionRenderer, type DestructionSound, type DestructionSoundOptions, type DestructionSoundStyle, EVENT_APPLY_WEIGHT, EVENT_CLASS, EXPLOSION_BOOM, type EventClass, type ExplodeOptions, type ExplosionWorkOptions, FIRE_FADE_SECONDS, FIRE_FALLOFF, FIRE_LOOP, FIRE_SOUNDS, type FarDebrisAction, type FarDebrisOptions, type FragmentLifeRule, GRENADE_PIN_PULL, GROUND_WORKER_FRAMES, type GroundPatchRead, type GroundTileJob, type GroundTileResult, type GroundWorkerPort, IMPACT_BURST_GROUP, IMPACT_FAMILY_TAGS, IMPACT_SOUNDS, IMPACT_SOUND_KEYS, type ImpactFamily, type ImpactKeys, type JitWarmUpOptions, type JitWarmUpReport, KIT_ENERGY_RESOLUTION, KIT_RULE, type KitEnergyOver, type KitRule, type KitRuleTally, type LooseBody, type LoosenCause, MIN_PIECE_MASS_KG, type MakePieceOptions, type Mesh, type MeshRange, type Object3D, type PacedBlast, type PartHint, type ParticleKind, PhysicsOptionError, type Piece, type PiecePhysics, type Quality, ROCKET_MOTOR_LOOP, type RendererOptions, type ResolvedBlastDebris, SCENE_SOUNDS, SETTLED_BATCH_DEFAULTS, SETTLED_BATCH_ORIGIN, SMOKE_HISS_LOOP, STRUCTURAL_UNITS_PER_FRAME, SUGGESTED_MAX_AWAKE_FRAGMENTS, SUGGESTED_MAX_AWAKE_PIECES, type SettledBatchOptions, type SettledBatchStats, type SolidBox, type SoundDetail, type SoundKeyRule, type SpecFromObjectOptions, type SpecFromObjectResult, type StaticPartJob, type ThreeNamespace, WORK_UNIT_DEFAULTS, type WorkUnitCosts, bandLength, blastFireSampleBank, blastSoundIds, breakSoundKeys, computeGroundTile, createBlastPacer, createCoordinatorGroundPort, createDestructionRenderer, createDestructionSound, createInlineGroundPort, createMainThreadGroundPort, createWorkerGroundPort, dragSoundKey, eventApplyWeight, groundTilesKind, heatColor, impactFamily, impactKey, impactSoundIds, impactSoundKeys, installGroundWorker, measureStaticPart, readGroundBand, readGroundPatch, resolveBlastDebris, resolveWorkUnitCosts, ricochetSoundKeys, shotKey, specFromObject3D, splitWorkUnits, staticCollidersKind, warmUpDestructionJit };
|