Ejemplo n.º 1
0
 public void UnregisterCrew(ProtoCrewMember astronaut)
 {
     if (crewData.Contains(astronaut.name))
     {
         crewData.Remove(astronaut.name);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Other mods need to call this to stop processing a ProtoVessel.
 /// Will write this into an API in future version.
 /// </summary>
 /// <param name="vessel"></param>
 public void RemoveInterestedVessel(ProtoVessel vessel)
 {
     if (InterestedVessels.Contains(vessel))
     {
         InterestedVessels.Remove(vessel);
     }
 }
        public void updateVessel(Vessel v)
        {
            List <SEP_ExperimentHandler> modules =
                (from mod in v.FindPartModulesImplementing <ModuleSEPScienceExperiment>()
                 where mod.Handler != null
                 select mod.Handler).ToList();

            if (experiments.Contains(v))
            {
                if (modules.Count > 0)
                {
                    experiments[v] = modules;
                }
                else
                {
                    experiments.Remove(v);
                    SEP_AppLauncher.Instance.removeVesselSection(v);
                }
            }
            else if (modules.Count > 0)
            {
                if (VesselUtilities.VesselHasModuleName("ModuleSEPStation", v))
                {
                    experiments.Add(v, modules);
                    SEP_AppLauncher.Instance.addVesselSection(v);
                }
            }
        }
Ejemplo n.º 4
0
 private void StageDestroy(StageGroup group)
 {
     if (panels.Contains(group))
     {
         panels[group].Destroy();
         panels[group] = null;
         panels.Remove(group);
     }
 }
Ejemplo n.º 5
0
        public static bool removeFailedContract(contractContainer c, bool warn = false)
        {
            if (failedContracts.Contains(c.ID))
            {
                failedContracts.Remove(c.ID);
                return(true);
            }
            else if (warn)
            {
                Debug.Log(string.Format("[Contract Parser] Contract Not Found In Failed Contract List [{0} ; ID: {1}]", c.Title, c.ID));
            }

            return(false);
        }
        private void removeVessel(Vessel v)
        {
            if (suitableVessels.Contains(v.id))
            {
                suitableVessels.Remove(v.id);
            }

            if (!useWaypoints)
            {
                return;
            }

            removeWaypoint(v);
        }
 internal void removeMissionList(string name, bool delete = true)
 {
     if (missionList.Contains(name))
     {
         if (delete)
         {
             contractMission c = missionList[name];
             c = null;
         }
         missionList.Remove(name);
     }
     else
     {
         DMC_MBE.LogFormatted("No Mission List Of Name: [{0}] Found", name);
     }
 }
        private void removeWaypoint(Vessel v)
        {
            if (wps.Contains(v))
            {
                Waypoint wp = wps[v];

                WaypointManager.RemoveWaypoint(wp);

                wps.Remove(v);
            }

            if (wps.Count <= 0)
            {
                waypointsOn = false;
            }
        }
        public void removeVesselSection(Vessel v)
        {
            if (v == null)
            {
                return;
            }

            if (!vessels.Contains(v.id))
            {
                return;
            }

            if (!_windowMinimized && window != null)
            {
                if (!settings.showAllVessels)
                {
                    string name = v.mainBody.bodyName;

                    int count = GetBodyVessels(name).Count - 1;

                    if (count <= 0)
                    {
                        window.RemoveBodySection(name);
                    }
                    else
                    {
                        window.UpdateBodySection(name, count);
                    }

                    if (_currentBody != name)
                    {
                        return;
                    }
                }

                window.removeVesselSection(vessels[v.id]);
            }
            else if (_windowMinimized && compactWindow != null)
            {
                if (compactWindow.ID == v.id)
                {
                    compactWindow.GoNext();
                }
            }

            vessels.Remove(v.id);
        }
Ejemplo n.º 10
0
        private IEnumerator delayedReset(bool clean)
        {
            resetting = true;

            int timer = 0;

            while (timer < reloadDelay)
            {
                timer++;
                yield return(null);
            }

            if (clean)
            {
                List <string> nullPortraits = new List <string>();

                var enumerator = currentCrew.GetDictEnumerator();

                while (enumerator.MoveNext())
                {
                    var pair = enumerator.Current;

                    if (pair.Value.ProtoCrew == null)
                    {
                        nullPortraits.Add(pair.Key);
                    }
                }

                for (int i = nullPortraits.Count - 1; i >= 0; i--)
                {
                    string s = nullPortraits[i];

                    if (currentCrew.Contains(s))
                    {
                        currentCrew.Remove(s);
                    }
                }
            }

            reload    = true;
            resetting = false;
        }
Ejemplo n.º 11
0
        void OnDestroy()
        {
#if DEBUG
            Debug.Log($"[RCSBA, ModuleForces]: OnDestroy, list {List.Count} dict {ModuleDict.Count}");
#endif
            Events.LeavingEditor     -= onLeavingEditor;
            Events.PluginDisabled    -= onPluginDisabled;
            Events.PluginEnabled     -= onPluginEnabled;
            Events.VesselPartChanged -= onPartChanged;
            Events.SelectionChanged  -= onPartChanged;
            Events.PartDrag          -= onPartChanged;
            Events.ModeChanged       -= onModeChanged;
            Events.ShipModified      -= onShipModified;

            Debug.Assert(module != null, "module != null");

            List.Remove(this);
            ModuleDict.Remove(module);

            Debug.Assert(List.Count == ModuleDict.Count,
                         "[RCSBA, ModuleForces]: OnDestroy, List.Count == ModuleDict.Count");

            destroyVectors();
        }