Skip to content

Commit

Permalink
refactor(package): move and export VehicleProperties interface
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Feb 18, 2024
1 parent 945b535 commit 3ecb419
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 91 deletions.
93 changes: 2 additions & 91 deletions package/client/resource/vehicleProperties/index.ts
Original file line number Diff line number Diff line change
@@ -1,96 +1,7 @@
interface VehicleProperties {
model: string;
plate: string;
plateIndex: number;
bodyHealth: number;
engineHealth: number;
tankHealth: number;
fuelLevel: number;
oilLevel: number;
dirtLevel: number;
paintType1: number;
paintType2: number;
color1: number | [number, number, number];
color2: number | [number, number, number];
pearlescentColor: number;
interiorColor: number;
dashboardColor: number;
wheelColor: number;
wheelWidth: number;
wheelSize: number;
wheels: number;
windowTint: number;
xenonColor: number;
neonEnabled: boolean[];
neonColor: [number, number, number];
extras: Record<number | string, 0 | 1>;
tyreSmokeColor: [number, number, number];
modSpoilers: number;
modFrontBumper: number;
modRearBumper: number;
modSideSkirt: number;
modExhaust: number;
modFrame: number;
modGrille: number;
modHood: number;
modFender: number;
modRightFender: number;
modRoof: number;
modEngine: number;
modBrakes: number;
modTransmission: number;
modHorns: number;
modSuspension: number;
modArmor: number;
modNitrous: number;
modTurbo: boolean;
modSubwoofer: boolean;
modSmokeEnabled: boolean;
modHydraulics: boolean;
modXenon: boolean;
modFrontWheels: number;
modBackWheels: number;
modCustomTiresF: boolean;
modCustomTiresR: boolean;
modPlateHolder: number;
modVanityPlate: number;
modTrimA: number;
modOrnaments: number;
modDashboard: number;
modDial: number;
modDoorSpeaker: number;
modSeats: number;
modSteeringWheel: number;
modShifterLeavers: number;
modAPlate: number;
modSpeakers: number;
modTrunk: number;
modHydrolic: number;
modEngineBlock: number;
modAirFilter: number;
modStruts: number;
modArchCover: number;
modAerials: number;
modTrimB: number;
modTank: number;
modWindows: number;
modDoorR: number;
modLivery: number;
modRoofLivery: number;
modLightbar: number;
windows: number[];
doors: number[];
tyres: Record<number | string, 1 | 2>
leftHeadlight: boolean;
rightHeadlight: boolean;
frontBumper: boolean;
rearBumper: boolean;
bulletProofTyres: boolean;
driftTyres: boolean;
}
import type { VehicleProperties } from '../../'

export const getVehicleProperties = (vehicle: number): VehicleProperties =>
exports.ox_lib.getVehicleProperties(vehicle);

export const setVehicleProperties = (vehicle: number, props: Partial<VehicleProperties>, fixVehicle?: boolean): boolean =>
exports.ox_lib.setVehicleProperties(vehicle, props);
exports.ox_lib.setVehicleProperties(vehicle, props, fixVehicle);
91 changes: 91 additions & 0 deletions package/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,97 @@ export function sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms, null));
}

export interface VehicleProperties {
model: string;
plate: string;
plateIndex: number;
bodyHealth: number;
engineHealth: number;
tankHealth: number;
fuelLevel: number;
oilLevel: number;
dirtLevel: number;
paintType1: number;
paintType2: number;
color1: number | [number, number, number];
color2: number | [number, number, number];
pearlescentColor: number;
interiorColor: number;
dashboardColor: number;
wheelColor: number;
wheelWidth: number;
wheelSize: number;
wheels: number;
windowTint: number;
xenonColor: number;
neonEnabled: boolean[];
neonColor: [number, number, number];
extras: Record<number | string, 0 | 1>;
tyreSmokeColor: [number, number, number];
modSpoilers: number;
modFrontBumper: number;
modRearBumper: number;
modSideSkirt: number;
modExhaust: number;
modFrame: number;
modGrille: number;
modHood: number;
modFender: number;
modRightFender: number;
modRoof: number;
modEngine: number;
modBrakes: number;
modTransmission: number;
modHorns: number;
modSuspension: number;
modArmor: number;
modNitrous: number;
modTurbo: boolean;
modSubwoofer: boolean;
modSmokeEnabled: boolean;
modHydraulics: boolean;
modXenon: boolean;
modFrontWheels: number;
modBackWheels: number;
modCustomTiresF: boolean;
modCustomTiresR: boolean;
modPlateHolder: number;
modVanityPlate: number;
modTrimA: number;
modOrnaments: number;
modDashboard: number;
modDial: number;
modDoorSpeaker: number;
modSeats: number;
modSteeringWheel: number;
modShifterLeavers: number;
modAPlate: number;
modSpeakers: number;
modTrunk: number;
modHydrolic: number;
modEngineBlock: number;
modAirFilter: number;
modStruts: number;
modArchCover: number;
modAerials: number;
modTrimB: number;
modTank: number;
modWindows: number;
modDoorR: number;
modLivery: number;
modRoofLivery: number;
modLightbar: number;
windows: number[];
doors: number[];
tyres: Record<number | string, 1 | 2>
leftHeadlight: boolean;
rightHeadlight: boolean;
frontBumper: boolean;
rearBumper: boolean;
bulletProofTyres: boolean;
driftTyres: boolean;
}

/**
* Creates a promise that will be resolved once any value is returned by the function (including null).
* @param {number?} timeout Error out after `~x` ms. Defaults to 1000, unless set to `false`.
Expand Down

0 comments on commit 3ecb419

Please sign in to comment.