private void TimeMachineMenu_OnCheckboxChange(UIMenu sender, UIMenuCheckboxItem checkboxItem, bool Checked)
        {
            if (DeloreanHandler.CurrentTimeMachine == null)
            {
                return;
            }

            TimeTravelHandler timeTravelHandler = DeloreanHandler.CurrentTimeMachine.Circuits.GetHandler <TimeTravelHandler>();

            if (checkboxItem == TimeCircuitsOn)
            {
                DeloreanHandler.CurrentTimeMachine.Circuits.SetTimeCircuitsOn(Checked);
            }
            else if (checkboxItem == CutsceneMode)
            {
                timeTravelHandler.SetCutsceneMode(Checked);
            }
            else if (checkboxItem == RemoteControl)
            {
                RCManager.StopRemoteControl();
            }

            if (DeloreanHandler.CurrentTimeMachine.DeloreanType != DeloreanType.BTTF2)
            {
                return;
            }

            FlyingHandler flyingHandler = DeloreanHandler.CurrentTimeMachine.Circuits.GetHandler <FlyingHandler>();

            if (checkboxItem == FlyMode)
            {
                flyingHandler.SetFlyMode(Checked);
            }
            else if (checkboxItem == HoverMode)
            {
                flyingHandler.SetHoverMode(Checked);
            }
        }
示例#2
0
        public override void Process()
        {
            if (!IsRemoteControlled)
            {
                return;
            }

            if (Main.IsManualPlayerSwitchInProgress)
            {
                return;
            }

            if (OriginalPed == null)
            {
                return;
            }

            if (OriginalPed.HasCollided)
            {
                RCManager.StopRemoteControl();
                return;
            }

            if (Game.IsControlJustPressed(GTA.Control.VehicleExit))
            {
                RCManager.StopRemoteControl();
            }

            rcHandbrake.Process();

            //// When u go too far from clone ped, game removes collision under him and
            ////  he falls through the ground, so if player is 50 we freeze clone
            //var isCloneFreezed = Main.PlayerPed.Position.DistanceToSquared(OriginalPed.Position) >= 50*50;
            //Function.Call(Hash.FREEZE_ENTITY_POSITION, OriginalPed, isCloneFreezed);

            var origPos = OriginalPed.Position;
            var carPos  = Vehicle.Position;

            Function.Call(Hash.REQUEST_COLLISION_AT_COORD, origPos.X, origPos.Y, origPos.Z);
            Function.Call(Hash.REQUEST_COLLISION_AT_COORD, carPos.X, carPos.Y, carPos.Z);

            Function.Call(Hash.STOP_CURRENT_PLAYING_AMBIENT_SPEECH, Main.PlayerPed);
            Function.Call(Hash.STOP_CURRENT_PLAYING_SPEECH, Main.PlayerPed);
            Function.Call(Hash.STOP_CURRENT_PLAYING_AMBIENT_SPEECH, OriginalPed);
            Function.Call(Hash.STOP_CURRENT_PLAYING_SPEECH, OriginalPed);

            if (Game.IsControlJustPressed(GTA.Control.VehicleAccelerate))
            {
                rcAcceleration.Play();
            }

            if (Game.IsControlJustPressed(GTA.Control.NextCamera))
            {
                if (CurrentMode == RcModes.FromPlayerCamera)
                {
                    CurrentMode = RcModes.FromCarCamera;

                    Function.Call(Hash.CLEAR_FOCUS);

                    _camera?.Delete();
                    _camera = null;
                    World.RenderingCamera = null;

                    Function.Call(Hash.SET_FOLLOW_VEHICLE_CAM_VIEW_MODE, 0);
                }
                else if (Function.Call <int>(Hash.GET_FOLLOW_VEHICLE_CAM_VIEW_MODE) == 1)
                {
                    CurrentMode = RcModes.FromPlayerCamera;

                    Function.Call(Hash.SET_FOCUS_ENTITY, OriginalPed);

                    _camera = World.CreateCamera(GameplayCamera.Position, GameplayCamera.Rotation, GameplayCamera.FieldOfView);
                    _camera.PointAt(Vehicle);
                    World.RenderingCamera = _camera;
                }
            }

            if (CurrentMode == RcModes.FromPlayerCamera && _camera != null && _camera.Exists())
            {
                _camera.Position = OriginalPed.Bones[Bone.SkelHead].GetOffsetPosition(new Vector3(0, 0.1f, 0));
            }
        }