Skip to content

Commit

Permalink
Fix overwriting of vehicle handling data (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShortByte authored Jul 13, 2024
1 parent 369f5e1 commit 01a7847
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/client/system/vehicleHandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@ alt.on('streamSyncedMetaChange', (vehicle: alt.BaseObject, key: string) => {
if (!(vehicle instanceof alt.Vehicle)) {
return;
}
const handlingData: Partial<alt.HandlingData> = vehicle.getStreamSyncedMeta('handling');

vehicle.handling = Object.assign(vehicle.handling, vehicle.getStreamSyncedMeta('handling'));
for (const [key, value] of Object.entries(handlingData)) {
vehicle.handling[key] = value;
}
});

alt.on('enteredVehicle', (vehicle, seat) => {
if (!vehicle.hasStreamSyncedMeta('handling')) {
return;
}
const handlingData: Partial<alt.HandlingData> = vehicle.getStreamSyncedMeta('handling');

vehicle.handling = Object.assign(vehicle.handling, vehicle.getStreamSyncedMeta('handling'));
for (const [key, value] of Object.entries(handlingData)) {
vehicle.handling[key] = value;
}
});

0 comments on commit 01a7847

Please sign in to comment.