@adatechnology/game-destruction 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 +39 -1
- package/dist/index.global.js +382 -29
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +382 -29
- 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. */
|
|
@@ -427,6 +454,17 @@ interface DestructionWorld {
|
|
|
427
454
|
explode(point: Vec3, energy: number, radius: number, source?: string, options?: BlastOptions): HitResult[];
|
|
428
455
|
/** Raycast against every part shape (world space). */
|
|
429
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;
|
|
430
468
|
/** Ballistic shot: raycast, hit, and continue through with the exit energy (up to 4 objects/parts). */
|
|
431
469
|
shoot(origin: Vec3, direction: Vec3, energy: number, caliber: number, source?: string, round?: number | BallisticExtras): HitResult[];
|
|
432
470
|
/**
|
|
@@ -1316,4 +1354,4 @@ declare const tensionCapacity: (dims: Vec3, o: {
|
|
|
1316
1354
|
tensileMPa?: number;
|
|
1317
1355
|
}) => number;
|
|
1318
1356
|
|
|
1319
|
-
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 };
|