Esempio n. 1
0
        public int CreateVehicle(int model, Vector3 pos, Vector3 rot, int color1, int color2)
        {
            int localEntityHash = ++EntityCounter;
            var obj             = new VehicleProperties();

            obj.Position       = pos;
            obj.Rotation       = rot;
            obj.ModelHash      = model;
            obj.IsDead         = false;
            obj.Health         = 900;
            obj.EntityType     = (byte)EntityType.Vehicle;
            obj.PrimaryColor   = color1;
            obj.SecondaryColor = color2;
            ServerEntities.Add(localEntityHash, obj);

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Vehicle;
            var props = new VehicleProperties();

            props.ModelHash      = model;
            props.Rotation       = rot;
            props.Position       = pos;
            props.PrimaryColor   = color1;
            props.SecondaryColor = color2;
            packet.NetHandle     = localEntityHash;
            packet.Properties    = props;
            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true);

            return(localEntityHash);
        }
Esempio n. 2
0
        private void RenderPoleMesh(ushort vehicleID, ref Vehicle vehicleData, Vector3 position, Quaternion rotation, Vector3 swayPosition, bool underground, bool overground, VehicleManager vehicleManager, VehicleInfo.MeshInfo meshInfo, MaterialPropertyBlock materialBlock)
        {
            VehicleInfoBase subInfo = meshInfo.m_subInfo;
            bool            flag    = Singleton <ToolManager> .instance.m_properties.m_mode == ItemClass.Availability.AssetEditor;

            if ((flag && !BuildingDecoration.IsSubMeshRendered(subInfo)) || (meshInfo.m_vehicleFlagsRequired & (Vehicle.Flags.TakingOff | Vehicle.Flags.Landing)) == 0 || !(subInfo != null))
            {
                return;
            }
            Matrix4x4 matrix = CalculatePoleMatrix(vehicleID, ref vehicleData, position, rotation, swayPosition, meshInfo, subInfo, flag);

            vehicleManager.m_drawCallData.m_defaultCalls++;
            if (underground)
            {
                if (subInfo.m_undergroundMaterial == null && subInfo.m_material != null)
                {
                    VehicleProperties properties = vehicleManager.m_properties;
                    if (properties != null)
                    {
                        subInfo.m_undergroundMaterial = new Material(properties.m_undergroundShader);
                        subInfo.m_undergroundMaterial.CopyPropertiesFromMaterial(subInfo.m_material);
                    }
                }
                Graphics.DrawMesh(subInfo.m_mesh, matrix, subInfo.m_undergroundMaterial, vehicleManager.m_undergroundLayer, null, 0, materialBlock);
            }
            if (overground)
            {
                Graphics.DrawMesh(subInfo.m_mesh, matrix, subInfo.m_material, m_info.m_prefabDataLayer, null, 0, materialBlock);
            }
        }
Esempio n. 3
0
        private void ParkVehicle()
        {
            string registrationNumber;
            int    typeChoice = GetVehicleTypeChoice();
            string color;
            int    emptyMass;

            if (typeChoice == 0)
            {
                ParkAircraft();
            }
            else if (typeChoice == 3)
            {
                ParkCar();
            }
            else
            {
                PropertyInfo[] vehicleProperties = VehicleProperties.GetProperties(typeChoice);
                GetBasicProperties(out registrationNumber, out color, out emptyMass);
                if (vehicleProperties[0].PropertyType.IsAssignableFrom(typeInteger))
                {
                    ParkBusOrMotorcycle(registrationNumber, typeChoice, color, emptyMass);
                }
                if (vehicleProperties[0].PropertyType.IsAssignableFrom(typeDecimal))
                {
                    ParkBoat(registrationNumber, color, emptyMass);
                }
            }
        }
