예제 #1
0
        public override void Stop()
        {
            _currentStep = 0;
            _gameTimer   = 0;
            IsReentering = false;

            if (Mods.HoverUnderbody == ModState.On)
            {
                CanConvert = true;
            }

            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;
            }
        }
예제 #2
0
        private void OnReentryComplete()
        {
            Stop();
            MPHSpeed = 87;

            TimeCircuits.GetHandler <FreezeHandler>().StartFreezeHandling();
        }
예제 #3
0
        public override void Process()
        {
            if (Vehicle == null || !Vehicle.Exists() || !IsOn || Vehicle.Health > 300 || DestinationTime == _errorDate)
            {
                return;
            }

            if (Game.GameTime > nextCheck)
            {
                var randomNum = Utils.Random.NextDouble();

                if (randomNum < GetProbabilityForDamage((Vehicle.Health < 100 ? 100 : Vehicle.Health)))
                {
                    // Set TCD error stuff
                    errorSound.Play();

                    TimeCircuits.GetHandler <TCDHandler>().DoGlitch();

                    nextCheck = Game.GameTime + 60000;
                }
                else
                {
                    // Update check
                    nextCheck = Game.GameTime + 3000;
                }
            }
        }
예제 #4
0
        private void SparksEnded()
        {
            Stop();

            Function.Call(Hash.DETACH_VEHICLE_FROM_ANY_TOW_TRUCK, Vehicle.Handle);

            TimeCircuits?.GetHandler <TimeTravelHandler>()?.StartTimeTravelling();
        }
예제 #5
0
        public void Reenter()
        {
            var reentryHandler = TimeCircuits.GetHandler <ReentryHandler>();

            if (!reentryHandler.IsReentering)
            {
                reentryHandler.OnReentryComplete = OnReentryComplete;
                reentryHandler.StartReentering();
            }
        }
예제 #6
0
        public void SetPhotoMode()
        {
            if (WormholeActive && !TimeCircuits.GetHandler <SparksHandler>().IsWormholePlaying)
            {
                TimeCircuits.GetHandler <SparksHandler>().StartWormhole();
            }

            if (!WormholeActive && TimeCircuits.GetHandler <SparksHandler>().IsWormholePlaying)
            {
                TimeCircuits.GetHandler <SparksHandler>().StopWormhole();
            }

            if (GlowingCoilsActive && !_coilsProp.IsSpawned)
            {
                if (Main.CurrentTime.Hour >= 20 || (Main.CurrentTime.Hour >= 0 && Main.CurrentTime.Hour <= 5))
                {
                    _coilsProp.Model = ModelHandler.CoilsGlowingNight;
                }
                else
                {
                    _coilsProp.Model = ModelHandler.CoilsGlowing;
                }

                Mods.OffCoils = ModState.Off;
                _coilsProp.SpawnProp(false);
            }

            if (!GlowingCoilsActive && _coilsProp.IsSpawned)
            {
                Mods.OffCoils = ModState.On;
                _coilsProp.DeleteProp();
            }

            if (FluxCapacitorActive && !TimeCircuits.GetHandler <FluxCapacitorHandler>().TimeTravelEffect)
            {
                TimeCircuits.GetHandler <FluxCapacitorHandler>().StartTimeTravelEffect();
            }

            if (!FluxCapacitorActive && TimeCircuits.GetHandler <FluxCapacitorHandler>().TimeTravelEffect)
            {
                TimeCircuits.GetHandler <FluxCapacitorHandler>().StartNormalFluxing();
            }

            if (IceActive && !IsFreezing)
            {
                TimeCircuits.GetHandler <FreezeHandler>().StartFreezeHandling(false);
            }

            if (!IceActive && IsFreezing)
            {
                TimeCircuits.GetHandler <FreezeHandler>().Stop();
            }

            IsPhotoModeOn = WormholeActive | GlowingCoilsActive | FluxCapacitorActive | IceActive;
        }
예제 #7
0
        private void SparksEnded()
        {
            Stop();

            Main.DisablePlayerSwitching = true;

            Function.Call(Hash.ENABLE_SPECIAL_ABILITY, Game.Player, false);

            Function.Call(Hash.DETACH_VEHICLE_FROM_ANY_TOW_TRUCK, Vehicle.Handle);

            TimeCircuits?.GetHandler <TimeTravelHandler>()?.StartTimeTravelling();
        }
