export default function tuningSync() {
    mp.events.add('entityStreamIn', (entity: EntityMp) => {
        if (!entity) {
            return;
        }
        if (entity.isAVehicle()) {

            var vehicle: VehicleMp = entity as VehicleMp;

            var taxiLight = entity.getVariable("vehicleTaxiLight");
            if (taxiLight) vehicle.setTaxiLights(taxiLight);

            var mod18 = vehicle.getVariable('mod18');
            var wheelType = vehicle.getVariable('wheelType');

            if (wheelType !== undefined) {
                vehicle.setWheelType(wheelType);
                vehicle.setMod(23, vehicle.getMod(23));
            }

            if (mod18 !== undefined) {
                vehicle.toggleMod(18, mod18);
            }
        }
    });

    mp.events.add('vehicleToggleMod', (veh, slot, newval) => {
        if (!veh) {
            return;
        }
        if (slot == -2) {
            veh.setWheelType(newval);
        }
        else {
            veh.toggleMod(slot, newval);
        }

    });

    mp.events.addDataHandler("vehicleTaxiLight", (entity: VehicleMp, state: boolean) => {
        if (!entity) {
            return;
        }
        entity.setTaxiLights(state);
    });
}