Esempio n. 4
0
    public void Spawn()
    {
        var vehicle = laneProperties.vehiclePool.Dequeue();

        vehicleProperties = vehicle.GetComponent <VehicleProperties>();
        vehicleProperties.setParameters();
        vehicle.transform.position = laneProperties.spawnPos;

        switch (laneProperties.dir)
        {
        case LaneProperties.direction.East:
            vehicle.transform.rotation           = Quaternion.Euler(0f, 0f, 0f);
            motorwayStats.eastboundArrivalCount += 1;
            motorwayStats.eastVehicleArrivals.Add(motorwayTiming.elapsedTime);
            vehicleProperties.direction   = LaneProperties.direction.East;
            vehicleProperties.canMove     = true;
            vehicleProperties.currentLane = laneProperties.laneIndex;
            vehicleProperties.currentVel  = startVel(vehicleProperties.direction, vehicleProperties.currentLane);
            laneProperties.vehicles.eastVehicles[laneProperties.laneIndex].Add(vehicle);
            break;

        case LaneProperties.direction.West:
            vehicle.transform.rotation           = Quaternion.Euler(0f, 0f, 180f);
            motorwayStats.westboundArrivalCount += 1;
            motorwayStats.westVehicleArrivals.Add(motorwayTiming.elapsedTime);
            vehicleProperties.direction   = LaneProperties.direction.West;
            vehicleProperties.canMove     = true;
            vehicleProperties.currentLane = laneProperties.laneIndex;
            vehicleProperties.currentVel  = startVel(vehicleProperties.direction, vehicleProperties.currentLane);
            laneProperties.vehicles.westVehicles[laneProperties.laneIndex].Add(vehicle);
            break;
        }
    }
        //private void UpdateVehicle(int handle, EntityProperties prop)
        //{
        //    if (handle == 0 || prop == null) return;

        //    if (!IsVehicleUnoccupied(new NetHandle(handle))) //OCCUPIED
        //    {
        //        if (Syncer.ContainsKey(handle))
        //        {
        //            StopSync(Syncer[handle], handle);
        //        }
        //        return;
        //    }

        //    if (prop.Position == null) return;

        //    var players = Program.ServerInstance.PublicAPI.getAllPlayers().Where(c => (c.Properties.Dimension == prop.Dimension || prop.Dimension == 0) && c.Position != null).OrderBy(c => c.Position.DistanceToSquared2D(prop.Position)).Take(1).ToArray();
        //    if (players[0] == null) return;

        //    if (players[0].Position.DistanceToSquared(prop.Position) < SYNC_RANGE_SQUARED && (players[0].Properties.Dimension == prop.Dimension || prop.Dimension == 0))
        //    {
        //        if (Syncer.ContainsKey(handle))
        //        {
        //            if (Syncer[handle] != players[0])
        //            {
        //                StopSync(Syncer[handle], handle);
        //                StartSync(players[0], handle);
        //            }
        //        }
        //        else
        //        {
        //            StartSync(players[0], handle);
        //        }
        //    }
        //    else
        //    {
        //        if (Syncer.ContainsKey(handle))
        //        {
        //            StopSync(players[0], handle);
        //        }
        //    }
        //}

        public void UpdateVehicle(int handle, VehicleProperties prop)
        {
            if (handle == 0 || prop == null)
            {
                return;
            }
            if (!IsVehicleUnoccupied(new NetHandle(handle)))
            {
                if (Syncer.ContainsKey(handle))
                {
                    Sync(Syncer[handle], handle, false);
                    return;
                }
            }

            if (Syncer.ContainsKey(handle)) // This vehicle already has a syncer
            {
                if (Syncer[handle].Position.DistanceToSquared(prop.Position) > SYNC_RANGE_SQUARED || (Syncer[handle].Properties.Dimension != prop.Dimension && prop.Dimension != 0))
                {
                    Sync(Syncer[handle], handle, false);

                    FindSyncer(handle, prop);
                }
            }
            else // This car has no syncer
            {
                FindSyncer(handle, prop);
            }
        }
Esempio n. 6
0
        public static void AddVehicleProperty(VehicleProperties vehicleProperties, LoginData loginData)
        {
            string str = string.Format("INSERT INTO VehicleProperties VALUES ({0}, {1}, {2}, {3})",
                                       vehicleProperties.Make, vehicleProperties.Model, vehicleProperties.Type, vehicleProperties.Description);
            OracleCommand _command = CreateOracleCommand(loginData, str);

            _command.ExecuteNonQuery();
        }
 void Start()
 {
     vehicle = gameObject.GetComponent <VehicleProperties>();
     if (!vehicle)
     {
         Debug.Log("Missing vehicle at audio setup.");
     }
 }
Esempio n. 8
0
 public void GetPropertiesTest()
 {
     // Act
     var aircraft   = VehicleProperties.GetProperties(0);
     var boat       = VehicleProperties.GetProperties(1);
     var bus        = VehicleProperties.GetProperties(2);
     var car        = VehicleProperties.GetProperties(3);
     var motorcycle = VehicleProperties.GetProperties(4);
 }
 public Vehicle(string type, string name, int wheels, Trailer trailer, VehicleModel model, VehicleProperties properties)
 {
     Type       = type;
     Name       = name;
     Wheels     = wheels;
     Trailer    = trailer;
     Model      = model;
     Properties = properties;
 }
    // 0 North East
    // 1 East
    // 2 South East
    // 3 South West
    // 4 West
    // 5 North West

    // Start is called before the first frame update
    void Start()
    {
        motorwayManager   = GameObject.FindWithTag("MotorwayManager");
        parameters        = motorwayManager.GetComponent <Parameters>();
        vehicleProperties = gameObject.GetComponent <VehicleProperties>();
        lanes             = motorwayManager.GetComponent <Lanes>();
        vehicles          = motorwayManager.GetComponent <Vehicles>();

        StartCoroutine(DoEveryX());
    }
