예제 #1
0
        public void EvaluateDiscreteAction(ControllerConfiguration controller, DiscreteAction action, FlightCtrlState state)
        {
            switch (action)
            {
            case DiscreteAction.None:
                return;

            case DiscreteAction.YawPlus:
                m_Yaw.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.YawMinus:
                m_Yaw.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.PitchPlus:
                m_Pitch.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.PitchMinus:
                m_Pitch.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.PitchTrimPlus:
                m_Pitch.SetTrim(Utility.Clamp(m_Pitch.GetTrim() + controller.discreteActionStep, -1.0f, 1.0f));
                return;

            case DiscreteAction.PitchTrimMinus:
                m_Pitch.SetTrim(Utility.Clamp(m_Pitch.GetTrim() - controller.discreteActionStep, -1.0f, 1.0f));
                return;

            case DiscreteAction.RollPlus:
                m_Roll.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.RollMinus:
                m_Roll.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.XPlus:
                m_X.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.XMinus:
                m_X.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.YPlus:
                m_Y.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.YMinus:
                m_Y.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.ZPlus:
                m_Z.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.ZMinus:
                m_Z.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.ThrottlePlus:
                m_Throttle.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.ThrottleMinus:
                m_Throttle.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.CutThrottle:
                m_Throttle.SetValue(-state.mainThrottle);
                return;

            case DiscreteAction.FullThrottle:
                m_Throttle.SetValue(1.0f - state.mainThrottle);
                return;

            case DiscreteAction.NextPreset:
                if (controller.currentPreset >= controller.presets.Count - 1)
                {
                    return;
                }

                controller.currentPreset++;
                ScreenMessages.PostScreenMessage("PRESET: " + controller.GetCurrentPreset().name.ToUpper(), 1.0f, ScreenMessageStyle.UPPER_CENTER);
                return;

            case DiscreteAction.PreviousPreset:
                if (controller.currentPreset <= 0)
                {
                    return;
                }

                controller.currentPreset--;
                ScreenMessages.PostScreenMessage("PRESET: " + controller.GetCurrentPreset().name.ToUpper(), 1.0f, ScreenMessageStyle.UPPER_CENTER);
                return;

            case DiscreteAction.CyclePresets:
                controller.currentPreset++;
                if (controller.currentPreset >= controller.presets.Count)
                {
                    controller.currentPreset = 0;
                }
                ScreenMessages.PostScreenMessage("PRESET: " + controller.GetCurrentPreset().name.ToUpper(), 1.0f, ScreenMessageStyle.LOWER_CENTER);
                return;

            case DiscreteAction.CameraZoomPlus:
                m_CameraZoom.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraZoomMinus:
                m_CameraZoom.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraXPlus:
                m_CameraHeading.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraXMinus:
                m_CameraHeading.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraYPlus:
                m_CameraPitch.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraYMinus:
                m_CameraPitch.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.OrbitMapToggle:
                if (!MapView.MapIsEnabled)
                {
                    MapView.EnterMapView();
                }
                else
                {
                    MapView.ExitMapView();
                }
                return;

            case DiscreteAction.TimeWarpPlus:
                WarpController.IncreaseWarp();
                return;

            case DiscreteAction.TimeWarpMinus:
                WarpController.DecreaseWarp();
                return;

            case DiscreteAction.PhysicsTimeWarpPlus:
                WarpController.IncreasePhysicsWarp();
                return;

            case DiscreteAction.PhysicsTimeWarpMinus:
                WarpController.DecreasePhysicsWarp();
                return;

            case DiscreteAction.NavballToggle:
                if (MapView.MapIsEnabled && MapView.fetch != null)
                {
                    MapView.fetch.maneuverModeToggle.OnPress.Invoke();
                }
                return;

            case DiscreteAction.IVAViewToggle:
                if (CameraManager.Instance != null)
                {
                    CameraManager.Instance.SetCameraIVA();
                }
                return;

            case DiscreteAction.CameraViewToggle:
                if (FlightCamera.fetch != null)
                {
                    FlightCamera.fetch.SetNextMode();
                }
                return;

            case DiscreteAction.SASHold:
                FlightGlobals.ActiveVessel.ActionGroups.SetGroup(KSPActionGroup.SAS, true);
                return;

            case DiscreteAction.TogglePrecisionControls:
                if (FlightInputHandler.fetch != null)
                {
                    FlightInputHandler.fetch.precisionMode = !FlightInputHandler.fetch.precisionMode;
                    //Change color on flight input gauges manually. Hardcoded colors, but unlikely to change.
                    foreach (var r in FlightInputHandler.fetch.inputGaugeRenderers)
                    {
                        if (FlightInputHandler.fetch.precisionMode)
                        {
                            r.material.color = new Color(0.255f, 0.992f, 0.996f);
                        }
                        else
                        {
                            r.material.color = new Color(0.976f, 0.451f, 0.024f);
                        }
                    }
                }
                return;

            case DiscreteAction.ResetTrim:
                m_Yaw.SetTrim(0.0f);
                m_Pitch.SetTrim(0.0f);
                m_Roll.SetTrim(0.0f);
                state.ResetTrim();
                return;

            case DiscreteAction.IVANextCamera:
                CameraController.Instance.NextIVACamera();
                return;

            case DiscreteAction.IVALookWindow:
                CameraController.Instance.FocusIVAWindow();
                return;
            }

            if (m_DisableVesselControls)
            {
                return;
            }

            // all other actions
            switch (action)
            {
            case DiscreteAction.Stage:
                Staging.ActivateNextStage();
                return;

            case DiscreteAction.Gear:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Gear);
                return;

            case DiscreteAction.Light:
                EVAController.Instance.ToggleHeadlamp();
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Light);
                return;

            case DiscreteAction.RCS:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.RCS);
                return;

            case DiscreteAction.SAS:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.SAS);
                return;

            case DiscreteAction.Brakes:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Brakes);
                return;

            case DiscreteAction.BrakesHold:
                FlightGlobals.ActiveVessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, true);
                return;

            case DiscreteAction.Abort:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Abort);
                return;

            case DiscreteAction.Custom01:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom01);
                return;

            case DiscreteAction.Custom02:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom02);
                return;

            case DiscreteAction.Custom03:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom03);
                return;

            case DiscreteAction.Custom04:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom04);
                return;

            case DiscreteAction.Custom05:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom05);
                return;

            case DiscreteAction.Custom06:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom06);
                return;

            case DiscreteAction.Custom07:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom07);
                return;

            case DiscreteAction.Custom08:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom08);
                return;

            case DiscreteAction.Custom09:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom09);
                return;

            case DiscreteAction.Custom10:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom10);
                return;

            case DiscreteAction.SASHold:
                FlightGlobals.ActiveVessel.ActionGroups.SetGroup(KSPActionGroup.SAS, true);
                return;

            case DiscreteAction.LockStage:
                if (FlightInputHandler.fetch != null)
                {
                    FlightInputHandler.fetch.stageLock = !FlightInputHandler.fetch.stageLock;
                }
                return;

            case DiscreteAction.EVAInteract:
                EVAController.Instance.DoInteract();
                return;

            case DiscreteAction.EVAJump:
                EVAController.Instance.DoJump();
                return;

            case DiscreteAction.EVAToggleJetpack:
                EVAController.Instance.ToggleJetpack();
                return;

            case DiscreteAction.EVAAutoRunToggle:
                EVAController.Instance.ToggleAutorun();
                return;

            case DiscreteAction.EVAPlantFlag:
                EVAController.Instance.DoPlantFlag();
                return;
            }
        }
        public void EvaluateDiscreteAction(ControllerConfiguration controller, DiscreteAction action, FlightCtrlState state)
        {
            KerbalEVA eva = null;

            if (FlightGlobals.ActiveVessel.isEVA)
            {
                eva = FlightGlobals.ActiveVessel.GetComponent <KerbalEVA>();
            }

            switch (action)
            {
            case DiscreteAction.None:
                return;

            case DiscreteAction.YawPlus:
                m_Yaw.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.YawMinus:
                m_Yaw.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.PitchPlus:
                m_Pitch.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.PitchMinus:
                m_Pitch.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.RollPlus:
                m_Roll.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.RollMinus:
                m_Roll.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.XPlus:
                m_X.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.XMinus:
                m_X.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.YPlus:
                m_Y.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.YMinus:
                m_Y.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.ZPlus:
                m_Z.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.ZMinus:
                m_Z.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.ThrottlePlus:
                m_Throttle.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.ThrottleMinus:
                m_Throttle.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.Stage:
                Staging.ActivateNextStage();
                return;

            case DiscreteAction.Gear:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Gear);
                return;

            case DiscreteAction.Light:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Light);
                return;

            case DiscreteAction.RCS:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.RCS);
                return;

            case DiscreteAction.SAS:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.SAS);
                return;

            case DiscreteAction.Brakes:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Brakes);
                return;

            case DiscreteAction.Abort:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Abort);
                return;

            case DiscreteAction.Custom01:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom01);
                return;

            case DiscreteAction.Custom02:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom02);
                return;

            case DiscreteAction.Custom03:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom03);
                return;

            case DiscreteAction.Custom04:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom04);
                return;

            case DiscreteAction.Custom05:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom05);
                return;

            case DiscreteAction.Custom06:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom06);
                return;

            case DiscreteAction.Custom07:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom07);
                return;

            case DiscreteAction.Custom08:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom08);
                return;

            case DiscreteAction.Custom09:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom09);
                return;

            case DiscreteAction.Custom10:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom10);
                return;

            case DiscreteAction.EVAToggleJetpack:
                if (eva != null)
                {
                    eva.JetpackDeployed = !eva.JetpackDeployed;
                }
                return;

            case DiscreteAction.EVAToggleHeadlamps:
                if (eva != null)
                {
                    eva.lampOn = !eva.lampOn;
                }
                return;

            case DiscreteAction.CutThrottle:
                m_Throttle.SetValue(-state.mainThrottle);
                return;

            case DiscreteAction.FullThrottle:
                m_Throttle.SetValue(1.0f - state.mainThrottle);
                return;

            case DiscreteAction.NextPreset:
                if (controller.currentPreset >= controller.presets.Count - 1)
                {
                    return;
                }

                controller.currentPreset++;
                ScreenMessages.PostScreenMessage("PRESET: " + controller.GetCurrentPreset().name.ToUpper(), 1.0f, ScreenMessageStyle.UPPER_CENTER);
                return;

            case DiscreteAction.PreviousPreset:
                if (controller.currentPreset <= 0)
                {
                    return;
                }

                controller.currentPreset--;
                ScreenMessages.PostScreenMessage("PRESET: " + controller.GetCurrentPreset().name.ToUpper(), 1.0f, ScreenMessageStyle.UPPER_CENTER);
                return;

            case DiscreteAction.CyclePresets:
                controller.currentPreset++;
                if (controller.currentPreset >= controller.presets.Count)
                {
                    controller.currentPreset = 0;
                }
                ScreenMessages.PostScreenMessage("PRESET: " + controller.GetCurrentPreset().name.ToUpper(), 1.0f, ScreenMessageStyle.LOWER_CENTER);
                return;

            case DiscreteAction.CameraZoomPlus:
                m_CameraZoom.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraZoomMinus:
                m_CameraZoom.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraXPlus:
                m_CameraHeading.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraXMinus:
                m_CameraHeading.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraYPlus:
                m_CameraPitch.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraYMinus:
                m_CameraPitch.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.OrbitMapToggle:
                if (!MapView.MapIsEnabled)
                {
                    MapView.EnterMapView();
                }
                else
                {
                    MapView.ExitMapView();
                }
                return;

            case DiscreteAction.TimeWarpPlus:
                WarpController.IncreaseWarp();
                return;

            case DiscreteAction.TimeWarpMinus:
                WarpController.DecreaseWarp();
                return;

            case DiscreteAction.PhysicsTimeWarpPlus:
                WarpController.IncreasePhysicsWarp();
                return;

            case DiscreteAction.PhysicsTimeWarpMinus:
                WarpController.DecreasePhysicsWarp();
                return;

            case DiscreteAction.NavballToggle:
                if (MapView.MapIsEnabled && MapView.fetch != null)
                {
                    MapView.fetch.maneuverModeToggle.OnPress.Invoke();
                }
                return;

            case DiscreteAction.IVAViewToggle:
                if (CameraManager.Instance != null)
                {
                    CameraManager.Instance.SetCameraIVA();
                }
                return;

            case DiscreteAction.CameraViewToggle:
                if (FlightCamera.fetch != null)
                {
                    FlightCamera.fetch.SetNextMode();
                }
                return;

            case DiscreteAction.SASHold:
                FlightGlobals.ActiveVessel.ActionGroups.SetGroup(KSPActionGroup.SAS, true);
                return;

            case DiscreteAction.LockStage:
                if (FlightInputHandler.fetch != null)
                {
                    FlightInputHandler.fetch.stageLock = !FlightInputHandler.fetch.stageLock;
                }
                return;

            case DiscreteAction.TogglePrecisionControls:
                if (FlightInputHandler.fetch != null)
                {
                    FlightInputHandler.fetch.precisionMode = !FlightInputHandler.fetch.precisionMode;
                }
                return;

            case DiscreteAction.ResetTrim:
                m_Yaw.SetTrim(0.0f);
                m_Pitch.SetTrim(0.0f);
                m_Roll.SetTrim(0.0f);
                state.ResetTrim();
                return;
            }
        }
