@adatechnology/game-destruction 0.9.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 +51 -1
- package/dist/index.global.js +563 -65
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +563 -65
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,28 @@ interface MaterialThermal {
|
|
|
35
35
|
/** Smoke the material gives while burning (`black` for plastic and rubber). */
|
|
36
36
|
smoke?: 'white' | 'grey' | 'black';
|
|
37
37
|
}
|
|
38
|
+
/** What one kind of blow does to a material where it lands (`MaterialDef.hits`). */
|
|
39
|
+
interface MaterialHit {
|
|
40
|
+
/**
|
|
41
|
+
* Pieces torn out at the point hit: `splinters` (solid wood, plywood: long thin pieces along the grain), `lumps` (pressed fibre such as MDF:
|
|
42
|
+
* short crumbly pieces) or `none`. A round tears them out of the exit (and one in three out of the entry), a blow out of the face it lands on.
|
|
43
|
+
*/
|
|
44
|
+
tear?: 'splinters' | 'lumps' | 'none';
|
|
45
|
+
/** Joules per torn piece (default 150). A blow weaker than one piece's worth tears nothing; a round always tears at least one. */
|
|
46
|
+
tearJoules?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Joules per kilogram of a unit (`PartSpec.units`: a brick, a block of concrete) that knock it out of its part; blows of this kind wear the unit they
|
|
49
|
+
* land on (and a little the ones around it) until one comes out (`chip`). Default `breach.chipEnergy` of the world.
|
|
50
|
+
*/
|
|
51
|
+
unitJoules?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Joules of each blow that only scar the surface and wear no unit: a small round or a fist leaves a crater in concrete and takes nothing out, a heavy
|
|
54
|
+
* round takes what it carries above this (default 0).
|
|
55
|
+
*/
|
|
56
|
+
floor?: number;
|
|
57
|
+
/** The blow leaves a crater in the bare surface of the material (a `spall` with `layer` -1) where it lands, with its dust and chips. */
|
|
58
|
+
crater?: boolean;
|
|
59
|
+
}
|
|
38
60
|
interface MaterialDef {
|
|
39
61
|
id: MaterialId;
|
|
40
62
|
/** Density in kg/m³ (used when a part has no `mass`). */
|
|
@@ -67,6 +89,11 @@ interface MaterialDef {
|
|
|
67
89
|
* a ream, a magazine) and comes apart as thin loose scraps (`Fragment.inner` for the pages) instead of slabs as thick as the part.
|
|
68
90
|
*/
|
|
69
91
|
sheet?: number;
|
|
92
|
+
/**
|
|
93
|
+
* What a blow of each damage type takes out of the material where it lands (the same blow does different things to different materials, and a shot
|
|
94
|
+
* is not a punch). See `MaterialHit`.
|
|
95
|
+
*/
|
|
96
|
+
hits?: Partial<Record<DamageType, MaterialHit>>;
|
|
70
97
|
/** Damage multipliers per damage type (default 1); `shelter` multiplies the resistance the material adds between a blast and a target (`blast.shelter`). */
|
|
71
98
|
damageScale?: Partial<Record<DamageType | 'shelter', number>>;
|
|
72
99
|
/** Debris emitted on a hit that does not break the part. */
|
|
@@ -336,6 +363,12 @@ interface DestructionOptions {
|
|
|
336
363
|
radius?: number;
|
|
337
364
|
/** Multiplier of the breach area a blast makes over a blow of the same damage: a blast loads the whole crater (default 6). */
|
|
338
365
|
blastFactor?: number;
|
|
366
|
+
/**
|
|
367
|
+
* Joules per kilogram of a unit (`PartSpec.units`: a brick, a block) that knock it out of its wall: shots and blows wear the unit they land on and
|
|
368
|
+
* a little the ones around it, and a unit that took this much comes out (`chip` event). Default 200 (a 4 kg brick: two 9 mm rounds, one
|
|
369
|
+
* rifle round); 0 turns it off.
|
|
370
|
+
*/
|
|
371
|
+
chipEnergy?: number;
|
|
339
372
|
};
|
|
340
373
|
/**
|
|
341
374
|
* Speed of the blast front in m/s. A glass part at distance `d` from an explosion breaks `d / blastFrontSpeed` seconds later, in `update`
|
|
@@ -421,6 +454,17 @@ interface DestructionWorld {
|
|
|
421
454
|
explode(point: Vec3, energy: number, radius: number, source?: string, options?: BlastOptions): HitResult[];
|
|
422
455
|
/** Raycast against every part shape (world space). */
|
|
423
456
|
raycast(origin: Vec3, direction: Vec3, maxDistance?: number): RayHit | null;
|
|
457
|
+
/**
|
|
458
|
+
* The first thing a world-axis box meets moving `distance` metres along `direction`, or null: a grid of rays leaves its leading faces, no gap wider than `spacing`
|
|
459
|
+
* (default 0.2 m). `ignore` is the object that is moving. What the box already overlaps does not stop it, so it can always back out.
|
|
460
|
+
*/
|
|
461
|
+
sweepBox(box: {
|
|
462
|
+
readonly min: Vec3;
|
|
463
|
+
readonly max: Vec3;
|
|
464
|
+
}, direction: Vec3, distance: number, options?: {
|
|
465
|
+
readonly ignore?: string;
|
|
466
|
+
readonly spacing?: number;
|
|
467
|
+
}): RayHit | null;
|
|
424
468
|
/** Ballistic shot: raycast, hit, and continue through with the exit energy (up to 4 objects/parts). */
|
|
425
469
|
shoot(origin: Vec3, direction: Vec3, energy: number, caliber: number, source?: string, round?: number | BallisticExtras): HitResult[];
|
|
426
470
|
/**
|
|
@@ -504,8 +548,14 @@ interface PartRuntime {
|
|
|
504
548
|
spalls?: Array<[number, number, number, number, number, number]>;
|
|
505
549
|
/** Through damage so far: `[x, y, z, area]` in object space, newest last. */
|
|
506
550
|
breach?: Array<[number, number, number, number]>;
|
|
551
|
+
/** Energy each unit of the part took so far (`breach.chipEnergy`), by its index in the unit grid; -1 when the unit came out. */
|
|
552
|
+
chips?: Record<number, number>;
|
|
507
553
|
/** Mass in kg that left the part in a breach. */
|
|
508
554
|
removed?: number;
|
|
555
|
+
/** Damage taken by each band across a long wooden part (`splinter`), by band index from its negative end: the band that runs out breaks it there. */
|
|
556
|
+
cuts?: Record<number, number>;
|
|
557
|
+
/** Where along its long axis (part space) the part broke across (`cuts`). */
|
|
558
|
+
cutAt?: number;
|
|
509
559
|
/** Plastic rotation in radians a reinforced beam or slab took in bending (blasts add it up; `flexure.failRotationDeg` breaks it). */
|
|
510
560
|
hinge?: number;
|
|
511
561
|
}
|
|
@@ -1304,4 +1354,4 @@ declare const tensionCapacity: (dims: Vec3, o: {
|
|
|
1304
1354
|
tensileMPa?: number;
|
|
1305
1355
|
}) => number;
|
|
1306
1356
|
|
|
1307
|
-
export { ASSEMBLIES, type AddOptions, type AssemblyDef, type AssemblyPartOptions, type BearingWallOptions, type BendGeometry, type BendSection, CONFINEMENT_DEFAULTS, type ChainTrigger, type CheckOptions, type DestructionLocale, type DestructionOptions, type DestructionSnapshot, type DestructionStrings, type DestructionWorld, type ExplosivePartOptions, FIRE_PRIME_C, FLEXURE_DEFAULTS, FRAGMENT_HIT_DEFAULTS, type FlexureOptions, type FoundationSolve, type FrameOptions, GRAVITY, type Gust, JOINT_BY_MATERIALS, JOINT_DEFAULTS, MASONRY_DEFAULTS, MATERIALS, type MasonryOptions, type MaterialDef, type MaterialStrength, type MaterialThermal, type ObjectRuntime, type PartRuntime, type ResolvedWind, SHELTER_DEFAULTS, SOILS, SOIL_DEFAULTS, type SectionMoments, type SizeStructureOptions, type SoilDef, type SoilKind, type SoilOptions, type SoilSpring, type SwayState, type SwaySystem, type TensionSteel, WIND_DEFAULTS, WIND_TERRAIN, type WallFrameSolution, type WindAnalysis, type WindCase, type WindOptions, type WindPartInput, type WindTerrainDef, type WorldExplosive, analyzeWind, assemblyDepth, assemblyPart, bearingWallThickness, bendGeometry, blastImpulse, buildFrame, checkDestructible, crackingMoment, createDestruction, damperAmplification, damperTuning, elasticEnergy, explosivePart, exposureOf, footingArea, footingSoil, fragility, getAssembly, guessMaterial, gustAt, heightFactor, impulseEnergy, inferJoints, layersBetween, locales, makeGust, meanHeightFactor, momentNodes, momentOfEnergy, partCapacity, partMass, partThickness, partVolume, pileCapacity, pileLength, pileStiffness, profileOf, quat, quatFromEuler, registerAssembly, resolveStrings, resolveWind, rotateVec, sectionMoments, shapeAt, shearNodes, sizeRebar, sizeStructure, slendernessFactor, soilAt, solveFoundation, solveWallFrame, spanMoment, spanOf, steelMoment, stepSway, stiffnessCentre, subgradeModulus, tBeamInertia, tensionCapacity, tensionSteel, toLocal, toWorld, turbulenceIntensity, vec, windClass, windPressure };
|
|
1357
|
+
export { ASSEMBLIES, type AddOptions, type AssemblyDef, type AssemblyPartOptions, type BearingWallOptions, type BendGeometry, type BendSection, CONFINEMENT_DEFAULTS, type ChainTrigger, type CheckOptions, type DestructionLocale, type DestructionOptions, type DestructionSnapshot, type DestructionStrings, type DestructionWorld, type ExplosivePartOptions, FIRE_PRIME_C, FLEXURE_DEFAULTS, FRAGMENT_HIT_DEFAULTS, type FlexureOptions, type FoundationSolve, type FrameOptions, GRAVITY, type Gust, JOINT_BY_MATERIALS, JOINT_DEFAULTS, MASONRY_DEFAULTS, MATERIALS, type MasonryOptions, type MaterialDef, type MaterialHit, type MaterialStrength, type MaterialThermal, type ObjectRuntime, type PartRuntime, type ResolvedWind, SHELTER_DEFAULTS, SOILS, SOIL_DEFAULTS, type SectionMoments, type SizeStructureOptions, type SoilDef, type SoilKind, type SoilOptions, type SoilSpring, type SwayState, type SwaySystem, type TensionSteel, WIND_DEFAULTS, WIND_TERRAIN, type WallFrameSolution, type WindAnalysis, type WindCase, type WindOptions, type WindPartInput, type WindTerrainDef, type WorldExplosive, analyzeWind, assemblyDepth, assemblyPart, bearingWallThickness, bendGeometry, blastImpulse, buildFrame, checkDestructible, crackingMoment, createDestruction, damperAmplification, damperTuning, elasticEnergy, explosivePart, exposureOf, footingArea, footingSoil, fragility, getAssembly, guessMaterial, gustAt, heightFactor, impulseEnergy, inferJoints, layersBetween, locales, makeGust, meanHeightFactor, momentNodes, momentOfEnergy, partCapacity, partMass, partThickness, partVolume, pileCapacity, pileLength, pileStiffness, profileOf, quat, quatFromEuler, registerAssembly, resolveStrings, resolveWind, rotateVec, sectionMoments, shapeAt, shearNodes, sizeRebar, sizeStructure, slendernessFactor, soilAt, solveFoundation, solveWallFrame, spanMoment, spanOf, steelMoment, stepSway, stiffnessCentre, subgradeModulus, tBeamInertia, tensionCapacity, tensionSteel, toLocal, toWorld, turbulenceIntensity, vec, windClass, windPressure };
|