Пример #1
0
        public static void Unexist()
        {
            print("[IID]: Unexisting active vessel; switching to nearest controllable vessel.");
            Vessel UnexistingVessel = FlightGlobals.ActiveVessel;
            Vessel NextVessel       = FlightGlobals.FindNearestControllableVessel(UnexistingVessel);

            if (NextVessel != null)
            {
                FlightGlobals.SetActiveVessel(NextVessel);
            }
            else
            {
                return;
            }
            UnexistingVessel.MurderCrew();
            FlightGlobals.RemoveVessel(UnexistingVessel);
        }
        private static void SwitchVesselIfKillingActiveVessel(Vessel killVessel)
        {
            if (FlightGlobals.ActiveVessel && FlightGlobals.ActiveVessel.id == killVessel.id)
            {
                FlightGlobals.fetch.SetVesselTarget(null);

                //Try to switch to a nearby loaded vessel...
                var otherVessel = FlightGlobals.FindNearestControllableVessel(killVessel);
                if (otherVessel != null)
                {
                    FlightGlobals.ForceSetActiveVessel(otherVessel);
                }
                else
                {
                    HighLogic.LoadScene(GameScenes.SPACECENTER);
                }

                LunaScreenMsg.PostScreenMessage(LocalizationContainer.ScreenText.SpectatingRemoved, 10f, ScreenMessageStyle.UPPER_CENTER);
            }
        }