@adatechnology/game-vehicles 0.6.17 → 0.6.19
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 +112 -7
- package/dist/index.global.js +574 -133
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +461 -133
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ declare function installGeometry(kit: Kit): {
|
|
|
67
67
|
crease: (geo: BufferGeometry, deg: number) => BufferGeometry<three.NormalBufferAttributes>;
|
|
68
68
|
creaseTask: (geo: BufferGeometry, deg: number) => {
|
|
69
69
|
geo: BufferGeometry<three.NormalBufferAttributes>;
|
|
70
|
-
step: (deadline: number) => boolean;
|
|
70
|
+
step: (deadline: number, clock?: () => number) => boolean;
|
|
71
71
|
};
|
|
72
72
|
refreshBounds: (geo: BufferGeometry) => void;
|
|
73
73
|
pathShape: (items: readonly PathItem[]) => three.Shape;
|
|
@@ -79,7 +79,7 @@ declare function installGeometry(kit: Kit): {
|
|
|
79
79
|
cut: Record<string, BufferGeometry>;
|
|
80
80
|
tasks: Record<string, ReturnType<(geo: BufferGeometry, deg: number) => {
|
|
81
81
|
geo: BufferGeometry<three.NormalBufferAttributes>;
|
|
82
|
-
step: (deadline: number) => boolean;
|
|
82
|
+
step: (deadline: number, clock?: () => number) => boolean;
|
|
83
83
|
}>>;
|
|
84
84
|
};
|
|
85
85
|
mergeGeometries: (list: readonly BufferGeometry[]) => BufferGeometry<three.NormalBufferAttributes>;
|
|
@@ -891,6 +891,11 @@ type SpawnOptions = {
|
|
|
891
891
|
mat?: Material;
|
|
892
892
|
r?: number;
|
|
893
893
|
floor?: number;
|
|
894
|
+
/** End size as a multiple of the start size, over the life (the plume law); without it the puff follows the kit's own growth. */
|
|
895
|
+
growth?: number;
|
|
896
|
+
/** Upward pull (m/s²) and drag (1/s) of a routed puff; without them the effects world's defaults for smoke. */
|
|
897
|
+
lift?: number;
|
|
898
|
+
drag?: number;
|
|
894
899
|
};
|
|
895
900
|
/** A burst of particles: the spawn options plus a main direction, speed, spread and how far from the point they start. */
|
|
896
901
|
type BurstOptions = SpawnOptions & {
|
|
@@ -1056,7 +1061,7 @@ type CutPanelOptions = {
|
|
|
1056
1061
|
anyN?: boolean;
|
|
1057
1062
|
pieceTasks?: Map<Mesh, {
|
|
1058
1063
|
geo: BufferGeometry;
|
|
1059
|
-
step: (deadline: number) => boolean;
|
|
1064
|
+
step: (deadline: number, clock?: () => number) => boolean;
|
|
1060
1065
|
}>;
|
|
1061
1066
|
};
|
|
1062
1067
|
declare function installZoneDent(kit: Kit): {
|
|
@@ -1444,9 +1449,10 @@ interface ParticleEffectRequest {
|
|
|
1444
1449
|
readonly point: [number, number, number];
|
|
1445
1450
|
readonly values: Readonly<Record<string, number>>;
|
|
1446
1451
|
}
|
|
1447
|
-
/** The host's effects world as far as the puffs need it (`EffectSink` of `game-contracts` fits). */
|
|
1452
|
+
/** The host's effects world as far as the puffs and 3D vehicle fire/explosions need it (`EffectSink` of `game-contracts` fits). */
|
|
1448
1453
|
interface ParticleEffects {
|
|
1449
1454
|
play(request: ParticleEffectRequest): unknown;
|
|
1455
|
+
stop?(handle: unknown): void;
|
|
1450
1456
|
}
|
|
1451
1457
|
|
|
1452
1458
|
type DamageableMaterial = 'metal' | 'glass' | 'rubber' | 'fuel';
|
|
@@ -1616,6 +1622,8 @@ interface VehicleEmitter {
|
|
|
1616
1622
|
s: number;
|
|
1617
1623
|
dir: Vector3 | null;
|
|
1618
1624
|
gap: number;
|
|
1625
|
+
/** How wrecked the source is (0 intact, 1 wrecked): smoke thickens with it (`smokeRate` of `engine-smoke.ts`). */
|
|
1626
|
+
damage?: () => number;
|
|
1619
1627
|
}
|
|
1620
1628
|
/** A lamp the kit drew (`c.lights`): its group, the lens and the inner meshes (bulb, reflector), its tint and what happened to it. */
|
|
1621
1629
|
interface VehicleLamp {
|
|
@@ -1860,6 +1868,8 @@ interface ExplodeOptions {
|
|
|
1860
1868
|
now?: boolean;
|
|
1861
1869
|
/** Seconds of fire before the blast (default 3..8 at random). */
|
|
1862
1870
|
delay?: number;
|
|
1871
|
+
/** Skip playing the 3D blast effect in `detonate` (used when the destructible layer already emitted `explode` to the host). */
|
|
1872
|
+
skipBlastEffect?: boolean;
|
|
1863
1873
|
}
|
|
1864
1874
|
interface OverallHealth {
|
|
1865
1875
|
health: number;
|
|
@@ -2025,6 +2035,66 @@ declare function legacyGlassId(key: string | null, label: string, side: number,
|
|
|
2025
2035
|
/** Original id of a light zone: `farol_e`, `lanterna_c`, `farol_d_2`... */
|
|
2026
2036
|
declare function legacyLightId(kind: string, side: string, index: number): string;
|
|
2027
2037
|
|
|
2038
|
+
/**
|
|
2039
|
+
* Smoke out of a damaged engine bay as a plume: many small, see-through puffs that leave the top of the bay, climb, widen, drift with the
|
|
2040
|
+
* wind and thin out. The colour says the cause: coolant steam is white, oil burning on the hot block is light grey, and only a fire of
|
|
2041
|
+
* rubber or fuel gives black smoke. Pure numbers: `particles.ts` turns each puff into a sprite (or a request to the host's effects world).
|
|
2042
|
+
*/
|
|
2043
|
+
/** What is burning or boiling under the hood. */
|
|
2044
|
+
declare const SmokeCause: {
|
|
2045
|
+
readonly STEAM: "steam";
|
|
2046
|
+
readonly OIL: "oil";
|
|
2047
|
+
readonly FIRE: "fire";
|
|
2048
|
+
};
|
|
2049
|
+
type SmokeCause = (typeof SmokeCause)[keyof typeof SmokeCause];
|
|
2050
|
+
/** Colour and peak opacity of one puff of a cause. */
|
|
2051
|
+
interface SmokeLook {
|
|
2052
|
+
readonly color: number;
|
|
2053
|
+
readonly alpha: number;
|
|
2054
|
+
}
|
|
2055
|
+
declare const SMOKE_LOOKS: Readonly<Record<SmokeCause, SmokeLook>>;
|
|
2056
|
+
declare const smokeCauseOfEmitter: (kind: string) => SmokeCause | undefined;
|
|
2057
|
+
declare function smokeRate(baseRate: number, damage: number): number;
|
|
2058
|
+
/** Puffs born per emission: a plume is many faint puffs overlapping, never a few dense ones. */
|
|
2059
|
+
declare const PLUME_PUFFS = 3;
|
|
2060
|
+
/** The wind the plume leans with, metres a second (the same wind the kit's own puffs drift to). */
|
|
2061
|
+
declare const SMOKE_WIND: readonly [number, number, number];
|
|
2062
|
+
/** The numbers of one puff, in the emitter's frame (offset from the vent, velocity) and as the sprite reads them. */
|
|
2063
|
+
interface SmokePuff {
|
|
2064
|
+
readonly offset: readonly [number, number, number];
|
|
2065
|
+
readonly velocity: readonly [number, number, number];
|
|
2066
|
+
/** Start size in metres and end size as a multiple of it. */
|
|
2067
|
+
readonly size: number;
|
|
2068
|
+
readonly growth: number;
|
|
2069
|
+
readonly life: number;
|
|
2070
|
+
readonly color: number;
|
|
2071
|
+
readonly alpha: number;
|
|
2072
|
+
/** Upward pull (m/s²) and drag (1/s) the effects world applies over the life. */
|
|
2073
|
+
readonly lift: number;
|
|
2074
|
+
readonly drag: number;
|
|
2075
|
+
}
|
|
2076
|
+
interface SmokePuffParams {
|
|
2077
|
+
readonly cause: SmokeCause;
|
|
2078
|
+
/** Size of the source (1 a car's engine bay). */
|
|
2079
|
+
readonly scale: number;
|
|
2080
|
+
/** Uniform random numbers in [0, 1). */
|
|
2081
|
+
readonly random: () => number;
|
|
2082
|
+
/** Wind in the emitter's frame (default `SMOKE_WIND`). */
|
|
2083
|
+
readonly wind?: readonly [number, number, number];
|
|
2084
|
+
}
|
|
2085
|
+
/** One puff of the plume: small and see-through at birth, rising and leaning with the wind, several times wider when it fades. */
|
|
2086
|
+
declare function smokePuff(params: SmokePuffParams): SmokePuff;
|
|
2087
|
+
/** A box of the vehicle frame: centre and full size. */
|
|
2088
|
+
interface BayBox {
|
|
2089
|
+
readonly center: readonly [number, number, number];
|
|
2090
|
+
readonly size: readonly [number, number, number];
|
|
2091
|
+
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Where the smoke leaves the bay: just over the top of the engine, and towards the front of it (`+x` is forward in the vehicle frame), so the
|
|
2094
|
+
* plume rises off the hood and not through the windshield behind it.
|
|
2095
|
+
*/
|
|
2096
|
+
declare function engineBayVent(box: BayBox): [number, number, number];
|
|
2097
|
+
|
|
2028
2098
|
/**
|
|
2029
2099
|
* Armour levels of a vehicle, after NIJ 0108: the level says which rounds the glass and the steel stop, and how many hits they take
|
|
2030
2100
|
* before they give. Every number is configurable: a game passes its own table in `VehicleDestructibleOptions.armourLevels`.
|
|
@@ -2134,8 +2204,8 @@ declare function buildVehicleModel(kit: VehicleKit, c: VehicleContext, options?:
|
|
|
2134
2204
|
interface CreaseWork {
|
|
2135
2205
|
/** Units waiting; 0 in the frame a panel was torn (that frame already paid for the cut). `frame` is the budget's frame counter. */
|
|
2136
2206
|
pendingUnits(frame?: number): number;
|
|
2137
|
-
/** Runs one slice of the work (a smoothing step or a piece of the index warm-up) until `deadline`
|
|
2138
|
-
runStep(deadline: number): boolean;
|
|
2207
|
+
/** Runs one slice of the work (a smoothing step or a piece of the index warm-up) until `clock()` reaches `deadline` (`clock` is the budget's; default `performance.now`); false when there was nothing to run. */
|
|
2208
|
+
runStep(deadline: number, clock?: () => number): boolean;
|
|
2139
2209
|
/** Finishes everything now. */
|
|
2140
2210
|
finishAll(): void;
|
|
2141
2211
|
/** While true the vehicle's own update leaves the work to the queue. */
|
|
@@ -2153,6 +2223,14 @@ interface CreaseQueue {
|
|
|
2153
2223
|
*/
|
|
2154
2224
|
declare function createCreaseQueue(): CreaseQueue;
|
|
2155
2225
|
|
|
2226
|
+
/**
|
|
2227
|
+
* `createVehicleDestructible`: a vehicle that follows the destruction contract of `@adatechnology/game-contracts` and brings its own rules.
|
|
2228
|
+
* Every damage zone and mechanical part is a part with a material, hits become events (dent, hole, crack, fracture, detach, leak, ignite,
|
|
2229
|
+
* melt, explode), joints come apart by wear, by a wrench or by breaking, and the hidden mechanics change how the vehicle drives.
|
|
2230
|
+
*
|
|
2231
|
+
* It depends on the contracts only (types) and on the kit it is given: not on the default destruction world.
|
|
2232
|
+
*/
|
|
2233
|
+
|
|
2156
2234
|
interface VehicleDestructibleOptions {
|
|
2157
2235
|
/** Object id the host gives (`DestructibleImpl.id`). Default: the vehicle key. */
|
|
2158
2236
|
id?: string;
|
|
@@ -2214,6 +2292,8 @@ interface VehicleDestructible extends DestructibleImpl {
|
|
|
2214
2292
|
readonly model: VehicleModel;
|
|
2215
2293
|
/** Display name of a part (from the kit locale). */
|
|
2216
2294
|
partName(partId: string): string;
|
|
2295
|
+
/** The meshes and groups that draw the part now (none when it has no mesh of its own, came off or is not drawn: the body shell is the vehicle's merged meshes). */
|
|
2296
|
+
objectsOf(partId: string): Object3D[];
|
|
2217
2297
|
status(): VehicleStatus;
|
|
2218
2298
|
/** Open and close clips for the doors, the hood and the trunk lid the vehicle has. */
|
|
2219
2299
|
animations(): AnimationClipSpec[];
|
|
@@ -2359,4 +2439,29 @@ declare function swingOf(vehicle: VehicleContext, partId: string): number;
|
|
|
2359
2439
|
*/
|
|
2360
2440
|
declare function cabinEnclosure(source: CabinSource, options?: CabinEnclosureOptions): Enclosure | null;
|
|
2361
2441
|
|
|
2362
|
-
|
|
2442
|
+
/** Vehicle cabin categories covered by the R6 interior clearance table. */
|
|
2443
|
+
declare const CABIN_CATEGORIES: readonly ["passenger_car", "suv_pickup", "van", "truck", "bus", "agricultural", "military_light", "military_armored", "open_vehicle", "boat_cabin", "aircraft_enclosed"];
|
|
2444
|
+
type CabinCategory = (typeof CABIN_CATEGORIES)[number];
|
|
2445
|
+
/** Minimum door opening dimensions for a cabin category, in metres. */
|
|
2446
|
+
type CabinDoorMinimum = {
|
|
2447
|
+
readonly widthMetres: number;
|
|
2448
|
+
readonly heightMetres: number;
|
|
2449
|
+
};
|
|
2450
|
+
/** Minimum interior clearances for one vehicle cabin category, in metres (`Infinity` means unobstructed/open). */
|
|
2451
|
+
type CabinMinimum = {
|
|
2452
|
+
readonly frontHeadroomMetres: number;
|
|
2453
|
+
readonly rearHeadroomMetres: number | undefined;
|
|
2454
|
+
readonly frontLegroomMetres: number;
|
|
2455
|
+
readonly widthMetres: number;
|
|
2456
|
+
readonly door: CabinDoorMinimum | undefined;
|
|
2457
|
+
};
|
|
2458
|
+
/** Documented source of the cabin clearance table and entry duck factor. */
|
|
2459
|
+
declare const CABIN_SOURCE: string;
|
|
2460
|
+
/** Fraction of standing height required vertically when ducking through a side vehicle door. */
|
|
2461
|
+
declare const ENTRY_DUCK_FACTOR: number;
|
|
2462
|
+
/** Minimum interior clearances by cabin category (Spec 012 R6). */
|
|
2463
|
+
declare const CABIN_MINIMUMS: Readonly<Record<CabinCategory, CabinMinimum>>;
|
|
2464
|
+
/** Returns the minimum interior clearances for a cabin category. */
|
|
2465
|
+
declare const cabinMinimumOf: (category: CabinCategory) => CabinMinimum;
|
|
2466
|
+
|
|
2467
|
+
export { ARMOUR_LEVELS, type ArmourLevel, type ArmourLevelId, type Band, type BandId, type BandIndex, type BandOverride, type BayBox, type BuildFunction, type BuildOptions, type BuildState, type BuildZoneState, type BusRowsOptions, CABIN_CATEGORIES, CABIN_LEAK, CABIN_MINIMUMS, CABIN_SOURCE, CRASH_RULES, type CabinBox, type CabinCategory, type CabinDoorMinimum, type CabinEnclosureOptions, type CabinMinimum, type CabinSource, type CarSpec, type CarWheel, type CrashOptions, type CrashResult, type CrashRules, type CreaseQueue, type CreaseWork, type CutTest, type DamageMapOptions, type DamageZone, type Damageable, type DamageableKind, type DamageableMaterial, type DamageableSide, type DashboardOptions, type DriveReport, ENTRY_DUCK_FACTOR, type EngineBaySpec, type ExplodeOptions, type FlagEffect, type FluidDefinition, type GlassOptions, type GlassQuad, type Greenhouse, type GrilleOptions, type HeadlightLens, type HeadlightOptions, type ImpactOptions, type InteriorOptions, JOINT_RULES, type JointDef, type KitConfiguration, type KitInternals, type KitTexts, LEGACY_STATES, LEGACY_ZONE_IDS, type LabelArgument, type LocalBox, type LocaleStrings, type LodSettings, type LoftRow, type LoftStation, type OverallHealth, PLUME_PUFFS, type PaneLook, type PartDef, type PartLabel, type PartRole, type PartialLocaleStrings, type ParticleEffectRequest, type ParticleEffects, type ParticleMaterials, type PathItem, type Plugin, type Puddle, type PuddleLobe, type ResolvedConfiguration, type RollState, SEED_SALTS, SMOKE_LOOKS, SMOKE_WIND, type ScenarioContext, type ScenarioDefinition, type ScenarioResult, type SceneNode, type SeatOptions, type ShellSpec, SmokeCause, type SmokeLook, type SmokePuff, type SmokePuffParams, type SmoothLoftOptions, type Splat, type SplatOptions, type StrayLamp, type TaillightOptions, type ThreeObject, type ThreeVector, type Translate, type TumbleSpec, type UiHelpers, type UnderbodySpec, type VehicleContext, type VehicleDestructible, type VehicleDestructibleOptions, type VehicleItem, type VehicleItemOptions, type VehicleKit, type VehicleKitOptions, type VehicleLamp, type VehicleMeta, type VehicleModel, type VehiclePart, type VehicleSpec, type VehicleStatus, type WarpFn, type WarpOptions, type ZoneDamageEntry, type ZoneDef, type ZoneEffect, type ZoneState, armourLevelOf, buildVehicleItem, buildVehicleModel, cabinBoxOf, cabinEnclosure, cabinMinimumOf, clamp, crackedGlassMaterial, crashDeltaV, crashVehicle, createCreaseQueue, createLod, createTranslate, createVehicleDestructible, createVehicleKit, defaultDamageableKinds, defaultLodSettings, engineBayVent, format, hash, legacyGlassId, legacyLightId, legacyZoneId, listLocales, registerLegacySeeds, registerLocale, resolveStrings, rng, smokeCauseOfEmitter, smokePuff, smokeRate, smooth, strHash, strayLampsOf, swingOf, wrapThreeForLod };
|