@adatechnology/game-vehicles-three 0.8.2 → 0.8.4
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/{chunk-C7FZFX3K.js → chunk-VF34TPYO.js} +21 -3
- package/dist/chunk-VF34TPYO.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.global.js +29 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +5 -3
- package/dist/testing.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-C7FZFX3K.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -173,6 +173,12 @@ type VehicleSound = {
|
|
|
173
173
|
readonly reading: VehicleSoundReading;
|
|
174
174
|
dispose(): void;
|
|
175
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* A tyre's slide for `VehicleSoundFrame.slip`, from how much of its grip it uses (the semi driver's `state.slip`: force over what the tyre
|
|
178
|
+
* holds, 1 = saturated). A tyre pulling hard but still holding is silent; it squeals only near the limit and slides fully once saturated,
|
|
179
|
+
* so full throttle that the tyre carries is no skid, and wheelspin or a locked wheel is.
|
|
180
|
+
*/
|
|
181
|
+
declare const slideOfGrip: (usage: number) => number;
|
|
176
182
|
/**
|
|
177
183
|
* The sounds of one vehicle on a host's sink (`ModuleHost.audio`): the engine loops by RPM and load, the starter, the tyres skidding and rolling,
|
|
178
184
|
* and crashes by speed. The loops are placed at the vehicle every frame (distance and side come from the sink). Works without a sink (silent).
|
|
@@ -584,4 +590,4 @@ interface WindshieldMist {
|
|
|
584
590
|
}
|
|
585
591
|
declare function createWindshieldMist(THREE: MistThree, built: BuiltVehicle): WindshieldMist;
|
|
586
592
|
|
|
587
|
-
export { type BodyEvent, type BodyThree, BuiltVehicle, CAR_RECORDED_RPM, CAR_START_RUN_STOP, type CabinSmoke, DASHBOARD_LOOK, type DashboardOptions, type DashboardReading, type EngineBudget, type EngineBudgetOptions, type EngineLayerSetting, type EngineMixInput, EngineProfile, LAMP_RULES, LITE_CLASSES, type LampSwitch, type LiteClass, type LiteFusion, MIST_RULES, type MistThree, PRUNE_BELOW, VEHICLE_LOD_DISTANCE, VEHICLE_LOOPS, VEHICLE_LOOP_FALLOFF, VEHICLE_PRELOAD_SOUNDS, VEHICLE_SAMPLE_ALIASES, VEHICLE_SOUNDS, VEHICLE_SOUND_BANK, type VehicleBody, type VehicleBodyOptions, type VehicleDashboard, type VehicleLamps, type VehicleLod, type VehicleLodKit, type VehicleSound, type VehicleSoundFrame, VehicleSoundKeys, type VehicleSoundOptions, type VehicleSoundReading, type WheelRoll, type WheelRollThree, type WindowId, type WindshieldMist, classColor, classify, createCabinSmoke, createEngineBudget, createGearGuess, createVehicleBody, createVehicleDashboard, createVehicleLamps, createVehicleLod, createVehicleSound, createWheelRoll, createWindshieldMist, engineMix, firingHz, fuse, layerWeight, liteMaterials, liteMeshes, rpmShare };
|
|
593
|
+
export { type BodyEvent, type BodyThree, BuiltVehicle, CAR_RECORDED_RPM, CAR_START_RUN_STOP, type CabinSmoke, DASHBOARD_LOOK, type DashboardOptions, type DashboardReading, type EngineBudget, type EngineBudgetOptions, type EngineLayerSetting, type EngineMixInput, EngineProfile, LAMP_RULES, LITE_CLASSES, type LampSwitch, type LiteClass, type LiteFusion, MIST_RULES, type MistThree, PRUNE_BELOW, VEHICLE_LOD_DISTANCE, VEHICLE_LOOPS, VEHICLE_LOOP_FALLOFF, VEHICLE_PRELOAD_SOUNDS, VEHICLE_SAMPLE_ALIASES, VEHICLE_SOUNDS, VEHICLE_SOUND_BANK, type VehicleBody, type VehicleBodyOptions, type VehicleDashboard, type VehicleLamps, type VehicleLod, type VehicleLodKit, type VehicleSound, type VehicleSoundFrame, VehicleSoundKeys, type VehicleSoundOptions, type VehicleSoundReading, type WheelRoll, type WheelRollThree, type WindowId, type WindshieldMist, classColor, classify, createCabinSmoke, createEngineBudget, createGearGuess, createVehicleBody, createVehicleDashboard, createVehicleLamps, createVehicleLod, createVehicleSound, createWheelRoll, createWindshieldMist, engineMix, firingHz, fuse, layerWeight, liteMaterials, liteMeshes, rpmShare, slideOfGrip };
|
package/dist/index.global.js
CHANGED
|
@@ -74,7 +74,8 @@ var GameVehiclesThree = (() => {
|
|
|
74
74
|
liteMeshes: () => liteMeshes,
|
|
75
75
|
loadProvingModule: () => loadProvingModule,
|
|
76
76
|
loadVehiclesTestModule: () => loadVehiclesTestModule,
|
|
77
|
-
rpmShare: () => rpmShare
|
|
77
|
+
rpmShare: () => rpmShare,
|
|
78
|
+
slideOfGrip: () => slideOfGrip
|
|
78
79
|
});
|
|
79
80
|
|
|
80
81
|
// ../game-contracts/dist/index.js
|
|
@@ -44435,7 +44436,7 @@ var GameVehiclesThree = (() => {
|
|
|
44435
44436
|
};
|
|
44436
44437
|
}
|
|
44437
44438
|
|
|
44438
|
-
// ../game-audio/dist/chunk-
|
|
44439
|
+
// ../game-audio/dist/chunk-BUYBYP4L.js
|
|
44439
44440
|
var DISTANCE_CURVES = {
|
|
44440
44441
|
/** The game's `sfx`: `vol / (1 + d² × 0.004)`, cutoff `/ (1 + d × 0.01)`, silent below 0.01 (jogo L62091–62092, L62101). */
|
|
44441
44442
|
game_sfx: { model: "inverse_square", k: 4e-3, cutoffK: 0.01, minGain: 0.01 },
|
|
@@ -44701,6 +44702,8 @@ var GameVehiclesThree = (() => {
|
|
|
44701
44702
|
["revolver_38_357", 2, "sfx_pistol"],
|
|
44702
44703
|
["revolver_44_50ae", 3, "sfx_pistol"],
|
|
44703
44704
|
["smg_9mm_auto", 1, "sfx_pistol"],
|
|
44705
|
+
["launcher_40mm", 2],
|
|
44706
|
+
["rocket_launch", 2],
|
|
44704
44707
|
["shotgun_12", 1, "sfx_shotgun"],
|
|
44705
44708
|
["rifle_5_56", 1, "sfx_rifle"],
|
|
44706
44709
|
["rifle_7_62x39", 1, "sfx_rifle"],
|
|
@@ -46398,6 +46401,7 @@ var GameVehiclesThree = (() => {
|
|
|
46398
46401
|
|
|
46399
46402
|
// src/audio/vehicle-sound.ts
|
|
46400
46403
|
var clamp012 = (v) => v < 0 ? 0 : v > 1 ? 1 : v;
|
|
46404
|
+
var slideOfGrip = (usage) => clamp012((Math.abs(usage) - 0.9) / 0.1);
|
|
46401
46405
|
function createVehicleSound(audio, options = {}) {
|
|
46402
46406
|
const profile = options.profile ?? CAR_ENGINE;
|
|
46403
46407
|
const keys = { ...DEFAULT_VEHICLE_SOUND_KEYS, ...options.sounds };
|
|
@@ -48736,7 +48740,7 @@ var GameVehiclesThree = (() => {
|
|
|
48736
48740
|
position: [driver.state.x, 0.5, driver.state.z],
|
|
48737
48741
|
speed,
|
|
48738
48742
|
throttle: input.throttle,
|
|
48739
|
-
...semiState ? { rpm: semiState.rpm, slip: Math.max(0, ...semiState.slip.map(
|
|
48743
|
+
...semiState ? { rpm: semiState.rpm, slip: Math.max(0, ...semiState.slip.map(slideOfGrip)) } : { slip: braking && speed > 3 ? 0.6 : 0 },
|
|
48740
48744
|
surface: /dirt|gravel|sand|grass|mud/.test(settings.surface) ? "dirt" : "asphalt",
|
|
48741
48745
|
brake: input.brake
|
|
48742
48746
|
});
|
|
@@ -49120,8 +49124,10 @@ var GameVehiclesThree = (() => {
|
|
|
49120
49124
|
let done = false;
|
|
49121
49125
|
let nextSample = 0;
|
|
49122
49126
|
let carry = 0;
|
|
49127
|
+
let last = { throttle: 0, brake: 0, steer: 0, handbrake: false };
|
|
49123
49128
|
const tick = (h) => {
|
|
49124
49129
|
const input = procedure.input(driver.state, time, memo);
|
|
49130
|
+
last = input;
|
|
49125
49131
|
driver.step(input, h, world);
|
|
49126
49132
|
time += h;
|
|
49127
49133
|
if (time >= nextSample) {
|
|
@@ -49145,6 +49151,9 @@ var GameVehiclesThree = (() => {
|
|
|
49145
49151
|
get trace() {
|
|
49146
49152
|
return trace;
|
|
49147
49153
|
},
|
|
49154
|
+
get input() {
|
|
49155
|
+
return last;
|
|
49156
|
+
},
|
|
49148
49157
|
step(dt) {
|
|
49149
49158
|
carry += dt;
|
|
49150
49159
|
while (!done && carry >= fixed) {
|
|
@@ -49952,6 +49961,7 @@ var GameVehiclesThree = (() => {
|
|
|
49952
49961
|
let sparkAgain = 0;
|
|
49953
49962
|
let wiresBefore = 0;
|
|
49954
49963
|
let gas = 0;
|
|
49964
|
+
let pedal = 0;
|
|
49955
49965
|
const systems = createVehicleSystems();
|
|
49956
49966
|
const context = o.built.context;
|
|
49957
49967
|
const destructible = o.kit && context ? createVehicleDestructible(o.kit, context, { id: "driven", frame: o.built.group }) : null;
|
|
@@ -50045,9 +50055,13 @@ var GameVehiclesThree = (() => {
|
|
|
50045
50055
|
get throttle() {
|
|
50046
50056
|
return gas;
|
|
50047
50057
|
},
|
|
50058
|
+
get brake() {
|
|
50059
|
+
return pedal;
|
|
50060
|
+
},
|
|
50048
50061
|
step(dt) {
|
|
50049
50062
|
const input = controls.input(dt, driver);
|
|
50050
50063
|
gas = input.throttle;
|
|
50064
|
+
pedal = input.brake;
|
|
50051
50065
|
if (input.start && sounds.starter) play(sounds.starter);
|
|
50052
50066
|
const engine = driver.step(input, dt).events;
|
|
50053
50067
|
controls.after(driver, dt);
|
|
@@ -51168,7 +51182,18 @@ var GameVehiclesThree = (() => {
|
|
|
51168
51182
|
steer = p.driver.state.steerAngle;
|
|
51169
51183
|
if (p.time > 9) parking = null;
|
|
51170
51184
|
}
|
|
51171
|
-
if (car)
|
|
51185
|
+
if (car) {
|
|
51186
|
+
const semi = run?.driver.state ?? driving?.driver.state;
|
|
51187
|
+
const asked = run ? run.input : { throttle: driving?.throttle ?? 0, brake: driving?.brake ?? 0 };
|
|
51188
|
+
engine?.update({
|
|
51189
|
+
dt,
|
|
51190
|
+
position: [car.built.group.position.x, 0.5, car.built.group.position.z],
|
|
51191
|
+
speed,
|
|
51192
|
+
throttle: asked.throttle,
|
|
51193
|
+
brake: asked.brake,
|
|
51194
|
+
...semi ? { rpm: semi.rpm, slip: Math.max(0, ...semi.slip.map(slideOfGrip)) } : {}
|
|
51195
|
+
});
|
|
51196
|
+
}
|
|
51172
51197
|
const f = frameOf(speed);
|
|
51173
51198
|
if (f && rig.vehicle && settings.camera !== "room") rig.vehicle.update(rig.camera, f, dt);
|
|
51174
51199
|
if (f && rig.vehicle) for (const m of rig.mirrors) rig.vehicle.placeMirror(m.camera, aimed(m.pose), f);
|