예제 #1
0
        public new void SetFlyMode(bool open, bool instant = false)
        {
            if (open && TimeCircuits.FlyingCircuitsBroken)
            {
                if (VehicleControl.GetDeluxoTransformation(Vehicle) > 0)
                {
                    VehicleControl.SetDeluxoTransformation(Vehicle, 0f);
                }

                return;
            }

            Open = open;

            IsLanding = ModSettings.LandingSystem && !Open && !instant && Vehicle.HeightAboveGround <20 && Vehicle.HeightAboveGround> 0.5f && !Vehicle.IsUpsideDown && VehicleControl.GetDeluxoTransformation(Vehicle) > 0;

            if (instant)
            {
                wheelAnims.SetInstant(open);
            }
            else
            {
                wheelAnims.Play(open);
            }

            // undocced native, changes delxuo transformation
            // from land to hover
            // (DOES NOT CHANGE FLY MODE!)
            if (!IsLanding)
            {
                Function.Call((Hash)0x438b3d7ca026fe91, Vehicle, Open ? 1f : 0f);
            }
            else
            {
                Utils.DisplayHelpText(Game.GetLocalizedString("BTTFV_Input_VTOL_Tip"));
            }

            if (Open && !instant)
            {
                _flyOn.Play();
                _smokeParticles.ForEach(x => x.Play());
            }
            else if (!Open && !instant)
            {
                if (IsFlying)
                {
                    _flyOff.Play();
                }

                _hoverGlowing.DeleteProp();
            }

            IsFlying = Open;

            Function.Call(Hash._FORCE_VEHICLE_ENGINE_AUDIO, Vehicle, IsFlying ? "DELUXO" : "VIRGO");

            if (!IsLanding && !IsFlying)
            {
                Function.Call((Hash)0x1201E8A3290A3B98, Vehicle, false);
                Function.Call((Hash)0x28B18377EB6E25F6, Vehicle, false);

                Function.Call(Hash.MODIFY_VEHICLE_TOP_SPEED, Vehicle, 40f);
            }

            if (!IsFlying && IsAltitudeHolding)
            {
                IsAltitudeHolding = false;
            }

            ventGlowing?.DeleteProp();
            _hoverGlowing?.DeleteProp();
        }