예제 #3
0
        public void EvaluateDiscreteAction(ControllerConfiguration controller, DiscreteAction action, FlightCtrlState state)
        {
            switch (action)
            {
            case DiscreteAction.None:
                return;

            case DiscreteAction.YawPlus:
                m_Yaw.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.YawMinus:
                m_Yaw.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.PitchPlus:
                m_Pitch.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.PitchMinus:
                m_Pitch.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.PitchTrimPlus:
                m_Pitch.SetTrim(Utility.Clamp(m_Pitch.GetTrim() + controller.discreteActionStep, -1.0f, 1.0f));
                return;

            case DiscreteAction.PitchTrimMinus:
                m_Pitch.SetTrim(Utility.Clamp(m_Pitch.GetTrim() - controller.discreteActionStep, -1.0f, 1.0f));
                return;

            case DiscreteAction.RollPlus:
                m_Roll.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.RollMinus:
                m_Roll.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.XPlus:
                m_X.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.XMinus:
                m_X.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.YPlus:
                m_Y.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.YMinus:
                m_Y.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.ZPlus:
                m_Z.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.ZMinus:
                m_Z.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.ThrottlePlus:
                m_Throttle.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.ThrottleMinus:
                m_Throttle.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.CutThrottle:
                m_Throttle.SetValue(-state.mainThrottle);
                return;

            case DiscreteAction.FullThrottle:
                m_Throttle.SetValue(1.0f - state.mainThrottle);
                return;

            case DiscreteAction.NextPreset:
                if (controller.currentPreset >= controller.presets.Count - 1)
                {
                    return;
                }

                controller.currentPreset++;
                ScreenMessages.PostScreenMessage("PRESET: " + controller.GetCurrentPreset().name.ToUpper(), 1.0f, ScreenMessageStyle.UPPER_CENTER);
                return;

            case DiscreteAction.PreviousPreset:
                if (controller.currentPreset <= 0)
                {
                    return;
                }

                controller.currentPreset--;
                ScreenMessages.PostScreenMessage("PRESET: " + controller.GetCurrentPreset().name.ToUpper(), 1.0f, ScreenMessageStyle.UPPER_CENTER);
                return;

            case DiscreteAction.CyclePresets:
                controller.currentPreset++;
                if (controller.currentPreset >= controller.presets.Count)
                {
                    controller.currentPreset = 0;
                }
                ScreenMessages.PostScreenMessage("PRESET: " + controller.GetCurrentPreset().name.ToUpper(), 1.0f, ScreenMessageStyle.LOWER_CENTER);
                return;

            case DiscreteAction.CameraZoomPlus:
                m_CameraZoom.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraZoomMinus:
                m_CameraZoom.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraXPlus:
                m_CameraHeading.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraXMinus:
                m_CameraHeading.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraYPlus:
                m_CameraPitch.SetIncrement(1, controller.discreteActionStep);
                return;

            case DiscreteAction.CameraYMinus:
                m_CameraPitch.SetIncrement(-1, controller.discreteActionStep);
                return;

            case DiscreteAction.OrbitMapToggle:
                if (!MapView.MapIsEnabled)
                {
                    MapView.EnterMapView();
                }
                else
                {
                    MapView.ExitMapView();
                }
                return;

            case DiscreteAction.TimeWarpPlus:
                WarpController.IncreaseWarp();
                return;

            case DiscreteAction.TimeWarpMinus:
                WarpController.DecreaseWarp();
                return;

            case DiscreteAction.PhysicsTimeWarpPlus:
                WarpController.IncreasePhysicsWarp();
                return;

            case DiscreteAction.PhysicsTimeWarpMinus:
                WarpController.DecreasePhysicsWarp();
                return;

            case DiscreteAction.StopWarp:
                WarpController.StopWarp();
                return;

            case DiscreteAction.NavballToggle:
                if (MapView.MapIsEnabled && MapView.fetch != null)
                {
                    //  MapView.fetch.maneuverModeToggle.OnPress.Invoke();
                }
                return;

            case DiscreteAction.IVAViewToggle:
                if (CameraManager.Instance != null)
                {
                    CameraManager.Instance.SetCameraIVA();
                }
                return;

            case DiscreteAction.CameraViewToggle:
                if (FlightCamera.fetch != null)
                {
                    FlightCamera.fetch.SetNextMode();
                }
                return;

            case DiscreteAction.SASHold:
                FlightGlobals.ActiveVessel.ActionGroups.SetGroup(KSPActionGroup.SAS, true);
                return;

            case DiscreteAction.SASStabilityAssist:
                setAutopilotMode(VesselAutopilot.AutopilotMode.StabilityAssist, 0);
                return;

            case DiscreteAction.SASPrograde:
                setAutopilotMode(VesselAutopilot.AutopilotMode.Prograde, 1);
                return;

            case DiscreteAction.SASRetrograde:
                setAutopilotMode(VesselAutopilot.AutopilotMode.Retrograde, 2);
                return;

            case DiscreteAction.SASNormal:
                setAutopilotMode(VesselAutopilot.AutopilotMode.Normal, 3);
                return;

            case DiscreteAction.SASAntinormal:
                setAutopilotMode(VesselAutopilot.AutopilotMode.Antinormal, 4);
                return;

            case DiscreteAction.SASRadialIn:
                setAutopilotMode(VesselAutopilot.AutopilotMode.RadialIn, 5);
                return;

            case DiscreteAction.SASRadialOut:
                setAutopilotMode(VesselAutopilot.AutopilotMode.RadialOut, 6);
                return;

            case DiscreteAction.SASManeuver:
                setAutopilotMode(VesselAutopilot.AutopilotMode.Maneuver, 7);
                return;

            case DiscreteAction.SASTarget:
                setAutopilotMode(VesselAutopilot.AutopilotMode.Target, 8);
                return;

            case DiscreteAction.SASAntiTarget:
                setAutopilotMode(VesselAutopilot.AutopilotMode.AntiTarget, 9);
                return;

            case DiscreteAction.SASManeuverOrTarget:
                if (!setAutopilotMode(VesselAutopilot.AutopilotMode.Maneuver, 7))
                {
                    setAutopilotMode(VesselAutopilot.AutopilotMode.Target, 8);
                }
                ;
                return;

            case DiscreteAction.TogglePrecisionControls:
                if (FlightInputHandler.fetch != null)
                {
                    FlightInputHandler.fetch.precisionMode = !FlightInputHandler.fetch.precisionMode;
                    GameEvents.Input.OnPrecisionModeToggle.Fire(FlightInputHandler.fetch.precisionMode);
                }
                return;

            case DiscreteAction.ResetTrim:
                m_Yaw.SetTrim(0.0f);
                m_Pitch.SetTrim(0.0f);
                m_Roll.SetTrim(0.0f);
                return;

            case DiscreteAction.IVANextCamera:
                CameraController.Instance.NextIVACamera();
                return;

            case DiscreteAction.IVALookWindow:
                CameraController.Instance.FocusIVAWindow();
                return;
            }

            if (m_DisableVesselControls)
            {
                return;
            }

            // all other actions
            switch (action)
            {
            case DiscreteAction.Stage:
                KSP.UI.Screens.StageManager.ActivateNextStage();
                return;

            case DiscreteAction.Gear:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Gear);
                return;

            case DiscreteAction.Light:
                EVAController.Instance.ToggleHeadlamp();
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Light);
                return;

            case DiscreteAction.RCS:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.RCS);
                return;

            case DiscreteAction.SAS:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.SAS);
                return;

            case DiscreteAction.Brakes:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Brakes);
                return;

            case DiscreteAction.BrakesHold:
                FlightGlobals.ActiveVessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, true);
                return;

            case DiscreteAction.Abort:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Abort);
                return;

            case DiscreteAction.Custom01:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom01);
                return;

            case DiscreteAction.Custom02:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom02);
                return;

            case DiscreteAction.Custom03:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom03);
                return;

            case DiscreteAction.Custom04:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom04);
                return;

            case DiscreteAction.Custom05:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom05);
                return;

            case DiscreteAction.Custom06:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom06);
                return;

            case DiscreteAction.Custom07:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom07);
                return;

            case DiscreteAction.Custom08:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom08);
                return;

            case DiscreteAction.Custom09:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom09);
                return;

            case DiscreteAction.Custom10:
                FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(KSPActionGroup.Custom10);
                return;

            case DiscreteAction.SASHold:
                FlightGlobals.ActiveVessel.ActionGroups.SetGroup(KSPActionGroup.SAS, true);
                return;

            case DiscreteAction.LockStage:
                if (FlightInputHandler.fetch != null)
                {
                    FlightInputHandler.fetch.stageLock = !FlightInputHandler.fetch.stageLock;
                }
                return;

            case DiscreteAction.EVAInteract:
                EVAController.Instance.DoInteract();
                return;

            case DiscreteAction.EVAJump:
                EVAController.Instance.DoJump();
                return;

            case DiscreteAction.EVAToggleJetpack:
                EVAController.Instance.ToggleJetpack();
                return;

            case DiscreteAction.EVAAutoRunToggle:
                EVAController.Instance.ToggleAutorun();
                return;

            case DiscreteAction.EVAPlantFlag:
                EVAController.Instance.DoPlantFlag();
                return;
            }
        }