public override void Process() { if (IsOn && Main.PlayerVehicle != null && Main.PlayerVehicle == Vehicle) { if (EnterInputBuffer) { EnterInputBuffer = false; ProcessInputEnter(); } if (InputBuffer != null) { ProcessInputNumber(InputBuffer); InputBuffer = null; } } if (Main.PlayerVehicle == null || !DeloreanHandler.IsVehicleATimeMachine(Main.PlayerVehicle) || (Main.PlayerVehicle == Vehicle && !IsOn)) { if (EnterInputBuffer) { EnterInputBuffer = false; } InputBuffer = null; } if (Game.GameTime > _nextReset) { _destinationTimeRaw = string.Empty; } }
private bool TrySelectCar(int index, bool preview = true) { DeloreanTimeMachine timeMachine = DeloreanHandler.GetTimeMachineFromIndex(index); if (timeMachine != null) { float dist = timeMachine.Vehicle.Position.DistanceToSquared(Main.PlayerPed.Position); if (dist <= RCManager.MAX_DIST * RCManager.MAX_DIST) { _currentTimeMachine = timeMachine; if (preview) { PreviewCar(timeMachine); } return(true); } else { if (preview) { StopPreviewing(); } return(false); } } return(false); }
private void SpawnMenu_OnMenuOpen(UIMenu sender) { if (ForceNew || (Main.PlayerVehicle == null || !DeloreanHandler.IsVehicleATimeMachine(Main.PlayerVehicle))) { if (ForceNew) { ForceNew = false; } Vector3 spawnPos = Main.PlayerPed.Position; if (Main.PlayerVehicle != null) { spawnPos = Main.PlayerVehicle.Position.Around(5f); } _tempTimeMachine = (DeloreanTimeMachine)DMC12.CreateDelorean(spawnPos, Main.PlayerPed.Heading, DeloreanType.BTTF1); Main.PlayerPed.SetIntoVehicle(_tempTimeMachine.Vehicle, VehicleSeat.Driver); _tempTimeMachine.Vehicle.PlaceOnGround(); _tempTimeMachine.MPHSpeed = 1; } else if (DeloreanHandler.IsVehicleATimeMachine(Main.PlayerVehicle)) { _tempTimeMachine = DeloreanHandler.GetTimeMachineFromVehicle(Main.PlayerVehicle); _save = true; _wheelsType.Enabled = !_tempTimeMachine.Circuits.IsFlying; } LoadVehicleType(); }
private void CheckForCargoVehicle() { if (IsPlayerInAnyVehicle && Vehicle.Position.DistanceTo(Main.PlayerVehicle.Position) <= 2.4f) { cargoVehicle = Main.PlayerVehicle; if (DeloreanHandler.IsVehicleATimeMachine(cargoVehicle)) { DeloreanHandler.GetTimeMachineFromVehicle(cargoVehicle).Circuits.GetHandler <FlyingHandler>().CanConvert = false; } } }
public void Process() { //if (IsPlayerInsideVan && Game.IsControlJustPressed(GTA.Control.VehicleHandbrake)) // ToggleRampAnimation(); if (doAnimation) { ProcessAnimation(); } //Vehicle.Doors[VehicleDoorIndex.Trunk].AngleRatio = 0.71f; Vehicle.Doors[VehicleDoorIndex.Trunk].CanBeBroken = false; finalRamp.ProcessPropExistance(); rampSupports.ProcessPropExistance(); finalRamp.Prop.IsCollisionEnabled = true; rampSupports.Prop.IsCollisionEnabled = true; if (cargoVehicle == null) { CheckForCargoVehicle(); } else if (!IsCargoVehicleInside && Vehicle.Position.DistanceTo(cargoVehicle.Position) > 2.6f) { if (DeloreanHandler.IsVehicleATimeMachine(cargoVehicle)) { DeloreanHandler.GetTimeMachineFromVehicle(cargoVehicle).Circuits.GetHandler <FlyingHandler>().CanConvert = true; } cargoVehicle = null; } if (Game.IsControlJustPressed(GTA.Control.VehicleDuck)) { if (IsCargoVehicleInside) { if (IsPlayerInsideVan) { ToggleCargoVehicle(); } } else { if (IsPlayerInsideCargo) { ToggleCargoVehicle(); } } } }
private void PresetsMenu_OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index) { if (ModSettings.CinematicSpawn) { DeloreanHandler.SpawnWithReentry(DeloreanType.BTTF1, selectedItem.Text); } else { DeloreanHandler.Spawn(DeloreanType.BTTF1).Mods.Load(selectedItem.Text); } Main.MenuPool.CloseAllMenus(); }
public static void EnterGarage(Vehicle vehicle) { var delorean = DeloreanHandler.GetDeloreanFromVehicle(vehicle); currentVehicle = vehicle; if (delorean != null) { currentDelorean = delorean; } IsInGarage = true; isEnteringGarage = true; }
public static void SetupJump(TimeCircuits timeCircuits, DateTime time) { Utils.DeleteNearbyVehPed(); // Try to find a stored moment for our time jump var moment = GetStoredMoment(time, 6); if (moment != null) { // We found a moment. // Apply it. ApplyMoment(moment); } else { // Get the current Moment object for current situation. var currentMoment = GetMomentForNow(); // Clear the entered vehicles list vehiclesEnteredByPlayer.Clear(); // We didn't find a moment. // Randomise. Randomize(timeCircuits); // Get the moment AFTER randomizing var newMoment = GetMomentForNow(); newMoment.CurrentDate = timeCircuits.DestinationTime; // Add both moments to stored Moments list. momentsInTime.Add(moment); momentsInTime.Add(newMoment); } DeloreanHandler.ExistenceCheck(time); RemoteDeloreansHandler.ExistenceCheck(time); RogersSierra.Manager.RogersSierra?.Delete(); }
public static bool IsTimeMachine(this Vehicle vehicle) { return(DeloreanHandler.IsVehicleADelorean(vehicle)); }
private static void HandleSwitching() { if (isSwitching) { if (Game.GameTime < switchTimer) { return; } switch (currentSwitchStep) { case 0: Screen.FadeOut(1000); if (currentDelorean != null && currentDelorean.IsTimeMachine) { DeloreanTimeMachine timeMachine = currentDelorean as DeloreanTimeMachine; destinationTime = timeMachine.Circuits.DestinationTime; previousTime = timeMachine.Circuits.PreviousTime; } else { destinationTime = null; previousTime = null; } switchTimer = Game.GameTime + 1200; currentSwitchStep++; break; case 1: // Do the switching here // Delete old DMC12 if (currentDelorean != null) { DeloreanHandler.RemoveDelorean(currentDelorean); } else { currentVehicle?.Delete(); } // Spawn new delorean var newDelorean = DMC12.CreateDelorean(garageVehiclePosition, garageVehicleRotation.ToHeading(), switchTo, hasHook); newDelorean.Vehicle.Rotation = garageVehicleRotation; // Set the destination and previous time, so they're not lost if (switchTo != DeloreanType.DMC12 && destinationTime != null && previousTime != null) { ((DeloreanTimeMachine)newDelorean).Circuits.DestinationTime = destinationTime.GetValueOrDefault(); ((DeloreanTimeMachine)newDelorean).Circuits.PreviousTime = previousTime.GetValueOrDefault(); } // Warp player inside vehicle Main.PlayerPed.Task.WarpIntoVehicle(newDelorean, VehicleSeat.Driver); // Update variables currentVehicle = newDelorean; currentDelorean = newDelorean; // Move forward currentSwitchStep++; switchTimer = Game.GameTime + 1000; break; case 2: Screen.FadeIn(1000); UpdateGarage(); Main.MenuPool.CloseAllMenus(); garageMenu.Visible = true; switchTimer = 0; currentSwitchStep = 0; isSwitching = false; break; } } }
private static void MainMenu_OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index) { if (selectedItem == spawnPresetDelorean && DeloreanModsCopy.ListPresets().Count == 0) { Notification.Show(Game.GetLocalizedString("BTTFV_Menu_Presets_Not_Found")); } if (selectedItem == spawnCustomDelorean || selectedItem == spawnPresetDelorean) { return; } if (selectedItem == spawnDelorean) { DeloreanHandler.Spawn(DeloreanType.DMC12); Main.MenuPool.CloseAllMenus(); } if (selectedItem == spawnDelorean1) { if (ModSettings.CinematicSpawn) { DeloreanHandler.SpawnWithReentry(DeloreanType.BTTF1); } else { DeloreanHandler.Spawn(DeloreanType.BTTF1); } Main.MenuPool.CloseAllMenus(); } if (selectedItem == spawnDelorean2) { if (ModSettings.CinematicSpawn) { DeloreanHandler.SpawnWithReentry(DeloreanType.BTTF2); } else { DeloreanHandler.Spawn(DeloreanType.BTTF2); } Main.MenuPool.CloseAllMenus(); } if (selectedItem == spawnDelorean3) { if (ModSettings.CinematicSpawn) { DeloreanHandler.SpawnWithReentry(DeloreanType.BTTF3); } else { DeloreanHandler.Spawn(DeloreanType.BTTF3); } Main.MenuPool.CloseAllMenus(); } if (selectedItem == removeOtherDeloreans) { DeloreanHandler.RemoveAllDeloreans(true); RemoteDeloreansHandler.DeleteAll(); Notification.Show(Game.GetLocalizedString("BTTFV_RemovedOtherTimeMachines")); } if (selectedItem == removeAllDeloreans) { DeloreanHandler.RemoveAllDeloreans(); RemoteDeloreansHandler.DeleteAll(); Notification.Show(Game.GetLocalizedString("BTTFV_RemovedAllTimeMachines")); } if (selectedItem == removeDelorean) { var delorean = DeloreanHandler.GetDeloreanFromVehicle(Main.PlayerVehicle); if (delorean == null) { Notification.Show(Game.GetLocalizedString("BTTFV_NotSeatedInTimeMachine")); return; } DeloreanHandler.RemoveDelorean(delorean); } }
public override void Process() { _reentryTimer += Game.LastFrameTime; if (_reentryTimer > 2) { if (Vehicle.Driver == null) { Vehicle.IsHandbrakeForcedOn = false; Vehicle.SteeringAngle = 0; } } if (!IsTimeTravelling) { return; } if (!Vehicle.IsVisible) { Vehicle.IsEngineRunning = false; } if (Vehicle == null) { return; } if (Game.GameTime < gameTimer) { return; } switch (_currentStep) { case 0: TimeCircuits.Delorean.LastVelocity = Vehicle.Velocity; TimeCircuits.WasOnTracks = TimeCircuits.IsOnTracks; if (IsOnTracks) { TimeCircuits.GetHandler <RailroadHandler>().StopTrain(); } // Set previous time PreviousTime = Utils.GetWorldTime(); // Invoke delegate TimeCircuits.OnTimeTravel?.Invoke(); if (!IsRemoteControlled && Vehicle.GetPedOnSeat(VehicleSeat.Driver) == Main.PlayerPed && (!CutsceneMode || Utils.IsPlayerUseFirstPerson())) { // Create a copy of the current status of the Delorean TimeCircuits.Delorean.LastDisplacementCopy = TimeCircuits.Delorean.Copy; timeTravelAudioInstant.Play(); if (Utils.IsPlayerUseFirstPerson()) { _whiteSphere.SpawnProp(); } else { ScreenFlash.FlashScreen(0.25f); } // Have to call SetupJump manually here. TimeHandler.TimeTravelTo(TimeCircuits, DestinationTime); Stop(); TimeCircuits.GetHandler <SparksHandler>().StartTimeTravelCooldown(); if (TimeCircuits.WasOnTracks) { TimeCircuits.GetHandler <RailroadHandler>().StartDriving(true); } if (!is99) { IsFueled = false; } TimeCircuits.GetHandler <FreezeHandler>().StartFreezeHandling(!is99); if (Mods.Hoodbox == ModState.On && !TimeCircuits.IsWarmedUp) { TimeCircuits.GetHandler <HoodboxHandler>().SetInstant(); } if (Mods.Hook == HookState.On) { Mods.Hook = HookState.Removed; } if (Mods.Plate == PlateType.Outatime) { Mods.Plate = PlateType.Empty; } // Invoke delegate TimeCircuits.OnTimeTravelComplete?.Invoke(); // Stop handling Stop(); //Add LastDisplacementCopy to remote Deloreans list RemoteDeloreansHandler.AddDelorean(TimeCircuits.Delorean.LastDisplacementCopy); return; } timeTravelAudioCutscene.Play(); // Play the effects _timeTravelEffect.Play(); // Play the light explosion _lightExplosion.Play(); trails = FireTrailsHandler.SpawnForDelorean( TimeCircuits, is99, (is99 || (Mods.HoverUnderbody == ModState.On && IsFlying)) ? 1f : 45, is99 ? -1 : 15, DeloreanType == DeloreanType.BTTF1, Mods.Wheel == WheelType.RailroadInvisible ? 75 : 50); // If the Vehicle is remote controlled or the player is not the one in the driver seat if (IsRemoteControlled || Vehicle.GetPedOnSeat(VehicleSeat.Driver) != Main.PlayerPed) { MPHSpeed = 0; // Stop remote controlling TimeCircuits.GetHandler <RcHandler>()?.StopRC(); // Add to time travelled list RemoteDeloreansHandler.AddDelorean(TimeCircuits.Delorean.Copy); Utils.HideVehicle(Vehicle, true); gameTimer = Game.GameTime + 300; _currentStep++; return; } // Create a copy of the current status of the Delorean TimeCircuits.Delorean.LastDisplacementCopy = TimeCircuits.Delorean.Copy; if (Mods.HoverUnderbody == ModState.On) { CanConvert = false; } Game.Player.IgnoredByPolice = true; Main.HideGui = true; Main.DisablePlayerSwitching = true; Utils.HideVehicle(Vehicle, true); TimeCircuits.Delorean.IsInTime = true; gameTimer = Game.GameTime + 300; _currentStep++; break; case 1: _timeTravelEffect.Stop(); if (Vehicle.GetPedOnSeat(VehicleSeat.Driver) != Main.PlayerPed) { DeloreanHandler.RemoveDelorean(TimeCircuits.Delorean, true, true); return; } gameTimer = Game.GameTime + 3700; _currentStep++; break; case 2: Screen.FadeOut(1000); gameTimer = Game.GameTime + 1500; _currentStep++; break; case 3: TimeHandler.TimeTravelTo(TimeCircuits, DestinationTime); FireTrailsHandler.RemoveTrail(trails); gameTimer = Game.GameTime + 1000; _currentStep++; break; case 4: TimeCircuits.OnTimeTravelComplete?.Invoke(); gameTimer = Game.GameTime + 2000; Screen.FadeIn(1000); _currentStep++; break; case 5: //Add LastDisplacementCopy to remote Deloreans list RemoteDeloreansHandler.AddDelorean(TimeCircuits.Delorean.LastDisplacementCopy); Reenter(); ResetFields(); break; } }