Пример #1
0
        public override void Process()
        {
            _refuelPlayer.Process();

            // Pulsing animation while refueling for plutonium (bttf1) delorean
            if (Mods.Reactor == ReactorType.Nuclear && ModSettings.GlowingPlutoniumReactor)
            {
                if (!IsFueled && !IsRefueling)
                {
                    if (Mods.GlowingReactor == ModState.On)
                    {
                        Mods.GlowingReactor = ModState.Off;
                    }
                }
                else
                {
                    if (IsRefueling)
                    {
                        _reactorGlowingTime += Game.LastFrameTime;

                        if (_reactorGlowingTime > 0.25f)
                        {
                            Mods.GlowingReactor = Mods.GlowingReactor == ModState.On ? ModState.Off : ModState.On;

                            _reactorGlowingTime = 0;
                        }
                    }
                    else if (Mods.GlowingReactor != ModState.On)
                    {
                        Mods.GlowingReactor = ModState.On;

                        _reactorGlowingTime = 0;
                    }
                }
            }
            else if (Mods.GlowingReactor != ModState.Off)
            {
                Mods.GlowingReactor = ModState.Off;
            }

            // Empty animation

            // For BTTF1
            if (_isBlinking && !IsFueled && Mods.Reactor == ReactorType.Nuclear)
            {
                // Blink anim end
                if (_blinks > TotalBlinks && Game.GameTime > _nextBlink)
                {
                    _isBlinking = false;
                    _blinks     = 0;

                    SetEmpty(true);
                }
                // Keep beeping
                else if (_blinks <= TotalBlinks && Game.GameTime > _nextBlink)
                {
                    // ID is kinda off/on
                    if (_nextId == 0)
                    {
                        SetEmpty(true);

                        _nextId    = 1;
                        _nextBlink = Game.GameTime + 640;

                        _emptySound.Play();
                    }
                    else
                    {
                        SetEmpty(false);

                        _nextId    = 0;
                        _nextBlink = Game.GameTime + 200;
                    }
                    _blinks++;
                }
            }
            // For BTTF2/3
            // Fueled -> EMPTY indicator isn't glowing, EMPTY in GUI is hidden
            // Not Fueled -> Glowing EMPTY indicator inside car and in GUI
            else
            {
                if (IsFueled)
                {
                    SetEmpty(false);
                    HideEmpty();
                }
                else
                {
                    SetEmpty(true);
                }
            }

            if (IsRefueling)
            {
                if (_refuelingPed == Main.PlayerPed && Main.PlayerVehicle == null)
                {
                    Game.DisableAllControlsThisFrame();
                    Game.EnableControlThisFrame(GTA.Control.LookUpDown);
                    Game.EnableControlThisFrame(GTA.Control.LookLeftRight);
                    Game.EnableControlThisFrame(GTA.Control.NextCamera);
                    Game.EnableControlThisFrame(GTA.Control.LookBehind);
                }

                if (Game.GameTime > _refuelTimer)
                {
                    switch (_currentRefuelStep)
                    {
                    case 0:
                        _refuelPlayer.Play();
                        if (Mods.Reactor == ReactorType.Nuclear)
                        {
                            _refuelSound.Play();
                        }

                        _refuelTimer = Game.GameTime + 2500;
                        _currentRefuelStep++;
                        break;

                    case 1:
                        _refuelPlayer.Play();

                        _refuelTimer = Game.GameTime + 1300;
                        _currentRefuelStep++;
                        break;

                    case 2:
                        Stop();

                        break;
                    }
                }
            }

            if (!CanRefuel(Main.PlayerPed) || IsRefueling || IsFueled)
            {
                return;
            }

            if (!TcdEditer.IsEditing)
            {
                Utils.DisplayHelpText(Game.GetLocalizedString("BTTFV_Refuel_Hotkey"));
            }

            if (Game.IsControlJustPressed(GTA.Control.Context))
            {
                Refuel(Main.PlayerPed);
            }
        }