@adatechnology/game-vehicles 0.5.0 → 0.6.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 +66 -3
- package/dist/index.global.js +947 -105
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +829 -52
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaterialId, Vec3, JointKind, ToolKind, DestructibleImpl, AnimationClipSpec, IgnitionRules, ObjectState, Enclosure } from '@adatechnology/game-contracts';
|
|
1
|
+
import { MaterialId, Vec3, JointKind, ToolKind, DeferredQueue, DestructibleImpl, AnimationClipSpec, IgnitionRules, ObjectState, Enclosure } from '@adatechnology/game-contracts';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Light mode ("lite"): the same vehicles with fewer triangles, for a whole street of them. Port of the `[LOD]` hooks of the team's Frota Leve
|
|
@@ -39,6 +39,18 @@ declare function createLod(options?: Partial<LodSettings>): LodSettings;
|
|
|
39
39
|
*/
|
|
40
40
|
declare function wrapThreeForLod(TH: any, lod: LodSettings): any;
|
|
41
41
|
|
|
42
|
+
/** Smoke, fire and dust puffs handed to the host's effects world instead of the kit's own sprites. */
|
|
43
|
+
/** What `EffectSink.play` of `game-contracts` takes, as a structural type: this package does not depend on the contracts layer. */
|
|
44
|
+
interface ParticleEffectRequest {
|
|
45
|
+
readonly effect: string;
|
|
46
|
+
readonly point: [number, number, number];
|
|
47
|
+
readonly values: Readonly<Record<string, number>>;
|
|
48
|
+
}
|
|
49
|
+
/** The host's effects world as far as the puffs need it (`EffectSink` of `game-contracts` fits). */
|
|
50
|
+
interface ParticleEffects {
|
|
51
|
+
play(request: ParticleEffectRequest): unknown;
|
|
52
|
+
}
|
|
53
|
+
|
|
42
54
|
/**
|
|
43
55
|
* Damageable parts: what a bullet, a bat or a crash can hurt on a built vehicle, as boxes. Port of `coletarDanificaveis` and `tipoDaZona`
|
|
44
56
|
* (frota-leve.js 14391-14405), driven by the zones the kit already derives, so it works for any vehicle of any pack.
|
|
@@ -571,8 +583,25 @@ interface VehicleKitOptions extends KitConfiguration {
|
|
|
571
583
|
locale?: string | PartialLocaleStrings;
|
|
572
584
|
/** Document used for canvas textures and the UI. Defaults to the global `document`. */
|
|
573
585
|
document?: Document;
|
|
586
|
+
/**
|
|
587
|
+
* Where the material of every smoke, fire and dust puff comes from and goes back to: puffs change their own material every frame (opacity, rotation, dissolve), so each keeps one, but
|
|
588
|
+
* handing them to the host's pool keeps the shader program linked when the last puff dies. Without it each puff makes and disposes its own (deprecated, removed in the next major).
|
|
589
|
+
*/
|
|
590
|
+
particleMaterials?: ParticleMaterials;
|
|
591
|
+
/**
|
|
592
|
+
* The host's effects world, read at each puff (the host attaches after the first build). With one, smoke, fire and dust go through it and its one budget; without one the kit draws its own
|
|
593
|
+
* sprites with their own cap (deprecated, removed in the next major).
|
|
594
|
+
*/
|
|
595
|
+
effects?: () => ParticleEffects | undefined;
|
|
574
596
|
plugins?: Plugin[];
|
|
575
597
|
}
|
|
598
|
+
/** What the host's material pool (`MaterialPool` of `@adatechnology/game-render-three`) lends the particles: a structural type, because this package does not depend on the render layer. */
|
|
599
|
+
interface ParticleMaterials {
|
|
600
|
+
/** Makes (with `build`) a material the caller owns and changes per frame. */
|
|
601
|
+
own<TMaterial>(build: () => TMaterial): TMaterial;
|
|
602
|
+
/** Gives it back: the first of its program family is kept alive, the others are disposed. */
|
|
603
|
+
release(material: unknown): void;
|
|
604
|
+
}
|
|
576
605
|
interface ImpactOptions {
|
|
577
606
|
/** Do not leave a stain. */
|
|
578
607
|
noStain?: boolean;
|
|
@@ -782,6 +811,8 @@ interface PartDef {
|
|
|
782
811
|
hp: number;
|
|
783
812
|
/** The damage zone this part is, when it is one. */
|
|
784
813
|
zoneId?: string;
|
|
814
|
+
/** The panes of a glass part no damage zone claims. */
|
|
815
|
+
panes?: any[];
|
|
785
816
|
/** Fluid held, in litres. */
|
|
786
817
|
contains?: {
|
|
787
818
|
fluid: string;
|
|
@@ -827,9 +858,31 @@ declare const JOINT_RULES: Record<'hinge' | 'bolt' | 'weld' | 'glue' | 'clip', {
|
|
|
827
858
|
tools: ToolKind[];
|
|
828
859
|
seconds: number;
|
|
829
860
|
}>;
|
|
830
|
-
/** Builds the part and joint model of a built vehicle. */
|
|
831
861
|
declare function buildVehicleModel(kit: VehicleKit, c: VehicleContext, options?: ModelOptions): VehicleModel;
|
|
832
862
|
|
|
863
|
+
/** What one vehicle's visuals give the shared crease queue: the normal smoothing and the triangle indexes still to finish. */
|
|
864
|
+
interface CreaseWork {
|
|
865
|
+
/** Units waiting; 0 in the frame a panel was torn (that frame already paid for the cut). `frame` is the budget's frame counter. */
|
|
866
|
+
pendingUnits(frame?: number): number;
|
|
867
|
+
/** Runs one slice of the work (a smoothing step or a piece of the index warm-up) until `deadline` on `performance.now()`; false when there was nothing to run. */
|
|
868
|
+
runStep(deadline: number): boolean;
|
|
869
|
+
/** Finishes everything now. */
|
|
870
|
+
finishAll(): void;
|
|
871
|
+
/** While true the vehicle's own update leaves the work to the queue. */
|
|
872
|
+
setQueued(isQueued: boolean): void;
|
|
873
|
+
}
|
|
874
|
+
interface CreaseQueue {
|
|
875
|
+
/** The queue for a frame budget (id `vehicles.crease`, `DEFERRED_PRIORITY['vehicles.crease']`); asking for it changes nothing. */
|
|
876
|
+
deferredQueue(): DeferredQueue;
|
|
877
|
+
/** A vehicle's visuals join the queue; returns the function that takes them out (a rebuilt vehicle, a vehicle that goes away). */
|
|
878
|
+
track(work: CreaseWork): () => void;
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* One queue for every vehicle of a scene, run round robin over the vehicles with work, so that the first vehicle does not take the whole budget.
|
|
882
|
+
* Until a budget attaches it, each vehicle keeps smoothing in its own `update`.
|
|
883
|
+
*/
|
|
884
|
+
declare function createCreaseQueue(): CreaseQueue;
|
|
885
|
+
|
|
833
886
|
/**
|
|
834
887
|
* `createVehicleDestructible`: a vehicle that follows the destruction contract of `@adatechnology/game-contracts` and brings its own rules.
|
|
835
888
|
* Every damage zone and mechanical part is a part with a material, hits become events (dent, hole, crack, fracture, detach, leak, ignite,
|
|
@@ -860,6 +913,11 @@ interface VehicleDestructibleOptions {
|
|
|
860
913
|
* Defaults and meaning of every number: `IgnitionRules` of `@adatechnology/game-contracts`.
|
|
861
914
|
*/
|
|
862
915
|
ignition?: Partial<IgnitionRules>;
|
|
916
|
+
/**
|
|
917
|
+
* One queue that smooths the normals of cut panels for every vehicle that shares it (`createCreaseQueue()`), run by a frame budget. Without it, or while
|
|
918
|
+
* nobody registered the queue with a budget, each vehicle smooths in its own `update` (2.5 ms a frame), as always.
|
|
919
|
+
*/
|
|
920
|
+
creaseQueue?: CreaseQueue;
|
|
863
921
|
}
|
|
864
922
|
/** What the vehicle can do now, from the state of its hidden mechanics. */
|
|
865
923
|
interface VehicleStatus {
|
|
@@ -957,4 +1015,9 @@ declare function swingOf(vehicle: VehicleContext, partId: string): number;
|
|
|
957
1015
|
*/
|
|
958
1016
|
declare function cabinEnclosure(source: CabinSource, options?: CabinEnclosureOptions): Enclosure | null;
|
|
959
1017
|
|
|
960
|
-
|
|
1018
|
+
/** Glass cracks, shattering and tempered or laminated breakage textures. */
|
|
1019
|
+
|
|
1020
|
+
/** The material of a pane with cracks drawn on it. A host warms its program at load with any texture: the first crack is in the middle of a blast. */
|
|
1021
|
+
declare function crackedGlassMaterial(THREE: any, texture: unknown): any;
|
|
1022
|
+
|
|
1023
|
+
export { type Band, type BandId, type BandIndex, type BandOverride, type BuildFunction, type BuildOptions, type BuildState, type BuildZoneState, CABIN_LEAK, type CabinBox, type CabinEnclosureOptions, type CabinSource, type CreaseQueue, type CreaseWork, type DamageMapOptions, type DamageZone, type Damageable, type DamageableKind, type DamageableMaterial, type DamageableSide, type ExplodeOptions, type FlagEffect, type FluidDefinition, type ImpactOptions, JOINT_RULES, type JointDef, type KitConfiguration, type KitInternals, type KitTexts, LEGACY_STATES, LEGACY_ZONE_IDS, type LocalBox, type LocaleStrings, type LodSettings, type OverallHealth, type PartDef, type PartLabel, type PartRole, type PartialLocaleStrings, type ParticleEffectRequest, type ParticleEffects, type ParticleMaterials, type Plugin, type ResolvedConfiguration, SEED_SALTS, type ScenarioContext, type ScenarioDefinition, type ScenarioResult, type SplatOptions, type ThreeObject, type ThreeVector, type Translate, type UiHelpers, type VehicleContext, type VehicleDestructible, type VehicleDestructibleOptions, type VehicleItem, type VehicleItemOptions, type VehicleKit, type VehicleKitOptions, type VehicleMeta, type VehicleModel, type VehiclePart, type VehicleSpec, type VehicleStatus, type ZoneDamageEntry, type ZoneEffect, type ZoneState, buildVehicleItem, buildVehicleModel, cabinBoxOf, cabinEnclosure, clamp, crackedGlassMaterial, createCreaseQueue, createLod, createTranslate, createVehicleDestructible, createVehicleKit, defaultDamageableKinds, defaultLodSettings, format, hash, legacyGlassId, legacyLightId, legacyZoneId, listLocales, registerLegacySeeds, registerLocale, resolveStrings, rng, smooth, strHash, swingOf, wrapThreeForLod };
|