public override void Process() { if (Mods.HoverUnderbody == ModState.Off) { return; } // Automatically fold wheels in if fly mode is exited in any other way // Example: getting out of vehicle, flipping vehicle over, etc if (IsFlying && VehicleControl.GetDeluxoTransformation(Vehicle) <= 0) { SetFlyMode(false); } // Automatically set fly mode if deluxo is transformed in any other way. if (!IsFlying && VehicleControl.GetDeluxoTransformation(Vehicle) > 0 && !IsLanding) { SetFlyMode(true); } // Process the wheel animations wheelAnims?.Process(); _flyModeInput.Process(); if (Main.PlayerVehicle == Vehicle) { Function.Call(Hash.SET_PLAYER_CAN_DO_DRIVE_BY, Game.Player.Handle, false); } else { Function.Call(Hash.SET_PLAYER_CAN_DO_DRIVE_BY, Game.Player.Handle, true); } if (Vehicle == null || !Vehicle.IsVisible) { return; } // Process underbody lights UnderbodyLights(); if (IsLanding) { // Reset force to be applied _forceToBeApplied = Vector3.Zero; // Process up/down movement UpDown(); // Altitude holder //if (!Game.IsControlPressed(GTA.Control.VehicleFlyThrottleUp) && !Game.IsControlPressed(GTA.Control.VehicleFlyThrottleDown)) // HandleAltitudeHolding(); // Apply force Vehicle.ApplyForce(_forceToBeApplied, Vector3.Zero); if (Vehicle.HeightAboveGround < 3 && !_landingSmoke) { _smokeParticles.ForEach(x => x.Play()); _landingSmoke = true; } if (!Vehicle.IsUpsideDown && Vehicle.HeightAboveGround > 0.5f && Vehicle.HeightAboveGround < 20) { return; } SetFlyMode(false); } if (!IsFlying) { return; } if (ModSettings.TurbulenceEvent && (World.Weather == Weather.Clearing || World.Weather == Weather.Raining || World.Weather == Weather.ThunderStorm || World.Weather == Weather.Blizzard)) { if (Game.GameTime > _nextForce) { float _force = 0; switch (World.Weather) { case Weather.Clearing: _force = 0.5f; break; case Weather.Raining: _force = 0.75f; break; case Weather.ThunderStorm: case Weather.Blizzard: _force = 1; break; } _force *= (Vehicle.HeightAboveGround / 20f); if (_force > 1) { _force = 1; } Vehicle.ApplyForce(Vector3.RandomXYZ() * _force, Vector3.RandomXYZ() * _force); _nextForce = Game.GameTime + 100; } } if (TimeCircuits.FlyingCircuitsBroken) { var force = Vehicle.UpVector; if (!Vehicle.IsUpsideDown) { force.Z = -force.Z; } force *= 12 * Game.LastFrameTime; Vehicle.ApplyForce(force, Vector3.Zero); if (Vehicle.HeightAboveGround < 2) { SetFlyMode(false); } return; } // Reset force to be applied _forceToBeApplied = Vector3.Zero; // Process boost HandleBoosting(); // Process up/down movement UpDown(); // Altitude holder if (IsAltitudeHolding) { HandleAltitudeHolding(); } // Apply force Vehicle.ApplyForce(_forceToBeApplied, Vector3.Zero); // Force fly mode if (ModSettings.ForceFlyMode) { VehicleControl.SetDeluxoFlyMode(Vehicle, 1f); } // Force brake lights on if flying if (IsFlying) { Vehicle.AreBrakeLightsOn = true; } if (_startHoverGlowLater && Vehicle.IsEngineRunning) { SpawnHoverGlow(); } }
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(); }