Beispiel #1
0
        public bool highlighted; // This allows us to remember if a part is SUPPOSED to be highlighted by CLS. We can then use appropriate moments to ensure that it either is or is not.

        public CLSPart(Part p)
        {
            part = p;

            habitable = IsHabitable(part);
            navigable = IsNavigable(part);
            space     = null;

            crew = new List <ICLSKerbal>();
            IEnumerator <ProtoCrewMember> crewmembers = p.protoModuleCrew.GetEnumerator();

            while (crewmembers.MoveNext())
            {
                if (crewmembers.Current == null)
                {
                    continue;
                }
                CLSKerbal kerbal = new CLSKerbal(crewmembers.Current, this);
                crew.Add(kerbal);
            }
            crewmembers.Dispose();

            // Does the part have a CLSModule on it? If so then give the module a reference to ourselves to make its life a bit easier.
            {
                ModuleConnectedLivingSpace m = (ModuleConnectedLivingSpace)this;
                if (null != m)
                {
                    m.clsPart = this;
                }
                else
                {
                    // Do not bother logging warnings about EVAs not being configured for CLS!
                    if (part.Modules.OfType <KerbalEVA>().Count() == 0)
                    {
                        // This part does not have a CLSModule. If it is habitable or navigable then it will not be possible to persist the name of the space in the savefile. Log a warning.
                        if (habitable)
                        {
                            Debug.LogWarning($"Part {part.partInfo.title} is habitable but does not have ModuleConnectedLivingSpace defined in the config. It would be better if it did as some infomation used by CLS will not be saved in the savefile.");
                        }
                        else if (navigable)
                        {
                            Debug.LogWarning($"Part {part.partInfo.title} is passable but does not have ModuleConnectedLivingSpace defined in the config. It would be better if it did as some infomation used by CLS will not be saved in the savefile.");
                        }
                    }
                }
            }

            // Run check for dynamic crew capacity
            if (CLSAddon.dynamicCrewCapacity)
            {
                CheckDCC();
            }
        }
        public CLSPart(Part p)
        {
            part = p;

              habitable = IsHabitable(part);
              navigable = IsNavigable(part);
              space = null;

              crew = new List<ICLSKerbal>();
              IEnumerator<ProtoCrewMember> crewmembers = p.protoModuleCrew.GetEnumerator();
              while (crewmembers.MoveNext())
              {
            if (crewmembers.Current == null) continue;
            CLSKerbal kerbal = new CLSKerbal(crewmembers.Current, this);
            crew.Add(kerbal);
              }

              // Does the part have a CLSModule on it? If so then give the module a reference to ourselves to make its life a bit easier.
              {
            ModuleConnectedLivingSpace m = (ModuleConnectedLivingSpace)this;
            if (null != m)
            {
              m.clsPart = this;
            }
            else
            {
              // Do not bother logging warnings about EVAs not being configured for CLS!
              if (part.Modules.OfType<KerbalEVA>().Count() == 0)
              {
            // This part does not have a CLSModule. If it is habitable or navigable then it will not be possible to persist the name of the space in the savefile. Log a warning.
            if (habitable)
            {
              Debug.LogWarning("Part " + part.partInfo.title + " is habitable but does not have ModuleConnectedLivingSpace defined in the config. It would be better if it did as some infomation used by CLS will not be saved in the savefile.");
            }
            else if (navigable)
            {
              Debug.LogWarning("Part " + part.partInfo.title + " is passable but does not have ModuleConnectedLivingSpace defined in the config. It would be better if it did as some infomation used by CLS will not be saved in the savefile.");
            }
              }
            }
              }
        }
        bool highlighted = false; // This allows us to remember if a part is SUPPOSED to be highlighted by CLS. We can then use appropriate moments to ensure that it either is or is not.

        public CLSPart(Part p)
        {
            this.part = p;

            habitable = IsHabitable(this.part);
            navigable = IsNavigable(this.part);
            space     = null;

            this.crew = new List <ICLSKerbal>();
            foreach (ProtoCrewMember crewMember in p.protoModuleCrew)
            {
                CLSKerbal kerbal = new CLSKerbal(crewMember, this);
                this.crew.Add(kerbal);
            }

            // Does the part have a CLSModule on it? If so then give the module a reference to ourselves to make its life a bit easier.
            {
                ModuleConnectedLivingSpace m = (ModuleConnectedLivingSpace)this;
                if (null != m)
                {
                    m.clsPart = this;
                }
                else
                {
                    // Do not bother logging warnings about EVAs not being configured for CLS!
                    if (this.part.Modules.OfType <KerbalEVA>().Count() == 0)
                    {
                        // This part does not have a CLSModule. If it is habitable or navigable then it will not be possible to persist the name of the space in the savefile. Log a warning.
                        if (this.habitable)
                        {
                            Debug.LogWarning("Part " + this.part.partInfo.title + " is habitable but does not have ModuleConnectedLivingSpace defined in the config. It would be better if it did as some infomation used by CLS will not be saved in the savefile.");
                        }
                        else if (this.navigable)
                        {
                            Debug.LogWarning("Part " + this.part.partInfo.title + " is passable but does not have ModuleConnectedLivingSpace defined in the config. It would be better if it did as some infomation used by CLS will not be saved in the savefile.");
                        }
                    }
                }
            }
        }