예제 #8
0
        private void OnReentryComplete()
        {
            Stop();

            _reentryTimer = 0;

            if (Main.PlayerVehicle == Vehicle)
            {
                TimeCircuits.GetHandler <SparksHandler>().StartTimeTravelCooldown();
            }

            if (TimeCircuits.WasOnTracks)
            {
                TimeCircuits.GetHandler <RailroadHandler>().StartDriving(true);
            }
            else
            {
                Vehicle.Velocity = TimeCircuits.Delorean.LastVelocity;

                if (MPHSpeed == 0)
                {
                    MPHSpeed = 88;
                }
            }

            if (!is99)
            {
                IsFueled = false;
            }

            if (!IsOnTracks && Vehicle.Driver == null)
            {
                Vehicle.SteeringAngle       = Utils.Random.NextDouble() >= 0.5f ? 35 : -35;
                Vehicle.IsHandbrakeForcedOn = true;
                Vehicle.Speed = Vehicle.Speed / 2;

                VehicleControl.SetBrake(Vehicle, 1f);
            }

            TimeCircuits.Delorean.IsInTime = false;

            TimeCircuits.GetHandler <FreezeHandler>().StartFreezeHandling(!is99);

            //Function.Call(Hash.SPECIAL_ABILITY_UNLOCK, Main.PlayerPed.Model);
            Function.Call(Hash.ENABLE_SPECIAL_ABILITY, Game.Player, true);
        }
        private void Strike()
        {
            if (IsOn)
            {
                // Time travel by lightning strike
                _lightningStrike.Play();

                if (Mods.Hook == HookState.On && !IsFlying)
                {
                    TimeCircuits.GetHandler <TimeTravelHandler>().StartTimeTravelling(false, 700);
                    _flashes = 2;
                }
                else
                {
                    TimeCircuits.GetHandler <TimeTravelHandler>().StartTimeTravelling(true, 2000);
                    _flashes = 0;

                    TimeCircuits.SetTimeCircuitsBroken(true);
                }

                DeloreanCopy deloreanCopy = TimeCircuits.Delorean.Copy;
                deloreanCopy.Circuits.DestinationTime = deloreanCopy.Circuits.DestinationTime.AddYears(70);
                RemoteDeloreansHandler.AddDelorean(deloreanCopy);
            }
            else
            {
                Function.Call(Hash.FORCE_LIGHTNING_FLASH);
            }

            if (!IsFlying && !IsOn)
            {
                TimeCircuits.SetTimeCircuitsBroken(true);
            }

            if (IsFlying)
            {
                FlyingCircuitsBroken = true;
            }

            Vehicle.EngineHealth -= 700;

            _hasBeenStruckByLightning = true;
            _nextCheck = Game.GameTime + 60000;
        }
예제 #10
0
        public override void Process()
        {
            coldAudio?.Process();
            ventAudio?.Process();

            if (Vehicle.DirtLevel != 0)
            {
                Vehicle.DirtLevel = Utils.Lerp(Vehicle.DirtLevel, 0, Game.LastFrameTime * 0.1f);
                if (Vehicle.DirtLevel < 1)
                {
                    Vehicle.DirtLevel = 0;
                }
            }

            if (Vehicle == null)
            {
                return;
            }
            if (!isFreezing)
            {
                return;
            }
            if (Game.GameTime < gameTimer)
            {
                return;
            }

            switch (currentStep)
            {
            case 0:
                Vehicle.DirtLevel = 12;

                gameTimer = Game.GameTime + 2000;
                currentStep++;
                break;

            case 1:

                coldAudio.Play(Vehicle);
                gameTimer = Game.GameTime + 15000;
                currentStep++;
                break;

            case 2:

                if (DeloreanType == DeloreanType.BTTF)
                {
                    ventAudio.Play(Vehicle);
                    currentStep++;
                    gameTimer = Game.GameTime + 1000;
                }
                else
                {
                    currentStep = 4;
                    gameTimer   = Game.GameTime + 5000;
                }
                break;

            case 3:
                for (; smokeIndex < 7;)
                {
                    rightSmokePtfx.Play(true);
                    leftSmokePtfx.Play(true);

                    gameTimer = Game.GameTime + 500;

                    smokeIndex++;

                    return;
                }

                currentStep++;
                gameTimer = Game.GameTime + 1000;
                break;

            case 4:

                TimeCircuits.GetHandler <FuelHandler>().UpdateFuel();
                Stop();
                break;
            }
        }
