public override void Process() { if (Mods.Wheel != WheelType.RailroadInvisible) { if (IsOnTracks) { Stop(); } return; } if (IsOnTracks) { IsAttachedToRogersSierra = trainHandler.IsRogersSierra; if (IsAttachedToRogersSierra) { if (Main.PlayerVehicle == Vehicle && Game.IsControlPressed(GTA.Control.VehicleAccelerate)) { trainHandler.SwitchToRegular(); } if (Main.RogersSierra.Locomotive.Speed > 0 && Utils.EntitySpeedVector(Main.RogersSierra.Locomotive).Y < 0) { trainHandler.SwitchToRegular(); } return; } else { trainHandler.IsAccelerationOn = Main.PlayerVehicle == Vehicle && Vehicle.IsVisible && Vehicle.IsEngineRunning; } if (Main.PlayerVehicle == Vehicle) { Function.Call(Hash.DISABLE_CONTROL_ACTION, 27, 59, true); } //if (Game.GameTime > _checkTime) //{ // _checkTime = Game.GameTime + 1000; // _train = World.GetClosestVehicle(Vehicle.Position, 25, ModelHandler.FreightModel, ModelHandler.SierraModel, ModelHandler.SierraTenderModel, ModelHandler.SierraDebugModel); // if (_train != null) // _speedDifference = Math.Abs(_train.GetMPHSpeed() - Vehicle.GetMPHSpeed()); // else // _train = null; //} //if (Vehicle.IsTouching(_train)) //{ // Stop(); // if (_speedDifference > 20) // Vehicle.Explode(); // return; //} if (_isReentryOn && trainHandler.AttachedToTarget && trainHandler.SpeedMPH == 0) { if (Utils.Random.NextDouble() <= 0.25f) { TrainManager.CreateFreightTrain(Vehicle, !_direction).SetToDestroy(Vehicle, 35); } _isReentryOn = false; return; } return; } //if (Utils.IsVehicleOnTracks(Vehicle)) // StartDriving(); if (Mods.Wheel == WheelType.RailroadInvisible && (trainHandler == null || !trainHandler.Exists)) { var wheelPos = new List <Vector3> { Vehicle.Bones["wheel_lf"].Position, Vehicle.Bones["wheel_rf"].Position, Vehicle.Bones["wheel_rr"].Position, Vehicle.Bones["wheel_lr"].Position }; if (wheelPos.TrueForAll(x => Utils.IsWheelOnTracks(x, Vehicle))) { StartDriving(); } } }