Exemplo n.º 1
0
        private static void ActivateActionGroup(KSPActionGroup ag)
        {
            var satellite = RTCore.Instance.Satellites[FlightGlobals.ActiveVessel];

            if (satellite != null && satellite.FlightComputer != null)
            {
                satellite.SignalProcessor.FlightComputer.Enqueue(ActionGroupCommand.WithGroup(ag));
            }
            else if (satellite == null || (satellite != null && satellite.HasLocalControl))
            {
                if (FlightGlobals.ActiveVessel.IsControllable)
                {
                    FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(ag);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called when an action group button, from the KSP GUI, is pressed.
        /// </summary>
        /// <param name="ag">The action group that was pressed.</param>
        private static void ActivateActionGroup(KSPActionGroup ag)
        {
            var satellite = RTCore.Instance.Satellites[FlightGlobals.ActiveVessel];

            if (satellite != null && satellite.FlightComputer != null)
            {
                satellite.SignalProcessor.FlightComputer.Enqueue(ActionGroupCommand.WithGroup(ag));
            }
            else if (satellite == null || (satellite != null && satellite.HasLocalControl))
            {
                if (!FlightGlobals.ready)
                {
                    return;
                }

                if (FlightGlobals.ActiveVessel.IsControllable)
                {
                    // check if EVA or not (as we removed the default KSP listener).
                    if (!FlightGlobals.ActiveVessel.isEVA)
                    {
                        FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(ag);
                    }
                    else // it's an EVA
                    {
                        if (ag == KSPActionGroup.RCS)
                        {
                            FlightGlobals.ActiveVessel.evaController.ToggleJetpack();
                        }
                        else if (ag == KSPActionGroup.Light)
                        {
                            FlightGlobals.ActiveVessel.evaController.ToggleLamp();
                        }
                    }
                }
            }
        }