예제 #11
0
        public override void Process()
        {
            if (!IsFreezing)
            {
                Function.Call <float>(Hash.SET_VEHICLE_ENVEFF_SCALE, Vehicle, 0f);
                return;
            }

            if (!Vehicle.IsVisible)
            {
                Stop();
            }

            // 0 is no ice
            var iceScale = Function.Call <float>(Hash.GET_VEHICLE_ENVEFF_SCALE, Vehicle);

            if (iceScale > 0f)
            {
                float newIce = Utils.Lerp(_iceMaxVal, 0f, _iceDisappearVal / _timeToDisappear);

                if (newIce <= 0.15f)
                {
                    _iceSmoke?.StopNaturally();

                    foreach (var waterDrop in _waterDrops)
                    {
                        waterDrop?.StopNaturally();
                    }

                    _coldAudio.Stop();
                    IcePlaying = false;
                }

                Function.Call <float>(Hash.SET_VEHICLE_ENVEFF_SCALE, Vehicle, newIce);

                _iceDisappearVal += Game.LastFrameTime;
            }
            else
            {
                IsFreezing = false;
                Stop();
            }

            if (!_doingFreezingSequence)
            {
                return;
            }

            if (Game.GameTime < _gameTimer)
            {
                return;
            }

            switch (_currentStep)
            {
            case 0:
                // Set the ice
                Function.Call(Hash.SET_VEHICLE_ENVEFF_SCALE, Vehicle, _iceMaxVal);

                if (Mods.Reactor == ReactorType.Nuclear)
                {
                    // Spawn the ice particles
                    _iceSmoke?.Play();

                    foreach (var waterDrop in _waterDrops)
                    {
                        UpdateDoorIce(waterDrop.BoneName.Contains("left")
                                ? VehicleDoorIndex.FrontLeftDoor
                                : VehicleDoorIndex.FrontRightDoor, waterDrop);
                    }

                    _coldAudio.Play();
                    IcePlaying = true;
                }

                _gameTimer = Game.GameTime + 2000;
                _currentStep++;
                break;

            case 1:
                _gameTimer = Game.GameTime + 15000;
                _currentStep++;
                break;

            case 2:
                if (Mods.Reactor == ReactorType.Nuclear)
                {
                    _ventAudio.Play();
                }

                _currentStep++;
                _gameTimer = Game.GameTime + 1000;
                break;

            case 3:
                if (Mods.Reactor == ReactorType.Nuclear)
                {
                    for (; _smokeIndex < 7;)
                    {
                        _rightSmokePtfx.Play();
                        _leftSmokePtfx.Play();

                        _gameTimer = Game.GameTime + 500;

                        _smokeIndex++;

                        return;
                    }
                }

                _currentStep++;
                _gameTimer = Game.GameTime + 1000;
                break;

            case 4:

                if (_fuelNotif)
                {
                    TimeCircuits.GetHandler <FuelHandler>().BlinkFuel();
                }

                _doingFreezingSequence = false;
                break;
            }
        }
예제 #12
0
        public override void Process()
        {
            timeTravelAudio?.Process();

            if (Vehicle == null)
            {
                return;
            }
            if (!isTimeTravelling)
            {
                return;
            }
            if (Game.GameTime < gameTimer)
            {
                return;
            }

            switch (currentStep)
            {
            case 0:
                timeTravelAudio.Play(Vehicle);

                // If the current Time Travel mode is Instant
                if (CurrentMode != TimeTravelMode.CutScene)
                {
                    // Have to call SetupJump manually here.
                    TimeHandler.TimeTravelTo(TimeCircuits, DestinationTime);

                    // Set MPHSpeed
                    MPHSpeed = 65;

                    // Stop handling
                    Stop();
                    return;
                }

                TimeCircuits.GetHandler <FireTrailsHandler>().SpawnFireTrails();

                Utils.HideVehicle(Vehicle, true);

                // If the Vehicle is remote controlled or the player is not the one in the driver seat
                if (IsRemoteControlled || Vehicle.GetPedOnSeat(VehicleSeat.Driver) != Game.Player.Character)
                {
                    // Stop remote controlling
                    TimeCircuits.GetHandler <RCHandler>().StopRC();

                    // Add to time travelled list
                    TimeHandler.AddToTimeTravelledList(TimeCircuits);

                    // Reset currentStep + other fields.
                    ResetFields();
                    return;
                }

                gameTimer = Game.GameTime + 4000;

                currentStep++;
                break;

            case 1:
                Game.FadeScreenOut(1000);
                gameTimer = Game.GameTime + 1500;

                currentStep++;
                break;

            case 2:
                TimeHandler.TimeTravelTo(TimeCircuits, DestinationTime);
                TimeCircuits.GetHandler <FireTrailsHandler>().Stop();
                gameTimer = Game.GameTime + 1000;

                currentStep++;
                break;

            case 3:
                Game.FadeScreenIn(1000);
                gameTimer = Game.GameTime + 2000;

                currentStep++;
                break;

            case 4:
                Reenter();
                TimeHandler.AddToTimeTravelledList(TimeCircuits);

                ResetFields();
                break;
            }
        }
예제 #13
0
        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;
            }
        }