Esempio n. 11
0
        public int CreateVehicle(int model, Vector3 pos, Vector3 rot, int color1, int color2, int dimension)
        {
            var obj = new VehicleProperties
            {
                Position       = pos,
                Rotation       = rot,
                ModelHash      = model,
                IsDead         = false,
                Health         = 1000,
                Alpha          = 255,
                Livery         = 0,
                NumberPlate    = "APPI-MP",
                EntityType     = (byte)EntityType.Vehicle,
                PrimaryColor   = color1,
                SecondaryColor = color2,
                Dimension      = dimension
            };

            if (model == (int)VehicleHash.Taxi)
            {
                obj.VehicleComponents = 1 << 5;
            }
            else if (model == (int)VehicleHash.Police)
            {
                obj.VehicleComponents = 1 << 2;
            }
            else if (model == (int)VehicleHash.Skylift)
            {
                obj.VehicleComponents = -1537;
            }
            else
            {
                obj.VehicleComponents = ~0;
            }


            int localEntityHash;

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity
            {
                EntityType = (byte)EntityType.Vehicle,
                NetHandle  = localEntityHash,
                Properties = obj
            };

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Esempio n. 12
0
        public int CreateVehicle(int model, Vector3 pos, Vector3 rot, int color1, int color2, int dimension)
        {
            var obj = new VehicleProperties();

            obj.Position       = pos;
            obj.Rotation       = rot;
            obj.ModelHash      = model;
            obj.IsDead         = false;
            obj.Health         = 1000;
            obj.Alpha          = 255;
            obj.Livery         = 0;
            obj.NumberPlate    = "NETWORK";
            obj.EntityType     = (byte)EntityType.Vehicle;
            obj.PrimaryColor   = color1;
            obj.SecondaryColor = color2;
            obj.Dimension      = dimension;

            if (model == (int)VehicleHash.Taxi)
            {
                obj.VehicleComponents = 1 << 5;
            }
            else if (model == (int)VehicleHash.Police)
            {
                obj.VehicleComponents = 1 << 2;
            }
            else if (model == (int)VehicleHash.Skylift)
            {
                obj.VehicleComponents = -1537;
            }
            else
            {
                obj.VehicleComponents = ~0;
            }


            int localEntityHash;

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Vehicle;
            packet.NetHandle  = localEntityHash;
            packet.Properties = obj;
            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Esempio n. 13
0
        private void changePropertiesUI()
        {
            string plateNumber = getStringFromUser(Strings.enter_plate_number);

            try
            {
                VehicleProperties vehicle = m_Garage.GetVehicleByPlateNumber(plateNumber);
                VehicleProperties.eStateOfService newType = getOptionFromUser <VehicleProperties.eStateOfService>(string.Format(Strings.change_status_options, VehicleProperties.s_StateListOptions[(int)vehicle.Status]), VehicleProperties.s_StateListOptions, -1);
                vehicle.Status = newType;
            }
            catch (ArgumentException i_PlateError)
            {
                showError(i_PlateError.Message);
            }
        }
        public void FindSyncer(int handle, VehicleProperties prop)
        {
            if (prop.Position == null)
            {
                return;
            }

            var players =
                Program.ServerInstance.PublicAPI.getAllPlayers()
                .Where(c => (c.Properties.Dimension == prop.Dimension || prop.Dimension == 0) && c.Position != null)
                .OrderBy(c => c.Position.DistanceToSquared(prop.Position));

            Client targetPlayer;

            if ((targetPlayer = players.FirstOrDefault()) != null && targetPlayer.Position.DistanceToSquared(prop.Position) < SYNC_RANGE_SQUARED - DROPOFF_SQUARED)
            {
                Sync(targetPlayer, handle, true);
            }
        }
Esempio n. 15
0
 private void initializationEnums()
 {
     CarColor.SetListOfCarColors();
     LicenseType.SetListOfLicenseType();
     VehicleManager.SetVehicleList();
     VehicleProperties.SetListOfOptions();
     DoorNumber.SetListOfOptions();
     FuelVehicle.SetEnergeyTypeList();
     VehicleManager.SetBooleanList();
     VehicleManager.ArrangementExtandedOptionList();
     s_FirstMenuStringArray.Add(Strings.menu_options_1);
     s_FirstMenuStringArray.Add(Strings.menu_options_2);
     s_FirstMenuStringArray.Add(Strings.menu_options_3);
     s_FirstMenuStringArray.Add(Strings.menu_options_4);
     s_FirstMenuStringArray.Add(Strings.menu_options_5);
     s_FirstMenuStringArray.Add(Strings.menu_options_6);
     s_FirstMenuStringArray.Add(Strings.menu_options_7);
     s_FirstMenuStringArray.Add(Strings.menu_options_8);
 }
Esempio n. 16
0
    // Update is called once per frame
    void Update()
    {
        if (currentVehicle)
        {
            vehicleProperties = currentVehicle.GetComponent <VehicleProperties>();
            show(true);
            speedText.text        = getSpeedString();
            politenessText.text   = getPolitenessString();
            desiredSpeedText.text = getDesiredSpeedString();

            if (!vehicleProperties.canMove)
            {
                currentVehicle = null;
            }
        }
        else
        {
            show(false);
        }
    }
    public float steer = 0.0f; // main Y rotation while steering

    // Start is called before the first frame update
    void Start()
    {
        vehicle    = parent.GetComponent <VehicleProperties>();
        rb         = GetComponent <Rigidbody>();
        vehicle_rb = parent.GetComponent <Rigidbody>();

        // Let wheels spin fast (normally capped at 7 rads/sec)
        rb.maxAngularVelocity = vehicle.max_angular_velocity; // in radians/second
        rb.mass        = vehicle.mass_tire;
        rb.angularDrag = vehicle.angular_drag_tire;

        // Create the suspension joint that holds our wheel to our parent
        suspension = gameObject.AddComponent <ConfigurableJoint>();
        suspension.connectedBody = transform.parent.gameObject.GetComponent <Rigidbody>();
        suspension.anchor        = new Vector3(0.0f, 0.0f, 0.0f);
        suspension.autoConfigureConnectedAnchor = false;
        Vector3 p = transform.localPosition;

        suspension.connectedAnchor = new Vector3(p.x, p.y, p.z); // anchor point is our center point
        suspension.swapBodies      = true;
        suspension.xMotion         = ConfigurableJointMotion.Locked;
        suspension.yMotion         = ConfigurableJointMotion.Limited; // wheel vertical suspension
        suspension.zMotion         = ConfigurableJointMotion.Locked;
        suspension.angularXMotion  = ConfigurableJointMotion.Free;    // wheel rotation
        suspension.angularYMotion  = ConfigurableJointMotion.Locked;
        suspension.angularZMotion  = ConfigurableJointMotion.Locked;

        SoftJointLimitSpring spr = new SoftJointLimitSpring();

        spr.spring = 8000.0f;
        spr.damper = 500.0f;
        suspension.linearLimitSpring = spr;

        SoftJointLimit soft = new SoftJointLimit();

        soft.bounciness        = 0.0f;
        soft.limit             = 0.01f;
        soft.contactDistance   = 0.01f;
        suspension.linearLimit = soft;
    }
Esempio n. 18
0
        private void addNewVehicleUI()
        {
            VehicleProperties.eStateOfService statusOfNewVehicle;
            Dictionary <string, object>       basicArgumentsMap = new Dictionary <string, object>();
            string plateNumber = getStringFromUser(Strings.enter_plate_number);

            try
            {
                VehicleProperties vehicle = m_Garage.GetVehicleByPlateNumber(plateNumber);
                printMessage(string.Format(Strings.change_status_options, VehicleProperties.s_StateListOptions[(int)vehicle.Status]));
                showOptions(VehicleProperties.s_StateListOptions);
                statusOfNewVehicle = (VehicleProperties.eStateOfService)getUserChoice(1, VehicleProperties.s_StateListOptions.Count) - 1;
                vehicle.Status     = statusOfNewVehicle;
            }
            catch (Exception i_PlateError)
            {
                if (i_PlateError is KeyNotFoundException)
                {
                    showError(string.Format(Strings.plate_didnt_found, plateNumber));
                }
                else
                {
                    showError(Strings.unknown_error);
                }

                printMessage(Strings.create_new_vehicle);
                VehicleManager.eVehicleTypes vehicleType = getOptionFromUser <VehicleManager.eVehicleTypes>(Strings.choose_type_of_vehicle, VehicleManager.VehicleList, -1);
                basicArgumentsMap.Add(ArgumentsKeysets.sr_KeyTypeOfVehicle, vehicleType);
                basicArgumentsMap.Add(ArgumentsKeysets.sr_KeyOwnerName, getStringFromUser(Strings.enter_owner_name));
                basicArgumentsMap.Add(ArgumentsKeysets.sr_KeyPhoneNumber, getStringFromUser(Strings.enter_phone_number));
                basicArgumentsMap.Add(ArgumentsKeysets.sr_KeyModelName, getStringFromUser(Strings.enter_model_name));
                basicArgumentsMap.Add(ArgumentsKeysets.sr_KeyWheelManufacturer, getStringFromUser(Strings.enter_wheel_manufacturer));
                basicArgumentsMap.Add(ArgumentsKeysets.sr_KeyPlateNumber, plateNumber);
                basicArgumentsMap.Add(ArgumentsKeysets.sr_KeyRepairStatus, getOptionFromUser <VehicleProperties.eStateOfService>(Strings.choose_status_of_vehicle, VehicleProperties.s_StateListOptions, -1));
                basicArgumentsMap.Add(ArgumentsKeysets.sr_KeyCurrentEnergyLevel, getFloatFromUser(Strings.enter_current_energy_level));
                basicArgumentsMap.Add(ArgumentsKeysets.sr_KeyCurrentWheelPressure, getFloatFromUser(Strings.enter_current_wheel_pressure_level));
                getMoreInformationBasedOnType(VehicleManager.s_OptionsToAskUserByTypes[vehicleType], ref basicArgumentsMap);
                m_Garage.AddNewVehicle(VehicleManager.CreateNewVehicle(ref basicArgumentsMap), ref basicArgumentsMap);
            }
        }
Esempio n. 19
0
        private void SpawnVehicle(int source, List <object> args, string raw)
        {
            string model = "zentorno";

            if (args.Count > 0)
            {
                model = args[0].ToString();
            }

            int hash = GetHashKey(model);

            Ped PlayerPed = new Ped(GetPlayerPed(source));

            ESX.Game.SpawnVehicle(hash, PlayerPed.Position, PlayerPed.Heading, new Action <int>((vehicleHandle) => {
                Vehicle vehicle = new Vehicle(vehicleHandle);
                VehicleProperties vehicleProperties = ESX.Game.GetVehicleProperties(vehicleHandle);//or vehicle.Handle

                vehicleProperties.color1 = VehicleColor.Blue;
                ESX.Game.SetVehicleProperties(vehicle, vehicleProperties);
                ESX.ShowNotification($"{vehicle.Handle} {vehicle.Mods.LicensePlate} {vehicleProperties.color1}");
            }));
        }
 // Start is called before the first frame update
 void Start()
 {
     vehicle       = GetComponent <VehicleProperties>();
     vehicle.is_VR = true;
 }
 // Start is called before the first frame update
 void Start()
 {
     vehicle = GetComponent <VehicleProperties>();
 }
Esempio n. 22
0
 // Start is called before the first frame update
 void Start()
 {
     breakingDown      = false;
     vehicleProperties = gameObject.GetComponent <VehicleProperties>();
 }
        // Run before the original method. Skip the original one if the vehicle is a cable car
        public static bool Prefix(RenderManager.CameraInfo cameraInfo, VehicleInfo info, Vector3 position, ref Quaternion rotation, Vector3 swayPosition, Vector4 lightState, Vector4 tyrePosition, Vector3 velocity, float acceleration, Color color, Vehicle.Flags flags, int variationMask, InstanceID id, bool underground, bool overground)
        {
            // if the vehicle is not a cable car, skip and use the original method
            if ((int)info.m_vehicleType != 0x1000)
            {
                return(true);
            }

            // limit rotation along the x and z axes for all meshes except submesh1
            // submesh1 would rotate in the original way(along with the cable)
            Quaternion originalRotation = rotation;

            rotation.x = 0.0f;
            rotation.z = 0.0f;

            // change how cable cars sway
            // so they don't move up and down on the cables as if they're ships moving in sea waves
            swayPosition.y = 0.0f;

            if ((cameraInfo.m_layerMask & (1 << info.m_prefabDataLayer)) == 0)
            {
                // return false to skip the original method
                return(false);
            }
            Vector3 scale = Vector3.one;

            if ((flags & Vehicle.Flags.Inverted) != 0)
            {
                scale = new Vector3(-1f, 1f, -1f);
                Vector4 vector = lightState;
                lightState.x = vector.y;
                lightState.y = vector.x;
                lightState.z = vector.w;
                lightState.w = vector.z;
            }

            info.m_vehicleAI.RenderExtraStuff(id.Vehicle, ref Singleton <VehicleManager> .instance.m_vehicles.m_buffer[id.Vehicle], cameraInfo, id, position, rotation, tyrePosition, lightState, scale, swayPosition, underground, overground);

            if (cameraInfo.CheckRenderDistance(position, info.m_lodRenderDistance))
            {
                VehicleManager instance           = Singleton <VehicleManager> .instance;
                Matrix4x4      bodyMatrix         = info.m_vehicleAI.CalculateBodyMatrix(flags, ref position, ref rotation, ref scale, ref swayPosition);
                Matrix4x4      originalBodyMatrix = info.m_vehicleAI.CalculateBodyMatrix(flags, ref position, ref originalRotation, ref scale, ref swayPosition);
                Matrix4x4      value = info.m_vehicleAI.CalculateTyreMatrix(flags, ref position, ref rotation, ref scale, ref bodyMatrix);
                if (Singleton <InfoManager> .instance.CurrentMode == InfoManager.InfoMode.None)
                {
                    RenderGroup.MeshData effectMeshData = info.m_vehicleAI.GetEffectMeshData();
                    EffectInfo.SpawnArea area           = new EffectInfo.SpawnArea(bodyMatrix, effectMeshData, info.m_generatedInfo.m_tyres, info.m_lightPositions);
                    if (info.m_effects != null)
                    {
                        for (int i = 0; i < info.m_effects.Length; i++)
                        {
                            VehicleInfo.Effect effect = info.m_effects[i];
                            if (((effect.m_vehicleFlagsRequired | effect.m_vehicleFlagsForbidden) & flags) == effect.m_vehicleFlagsRequired && effect.m_parkedFlagsRequired == VehicleParked.Flags.None)
                            {
                                effect.m_effect.RenderEffect(id, area, velocity, acceleration, 1f, -1f, Singleton <SimulationManager> .instance.m_simulationTimeDelta, cameraInfo);
                            }
                        }
                    }
                }
                if ((flags & Vehicle.Flags.Inverted) != 0)
                {
                    tyrePosition.x = 0f - tyrePosition.x;
                    tyrePosition.y = 0f - tyrePosition.y;
                }
                MaterialPropertyBlock materialBlock = instance.m_materialBlock;
                materialBlock.Clear();
                materialBlock.SetMatrix(instance.ID_TyreMatrix, value);
                materialBlock.SetVector(instance.ID_TyrePosition, tyrePosition);
                materialBlock.SetVector(instance.ID_LightState, lightState);
                bool flag = Singleton <ToolManager> .instance.m_properties.m_mode == ItemClass.Availability.AssetEditor;
                if (!flag)
                {
                    materialBlock.SetColor(instance.ID_Color, color);
                }
                bool flag2 = true;
                if (flag)
                {
                    flag2 = BuildingDecoration.IsMainMeshRendered();
                }
                if (info.m_subMeshes != null)
                {
                    for (int j = 0; j < info.m_subMeshes.Length; j++)
                    {
                        VehicleInfo.MeshInfo meshInfo = info.m_subMeshes[j];
                        VehicleInfoBase      subInfo  = meshInfo.m_subInfo;
                        if ((!flag && ((meshInfo.m_vehicleFlagsRequired | meshInfo.m_vehicleFlagsForbidden) & flags) == meshInfo.m_vehicleFlagsRequired && (meshInfo.m_variationMask & variationMask) == 0 && meshInfo.m_parkedFlagsRequired == VehicleParked.Flags.None) || (flag && BuildingDecoration.IsSubMeshRendered(subInfo)))
                        {
                            if (!(subInfo != null))
                            {
                                continue;
                            }
                            instance.m_drawCallData.m_defaultCalls++;
                            if (underground)
                            {
                                if (subInfo.m_undergroundMaterial == null && subInfo.m_material != null)
                                {
                                    VehicleProperties properties = instance.m_properties;
                                    if (properties != null)
                                    {
                                        subInfo.m_undergroundMaterial = new Material(properties.m_undergroundShader);
                                        subInfo.m_undergroundMaterial.CopyPropertiesFromMaterial(subInfo.m_material);
                                    }
                                }
                                subInfo.m_undergroundMaterial.SetVectorArray(instance.ID_TyreLocation, subInfo.m_generatedInfo.m_tyres);
                                if (j == 1)
                                {
                                    Graphics.DrawMesh(subInfo.m_mesh, originalBodyMatrix, subInfo.m_undergroundMaterial, instance.m_undergroundLayer, null, 0, materialBlock);
                                }
                                else
                                {
                                    Graphics.DrawMesh(subInfo.m_mesh, bodyMatrix, subInfo.m_undergroundMaterial, instance.m_undergroundLayer, null, 0, materialBlock);
                                }
                            }
                            if (overground)
                            {
                                subInfo.m_material.SetVectorArray(instance.ID_TyreLocation, subInfo.m_generatedInfo.m_tyres);
                                if (j == 1)
                                {
                                    Graphics.DrawMesh(subInfo.m_mesh, originalBodyMatrix, subInfo.m_material, info.m_prefabDataLayer, null, 0, materialBlock);
                                }
                                else
                                {
                                    Graphics.DrawMesh(subInfo.m_mesh, bodyMatrix, subInfo.m_material, info.m_prefabDataLayer, null, 0, materialBlock);
                                }
                            }
                        }
                        else if (subInfo == null)
                        {
                            flag2 = false;
                        }
                    }
                }
                if (!flag2)
                {
                    // return false to skip the original method
                    return(false);
                }
                instance.m_drawCallData.m_defaultCalls++;
                if (underground)
                {
                    if (info.m_undergroundMaterial == null && info.m_material != null)
                    {
                        VehicleProperties properties2 = instance.m_properties;
                        if (properties2 != null)
                        {
                            info.m_undergroundMaterial = new Material(properties2.m_undergroundShader);
                            info.m_undergroundMaterial.CopyPropertiesFromMaterial(info.m_material);
                        }
                    }
                    info.m_undergroundMaterial.SetVectorArray(instance.ID_TyreLocation, info.m_generatedInfo.m_tyres);
                    Graphics.DrawMesh(info.m_mesh, bodyMatrix, info.m_undergroundMaterial, instance.m_undergroundLayer, null, 0, materialBlock);
                }
                if (overground)
                {
                    info.m_material.SetVectorArray(instance.ID_TyreLocation, info.m_generatedInfo.m_tyres);
                    Graphics.DrawMesh(info.m_mesh, bodyMatrix, info.m_material, info.m_prefabDataLayer, null, 0, materialBlock);
                }
                // return false to skip the original method
                return(false);
            }
            Matrix4x4 bodyMatrix2         = info.m_vehicleAI.CalculateBodyMatrix(flags, ref position, ref rotation, ref scale, ref swayPosition);
            Matrix4x4 originalBodyMatrix2 = info.m_vehicleAI.CalculateBodyMatrix(flags, ref position, ref originalRotation, ref scale, ref swayPosition);

            if (Singleton <ToolManager> .instance.m_properties.m_mode == ItemClass.Availability.AssetEditor)
            {
                Matrix4x4             value2         = info.m_vehicleAI.CalculateTyreMatrix(flags, ref position, ref rotation, ref scale, ref bodyMatrix2);
                VehicleManager        instance2      = Singleton <VehicleManager> .instance;
                MaterialPropertyBlock materialBlock2 = instance2.m_materialBlock;
                materialBlock2.Clear();
                materialBlock2.SetMatrix(instance2.ID_TyreMatrix, value2);
                materialBlock2.SetVector(instance2.ID_TyrePosition, tyrePosition);
                materialBlock2.SetVector(instance2.ID_LightState, lightState);
                Mesh     mesh     = null;
                Material material = null;
                if (info.m_lodObject != null)
                {
                    MeshFilter component = info.m_lodObject.GetComponent <MeshFilter>();
                    if (component != null)
                    {
                        mesh = component.sharedMesh;
                    }
                    Renderer component2 = info.m_lodObject.GetComponent <Renderer>();
                    if (component2 != null)
                    {
                        material = component2.sharedMaterial;
                    }
                }
                if (mesh != null && material != null)
                {
                    materialBlock2.SetVectorArray(instance2.ID_TyreLocation, info.m_generatedInfo.m_tyres);
                    Graphics.DrawMesh(mesh, bodyMatrix2, material, info.m_prefabDataLayer, null, 0, materialBlock2);
                }
            }
            else if (Singleton <InfoManager> .instance.CurrentMode == InfoManager.InfoMode.None)
            {
                RenderGroup.MeshData effectMeshData2 = info.m_vehicleAI.GetEffectMeshData();
                EffectInfo.SpawnArea area2           = new EffectInfo.SpawnArea(bodyMatrix2, effectMeshData2, info.m_generatedInfo.m_tyres, info.m_lightPositions);
                if (info.m_effects != null)
                {
                    for (int k = 0; k < info.m_effects.Length; k++)
                    {
                        VehicleInfo.Effect effect2 = info.m_effects[k];
                        if (((effect2.m_vehicleFlagsRequired | effect2.m_vehicleFlagsForbidden) & flags) == effect2.m_vehicleFlagsRequired && effect2.m_parkedFlagsRequired == VehicleParked.Flags.None)
                        {
                            effect2.m_effect.RenderEffect(id, area2, velocity, acceleration, 1f, -1f, Singleton <SimulationManager> .instance.m_simulationTimeDelta, cameraInfo);
                        }
                    }
                }
            }
            bool flag3 = true;

            if (info.m_subMeshes != null)
            {
                for (int l = 0; l < info.m_subMeshes.Length; l++)
                {
                    VehicleInfo.MeshInfo meshInfo2 = info.m_subMeshes[l];
                    VehicleInfoBase      subInfo2  = meshInfo2.m_subInfo;
                    if (((meshInfo2.m_vehicleFlagsRequired | meshInfo2.m_vehicleFlagsForbidden) & flags) == meshInfo2.m_vehicleFlagsRequired && (meshInfo2.m_variationMask & variationMask) == 0 && meshInfo2.m_parkedFlagsRequired == VehicleParked.Flags.None)
                    {
                        if (!(subInfo2 != null))
                        {
                            continue;
                        }
                        if (underground)
                        {
                            if (l == 1)
                            {
                                subInfo2.m_undergroundLodTransforms[subInfo2.m_undergroundLodCount] = originalBodyMatrix2;
                            }
                            else
                            {
                                subInfo2.m_undergroundLodTransforms[subInfo2.m_undergroundLodCount] = bodyMatrix2;
                            }

                            subInfo2.m_undergroundLodLightStates[subInfo2.m_undergroundLodCount] = lightState;
                            subInfo2.m_undergroundLodColors[subInfo2.m_undergroundLodCount]      = color.linear;
                            subInfo2.m_undergroundLodMin = Vector3.Min(subInfo2.m_undergroundLodMin, position);
                            subInfo2.m_undergroundLodMax = Vector3.Max(subInfo2.m_undergroundLodMax, position);
                            if (++subInfo2.m_undergroundLodCount == subInfo2.m_undergroundLodTransforms.Length)
                            {
                                Vehicle.RenderUndergroundLod(cameraInfo, subInfo2);
                            }
                        }
                        if (overground)
                        {
                            if (l == 1)
                            {
                                subInfo2.m_lodTransforms[subInfo2.m_lodCount] = originalBodyMatrix2;
                            }
                            else
                            {
                                subInfo2.m_lodTransforms[subInfo2.m_lodCount] = bodyMatrix2;
                            }
                            subInfo2.m_lodLightStates[subInfo2.m_lodCount] = lightState;
                            subInfo2.m_lodColors[subInfo2.m_lodCount]      = color.linear;
                            subInfo2.m_lodMin = Vector3.Min(subInfo2.m_lodMin, position);
                            subInfo2.m_lodMax = Vector3.Max(subInfo2.m_lodMax, position);
                            if (++subInfo2.m_lodCount == subInfo2.m_lodTransforms.Length)
                            {
                                Vehicle.RenderLod(cameraInfo, subInfo2);
                            }
                        }
                    }
                    else if (subInfo2 == null)
                    {
                        flag3 = false;
                    }
                }
            }
            if (!flag3)
            {
                return(false);
            }
            if (underground)
            {
                info.m_undergroundLodTransforms[info.m_undergroundLodCount]  = bodyMatrix2;
                info.m_undergroundLodLightStates[info.m_undergroundLodCount] = lightState;
                info.m_undergroundLodColors[info.m_undergroundLodCount]      = color.linear;
                info.m_undergroundLodMin = Vector3.Min(info.m_undergroundLodMin, position);
                info.m_undergroundLodMax = Vector3.Max(info.m_undergroundLodMax, position);
                if (++info.m_undergroundLodCount == info.m_undergroundLodTransforms.Length)
                {
                    Vehicle.RenderUndergroundLod(cameraInfo, info);
                }
            }
            if (overground)
            {
                info.m_lodTransforms[info.m_lodCount]  = bodyMatrix2;
                info.m_lodLightStates[info.m_lodCount] = lightState;
                info.m_lodColors[info.m_lodCount]      = color.linear;
                info.m_lodMin = Vector3.Min(info.m_lodMin, position);
                info.m_lodMax = Vector3.Max(info.m_lodMax, position);
                if (++info.m_lodCount == info.m_lodTransforms.Length)
                {
                    Vehicle.RenderLod(cameraInfo, info);
                }
            }
            // return false to skip the original method
            return(false);
        }