Ejemplo n.º 1
0
        public void autopilotModeCallback(byte ID, object Data)
        {
            byte[] payload = (byte[])Data;
            mySASMode      = (VesselAutopilot.AutopilotMode)(payload[0]);
            myActiveVessel = FlightGlobals.ActiveVessel;

            if (myActiveVessel.Autopilot.CanSetMode(mySASMode))
            {
                myActiveVessel.Autopilot.SetMode((VesselAutopilot.AutopilotMode)mySASMode);
                if (KSPit.Config.Verbose)
                {
                    Debug.Log(String.Format("KerbalSimpit: payload is {0}", mySASMode));
                    Debug.Log(String.Format("KerbalSimpit: SAS mode is {0}", myActiveVessel.Autopilot.Mode.ToString()));
                }
            }
            else
            {
                Debug.Log(String.Format("KerbalSimpit: Unable to set SAS mode to {0}", mySASMode.ToString()));
            }
        }
Ejemplo n.º 2
0
        public void autopilotModeCallback(byte ID, object Data)
        {
            byte[] payload = (byte[])Data;

            VesselAutopilot autopilot = FlightGlobals.ActiveVessel.Autopilot;

            if (autopilot == null)
            {
                Debug.Log("KerbalSimpit : Ignoring a SAS MODE Message since I could not find the autopilot");
                return;
            }

            mySASMode = (VesselAutopilot.AutopilotMode)(payload[0]);

            if (autopilot.CanSetMode(mySASMode))
            {
                autopilot.SetMode(mySASMode);
                if (KSPit.Config.Verbose)
                {
                    Debug.Log(String.Format("KerbalSimpit: payload is {0}", mySASMode));
                    Debug.Log(String.Format("KerbalSimpit: SAS mode is {0}", FlightGlobals.ActiveVessel.Autopilot.Mode.ToString()));
                }
            }
            else
            {
                Debug.Log(String.Format("KerbalSimpit: Unable to set SAS mode to {0}", mySASMode.ToString()));
            }
        }