public void SetAllow(ThingCategoryDef categoryDef, bool allow, IEnumerable <ThingDef> exceptedDefs = null, IEnumerable <SpecialThingFilterDef> exceptedFilters = null)
 {
     if (!ThingCategoryNodeDatabase.initialized)
     {
         Log.Error("SetAllow categories won't work before ThingCategoryDatabase is initialized.", false);
     }
     foreach (ThingDef thingDef in categoryDef.DescendantThingDefs)
     {
         if (exceptedDefs == null || !exceptedDefs.Contains(thingDef))
         {
             this.SetAllow(thingDef, allow);
         }
     }
     foreach (SpecialThingFilterDef specialThingFilterDef in categoryDef.DescendantSpecialThingFilterDefs)
     {
         if (exceptedFilters == null || !exceptedFilters.Contains(specialThingFilterDef))
         {
             this.SetAllow(specialThingFilterDef, allow);
         }
     }
     if (this.settingsChangedCallback != null)
     {
         this.settingsChangedCallback();
     }
 }
Exemple #2
0
 public bool IsWithinCategory(ThingCategoryDef category)
 {
     if (this.thingCategories == null)
     {
         return(false);
     }
     for (int i = 0; i < this.thingCategories.Count; i++)
     {
         if (this.thingCategories[i] == category || this.thingCategories[i].Parents.Contains(category))
         {
             return(true);
         }
     }
     return(false);
 }
        public override int CountProducts(Bill_Production bill)
        {
            if (this.stoneBlocksDefs == null)
            {
                ThingCategoryDef stoneBlocks = ThingCategoryDefOf.StoneBlocks;
                this.stoneBlocksDefs = new List <ThingDef>(16);
                foreach (ThingDef current in DefDatabase <ThingDef> .AllDefsListForReading)
                {
                    if (current.thingCategories != null && current.thingCategories.Contains(stoneBlocks))
                    {
                        this.stoneBlocksDefs.Add(current);
                    }
                }
            }
            int num = 0;

            for (int i = 0; i < this.stoneBlocksDefs.Count; i++)
            {
                num += bill.Map.resourceCounter.GetCount(this.stoneBlocksDefs[i]);
            }
            return(num);
        }
        public void ResolveReferences()
        {
            for (int i = 0; i < DefDatabase <SpecialThingFilterDef> .AllDefsListForReading.Count; i++)
            {
                SpecialThingFilterDef specialThingFilterDef = DefDatabase <SpecialThingFilterDef> .AllDefsListForReading[i];
                if (!specialThingFilterDef.allowedByDefault)
                {
                    this.SetAllow(specialThingFilterDef, false);
                }
            }
            if (this.thingDefs != null)
            {
                for (int j = 0; j < this.thingDefs.Count; j++)
                {
                    if (this.thingDefs[j] != null)
                    {
                        this.SetAllow(this.thingDefs[j], true);
                    }
                    else
                    {
                        Log.Error("ThingFilter could not find thing def named " + this.thingDefs[j], false);
                    }
                }
            }
            if (this.categories != null)
            {
                for (int k = 0; k < this.categories.Count; k++)
                {
                    ThingCategoryDef named = DefDatabase <ThingCategoryDef> .GetNamed(this.categories[k], true);

                    if (named != null)
                    {
                        this.SetAllow(named, true, null, null);
                    }
                }
            }
            if (this.tradeTagsToAllow != null)
            {
                for (int l = 0; l < this.tradeTagsToAllow.Count; l++)
                {
                    List <ThingDef> allDefsListForReading = DefDatabase <ThingDef> .AllDefsListForReading;
                    for (int m = 0; m < allDefsListForReading.Count; m++)
                    {
                        ThingDef thingDef = allDefsListForReading[m];
                        if (thingDef.tradeTags != null && thingDef.tradeTags.Contains(this.tradeTagsToAllow[l]))
                        {
                            this.SetAllow(thingDef, true);
                        }
                    }
                }
            }
            if (this.tradeTagsToDisallow != null)
            {
                for (int n = 0; n < this.tradeTagsToDisallow.Count; n++)
                {
                    List <ThingDef> allDefsListForReading2 = DefDatabase <ThingDef> .AllDefsListForReading;
                    for (int num = 0; num < allDefsListForReading2.Count; num++)
                    {
                        ThingDef thingDef2 = allDefsListForReading2[num];
                        if (thingDef2.tradeTags != null && thingDef2.tradeTags.Contains(this.tradeTagsToDisallow[n]))
                        {
                            this.SetAllow(thingDef2, false);
                        }
                    }
                }
            }
            if (this.thingSetMakerTagsToAllow != null)
            {
                for (int num2 = 0; num2 < this.thingSetMakerTagsToAllow.Count; num2++)
                {
                    List <ThingDef> allDefsListForReading3 = DefDatabase <ThingDef> .AllDefsListForReading;
                    for (int num3 = 0; num3 < allDefsListForReading3.Count; num3++)
                    {
                        ThingDef thingDef3 = allDefsListForReading3[num3];
                        if (thingDef3.thingSetMakerTags != null && thingDef3.thingSetMakerTags.Contains(this.thingSetMakerTagsToAllow[num2]))
                        {
                            this.SetAllow(thingDef3, true);
                        }
                    }
                }
            }
            if (this.thingSetMakerTagsToDisallow != null)
            {
                for (int num4 = 0; num4 < this.thingSetMakerTagsToDisallow.Count; num4++)
                {
                    List <ThingDef> allDefsListForReading4 = DefDatabase <ThingDef> .AllDefsListForReading;
                    for (int num5 = 0; num5 < allDefsListForReading4.Count; num5++)
                    {
                        ThingDef thingDef4 = allDefsListForReading4[num5];
                        if (thingDef4.thingSetMakerTags != null && thingDef4.thingSetMakerTags.Contains(this.thingSetMakerTagsToDisallow[num4]))
                        {
                            this.SetAllow(thingDef4, false);
                        }
                    }
                }
            }
            if (this.disallowedCategories != null)
            {
                for (int num6 = 0; num6 < this.disallowedCategories.Count; num6++)
                {
                    ThingCategoryDef named2 = DefDatabase <ThingCategoryDef> .GetNamed(this.disallowedCategories[num6], true);

                    if (named2 != null)
                    {
                        this.SetAllow(named2, false, null, null);
                    }
                }
            }
            if (this.specialFiltersToAllow != null)
            {
                for (int num7 = 0; num7 < this.specialFiltersToAllow.Count; num7++)
                {
                    this.SetAllow(SpecialThingFilterDef.Named(this.specialFiltersToAllow[num7]), true);
                }
            }
            if (this.specialFiltersToDisallow != null)
            {
                for (int num8 = 0; num8 < this.specialFiltersToDisallow.Count; num8++)
                {
                    this.SetAllow(SpecialThingFilterDef.Named(this.specialFiltersToDisallow[num8]), false);
                }
            }
            if (this.stuffCategoriesToAllow != null)
            {
                for (int num9 = 0; num9 < this.stuffCategoriesToAllow.Count; num9++)
                {
                    this.SetAllow(this.stuffCategoriesToAllow[num9], true);
                }
            }
            if (this.allowAllWhoCanMake != null)
            {
                for (int num10 = 0; num10 < this.allowAllWhoCanMake.Count; num10++)
                {
                    this.SetAllowAllWhoCanMake(this.allowAllWhoCanMake[num10]);
                }
            }
            if (this.disallowWorsePreferability != FoodPreferability.Undefined)
            {
                List <ThingDef> allDefsListForReading5 = DefDatabase <ThingDef> .AllDefsListForReading;
                for (int num11 = 0; num11 < allDefsListForReading5.Count; num11++)
                {
                    ThingDef thingDef5 = allDefsListForReading5[num11];
                    if (thingDef5.IsIngestible && thingDef5.ingestible.preferability != FoodPreferability.Undefined && thingDef5.ingestible.preferability < this.disallowWorsePreferability)
                    {
                        this.SetAllow(thingDef5, false);
                    }
                }
            }
            if (this.disallowInedibleByHuman)
            {
                List <ThingDef> allDefsListForReading6 = DefDatabase <ThingDef> .AllDefsListForReading;
                for (int num12 = 0; num12 < allDefsListForReading6.Count; num12++)
                {
                    ThingDef thingDef6 = allDefsListForReading6[num12];
                    if (thingDef6.IsIngestible && !ThingDefOf.Human.race.CanEverEat(thingDef6))
                    {
                        this.SetAllow(thingDef6, false);
                    }
                }
            }
            if (this.allowWithComp != null)
            {
                List <ThingDef> allDefsListForReading7 = DefDatabase <ThingDef> .AllDefsListForReading;
                for (int num13 = 0; num13 < allDefsListForReading7.Count; num13++)
                {
                    ThingDef thingDef7 = allDefsListForReading7[num13];
                    if (thingDef7.HasComp(this.allowWithComp))
                    {
                        this.SetAllow(thingDef7, true);
                    }
                }
            }
            if (this.disallowWithComp != null)
            {
                List <ThingDef> allDefsListForReading8 = DefDatabase <ThingDef> .AllDefsListForReading;
                for (int num14 = 0; num14 < allDefsListForReading8.Count; num14++)
                {
                    ThingDef thingDef8 = allDefsListForReading8[num14];
                    if (thingDef8.HasComp(this.disallowWithComp))
                    {
                        this.SetAllow(thingDef8, false);
                    }
                }
            }
            if (this.disallowCheaperThan != -3.40282347E+38f)
            {
                List <ThingDef> list = new List <ThingDef>();
                foreach (ThingDef thingDef9 in this.allowedDefs)
                {
                    if (thingDef9.BaseMarketValue < this.disallowCheaperThan)
                    {
                        list.Add(thingDef9);
                    }
                }
                for (int num15 = 0; num15 < list.Count; num15++)
                {
                    this.SetAllow(list[num15], false);
                }
            }
            if (this.disallowedThingDefs != null)
            {
                for (int num16 = 0; num16 < this.disallowedThingDefs.Count; num16++)
                {
                    if (this.disallowedThingDefs[num16] != null)
                    {
                        this.SetAllow(this.disallowedThingDefs[num16], false);
                    }
                    else
                    {
                        Log.Error("ThingFilter could not find excepted thing def named " + this.disallowedThingDefs[num16], false);
                    }
                }
            }
            this.RecalculateDisplayRootCategory();
        }
        public void ResolveReferences()
        {
            for (int i = 0; i < DefDatabase <SpecialThingFilterDef> .AllDefsListForReading.Count; i++)
            {
                SpecialThingFilterDef specialThingFilterDef = DefDatabase <SpecialThingFilterDef> .AllDefsListForReading[i];
                if (!specialThingFilterDef.allowedByDefault)
                {
                    this.SetAllow(specialThingFilterDef, false);
                }
            }
            if (this.thingDefs != null)
            {
                for (int j = 0; j < this.thingDefs.Count; j++)
                {
                    if (this.thingDefs[j] != null)
                    {
                        this.SetAllow(this.thingDefs[j], true);
                    }
                    else
                    {
                        Log.Error("ThingFilter could not find thing def named " + this.thingDefs[j]);
                    }
                }
            }
            if (this.categories != null)
            {
                for (int k = 0; k < this.categories.Count; k++)
                {
                    ThingCategoryDef named = DefDatabase <ThingCategoryDef> .GetNamed(this.categories[k], true);

                    if (named != null)
                    {
                        this.SetAllow(named, true, null, null);
                    }
                }
            }
            if (this.exceptedThingDefs != null)
            {
                for (int l = 0; l < this.exceptedThingDefs.Count; l++)
                {
                    if (this.exceptedThingDefs[l] != null)
                    {
                        this.SetAllow(this.exceptedThingDefs[l], false);
                    }
                    else
                    {
                        Log.Error("ThingFilter could not find excepted thing def named " + this.exceptedThingDefs[l]);
                    }
                }
            }
            if (this.exceptedCategories != null)
            {
                for (int m = 0; m < this.exceptedCategories.Count; m++)
                {
                    ThingCategoryDef named2 = DefDatabase <ThingCategoryDef> .GetNamed(this.exceptedCategories[m], true);

                    if (named2 != null)
                    {
                        this.SetAllow(named2, false, null, null);
                    }
                }
            }
            if (this.specialFiltersToAllow != null)
            {
                for (int n = 0; n < this.specialFiltersToAllow.Count; n++)
                {
                    this.SetAllow(SpecialThingFilterDef.Named(this.specialFiltersToAllow[n]), true);
                }
            }
            if (this.specialFiltersToDisallow != null)
            {
                for (int num = 0; num < this.specialFiltersToDisallow.Count; num++)
                {
                    this.SetAllow(SpecialThingFilterDef.Named(this.specialFiltersToDisallow[num]), false);
                }
            }
            if (this.stuffCategoriesToAllow != null)
            {
                for (int num2 = 0; num2 < this.stuffCategoriesToAllow.Count; num2++)
                {
                    this.SetAllow(this.stuffCategoriesToAllow[num2], true);
                }
            }
            if (this.allowAllWhoCanMake != null)
            {
                for (int num3 = 0; num3 < this.allowAllWhoCanMake.Count; num3++)
                {
                    this.SetAllowAllWhoCanMake(this.allowAllWhoCanMake[num3]);
                }
            }
            this.RecalculateDisplayRootCategory();
        }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    if (this.parent != null)
                    {
                        this.$current = this.parent;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        return(true);
                    }
                    goto IL_F4;

                case 1u:
                    enumerator = this.parent.Parents.GetEnumerator();
                    num        = 4294967293u;
                    break;

                case 2u:
                    break;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        cat           = enumerator.Current;
                        this.$current = cat;
                        if (!this.$disposing)
                        {
                            this.$PC = 2;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
IL_F4:
                this.$PC = -1;
                return(false);
            }
Exemple #7
0
        public void ResolveReferences()
        {
            for (int i = 0; i < DefDatabase <SpecialThingFilterDef> .AllDefsListForReading.Count; i++)
            {
                SpecialThingFilterDef specialThingFilterDef = DefDatabase <SpecialThingFilterDef> .AllDefsListForReading[i];
                if (!specialThingFilterDef.allowedByDefault)
                {
                    SetAllow(specialThingFilterDef, allow: false);
                }
            }
            if (thingDefs != null)
            {
                for (int j = 0; j < thingDefs.Count; j++)
                {
                    if (thingDefs[j] != null)
                    {
                        SetAllow(thingDefs[j], allow: true);
                    }
                    else
                    {
                        Log.Error("ThingFilter could not find thing def named " + thingDefs[j]);
                    }
                }
            }
            if (categories != null)
            {
                for (int k = 0; k < categories.Count; k++)
                {
                    ThingCategoryDef named = DefDatabase <ThingCategoryDef> .GetNamed(categories[k]);

                    if (named != null)
                    {
                        SetAllow(named, allow: true);
                    }
                }
            }
            if (tradeTagsToAllow != null)
            {
                for (int l = 0; l < tradeTagsToAllow.Count; l++)
                {
                    List <ThingDef> allDefsListForReading = DefDatabase <ThingDef> .AllDefsListForReading;
                    for (int m = 0; m < allDefsListForReading.Count; m++)
                    {
                        ThingDef thingDef = allDefsListForReading[m];
                        if (thingDef.tradeTags != null && thingDef.tradeTags.Contains(tradeTagsToAllow[l]))
                        {
                            SetAllow(thingDef, allow: true);
                        }
                    }
                }
            }
            if (tradeTagsToDisallow != null)
            {
                for (int n = 0; n < tradeTagsToDisallow.Count; n++)
                {
                    List <ThingDef> allDefsListForReading2 = DefDatabase <ThingDef> .AllDefsListForReading;
                    for (int num = 0; num < allDefsListForReading2.Count; num++)
                    {
                        ThingDef thingDef2 = allDefsListForReading2[num];
                        if (thingDef2.tradeTags != null && thingDef2.tradeTags.Contains(tradeTagsToDisallow[n]))
                        {
                            SetAllow(thingDef2, allow: false);
                        }
                    }
                }
            }
            if (thingSetMakerTagsToAllow != null)
            {
                for (int num2 = 0; num2 < thingSetMakerTagsToAllow.Count; num2++)
                {
                    List <ThingDef> allDefsListForReading3 = DefDatabase <ThingDef> .AllDefsListForReading;
                    for (int num3 = 0; num3 < allDefsListForReading3.Count; num3++)
                    {
                        ThingDef thingDef3 = allDefsListForReading3[num3];
                        if (thingDef3.thingSetMakerTags != null && thingDef3.thingSetMakerTags.Contains(thingSetMakerTagsToAllow[num2]))
                        {
                            SetAllow(thingDef3, allow: true);
                        }
                    }
                }
            }
            if (thingSetMakerTagsToDisallow != null)
            {
                for (int num4 = 0; num4 < thingSetMakerTagsToDisallow.Count; num4++)
                {
                    List <ThingDef> allDefsListForReading4 = DefDatabase <ThingDef> .AllDefsListForReading;
                    for (int num5 = 0; num5 < allDefsListForReading4.Count; num5++)
                    {
                        ThingDef thingDef4 = allDefsListForReading4[num5];
                        if (thingDef4.thingSetMakerTags != null && thingDef4.thingSetMakerTags.Contains(thingSetMakerTagsToDisallow[num4]))
                        {
                            SetAllow(thingDef4, allow: false);
                        }
                    }
                }
            }
            if (disallowedCategories != null)
            {
                for (int num6 = 0; num6 < disallowedCategories.Count; num6++)
                {
                    ThingCategoryDef named2 = DefDatabase <ThingCategoryDef> .GetNamed(disallowedCategories[num6]);

                    if (named2 != null)
                    {
                        SetAllow(named2, allow: false);
                    }
                }
            }
            if (specialFiltersToAllow != null)
            {
                for (int num7 = 0; num7 < specialFiltersToAllow.Count; num7++)
                {
                    SetAllow(SpecialThingFilterDef.Named(specialFiltersToAllow[num7]), allow: true);
                }
            }
            if (specialFiltersToDisallow != null)
            {
                for (int num8 = 0; num8 < specialFiltersToDisallow.Count; num8++)
                {
                    SetAllow(SpecialThingFilterDef.Named(specialFiltersToDisallow[num8]), allow: false);
                }
            }
            if (stuffCategoriesToAllow != null)
            {
                for (int num9 = 0; num9 < stuffCategoriesToAllow.Count; num9++)
                {
                    SetAllow(stuffCategoriesToAllow[num9], allow: true);
                }
            }
            if (allowAllWhoCanMake != null)
            {
                for (int num10 = 0; num10 < allowAllWhoCanMake.Count; num10++)
                {
                    SetAllowAllWhoCanMake(allowAllWhoCanMake[num10]);
                }
            }
            if (disallowWorsePreferability != 0)
            {
                List <ThingDef> allDefsListForReading5 = DefDatabase <ThingDef> .AllDefsListForReading;
                for (int num11 = 0; num11 < allDefsListForReading5.Count; num11++)
                {
                    ThingDef thingDef5 = allDefsListForReading5[num11];
                    if (thingDef5.IsIngestible && thingDef5.ingestible.preferability != 0 && (int)thingDef5.ingestible.preferability < (int)disallowWorsePreferability)
                    {
                        SetAllow(thingDef5, allow: false);
                    }
                }
            }
            if (disallowInedibleByHuman)
            {
                List <ThingDef> allDefsListForReading6 = DefDatabase <ThingDef> .AllDefsListForReading;
                for (int num12 = 0; num12 < allDefsListForReading6.Count; num12++)
                {
                    ThingDef thingDef6 = allDefsListForReading6[num12];
                    if (thingDef6.IsIngestible && !ThingDefOf.Human.race.CanEverEat(thingDef6))
                    {
                        SetAllow(thingDef6, allow: false);
                    }
                }
            }
            if (allowWithComp != null)
            {
                List <ThingDef> allDefsListForReading7 = DefDatabase <ThingDef> .AllDefsListForReading;
                for (int num13 = 0; num13 < allDefsListForReading7.Count; num13++)
                {
                    ThingDef thingDef7 = allDefsListForReading7[num13];
                    if (thingDef7.HasComp(allowWithComp))
                    {
                        SetAllow(thingDef7, allow: true);
                    }
                }
            }
            if (disallowWithComp != null)
            {
                List <ThingDef> allDefsListForReading8 = DefDatabase <ThingDef> .AllDefsListForReading;
                for (int num14 = 0; num14 < allDefsListForReading8.Count; num14++)
                {
                    ThingDef thingDef8 = allDefsListForReading8[num14];
                    if (thingDef8.HasComp(disallowWithComp))
                    {
                        SetAllow(thingDef8, allow: false);
                    }
                }
            }
            if (disallowCheaperThan != float.MinValue)
            {
                List <ThingDef> list = new List <ThingDef>();
                foreach (ThingDef allowedDef in allowedDefs)
                {
                    if (allowedDef.BaseMarketValue < disallowCheaperThan)
                    {
                        list.Add(allowedDef);
                    }
                }
                for (int num15 = 0; num15 < list.Count; num15++)
                {
                    SetAllow(list[num15], allow: false);
                }
            }
            if (disallowedThingDefs == null)
            {
                return;
            }
            for (int num16 = 0; num16 < disallowedThingDefs.Count; num16++)
            {
                if (disallowedThingDefs[num16] != null)
                {
                    SetAllow(disallowedThingDefs[num16], allow: false);
                }
                else
                {
                    Log.Error("ThingFilter could not find excepted thing def named " + disallowedThingDefs[num16]);
                }
            }
        }
 public TreeNode_ThingCategory(ThingCategoryDef def)
 {
     this.catDef = def;
 }
Exemple #9
0
 public override IEnumerable <string> ConfigErrors()
 {
     foreach (string str in base.ConfigErrors())
     {
         yield return(str);
     }
     if (this.label.NullOrEmpty())
     {
         yield return("no label");
     }
     if (this.graphicData != null)
     {
         foreach (string err in this.graphicData.ConfigErrors(this))
         {
             yield return(err);
         }
     }
     if (this.projectile != null)
     {
         foreach (string err2 in this.projectile.ConfigErrors(this))
         {
             yield return(err2);
         }
     }
     if (this.statBases != null)
     {
         foreach (StatModifier statBase in this.statBases)
         {
             if ((from st in this.statBases
                  where st.stat == statBase.stat
                  select st).Count <StatModifier>() > 1)
             {
                 yield return(string.Concat(new object[]
                 {
                     this.defName,
                     " defines the stat base ",
                     statBase.stat,
                     " more than once."
                 }));
             }
         }
     }
     if (char.IsNumber(this.defName[this.defName.Length - 1]))
     {
         yield return(this.defName + " ends with a numerical digit, which is not allowed on ThingDefs.");
     }
     if (this.thingClass == null)
     {
         yield return(this.defName + " has null thingClass.");
     }
     if (this.comps.Count > 0 && !typeof(ThingWithComps).IsAssignableFrom(this.thingClass))
     {
         yield return(this.defName + " has components but it's thingClass is not a ThingWithComps");
     }
     if (this.ConnectToPower && this.drawerType == DrawerType.RealtimeOnly && this.IsFrame)
     {
         yield return(this.defName + " connects to power but does not add to map mesh. Will not create wire meshes.");
     }
     if (this.costList != null)
     {
         foreach (ThingCountClass cost in this.costList)
         {
             if (cost.count == 0)
             {
                 yield return(string.Concat(new object[]
                 {
                     this.defName,
                     " cost in ",
                     cost.thingDef,
                     " is zero."
                 }));
             }
         }
     }
     if (this.thingCategories != null)
     {
         ThingCategoryDef doubleCat = this.thingCategories.FirstOrDefault(delegate(ThingCategoryDef cat)
         {
             ThingDef $this = this.$this;
             return(this.$this.thingCategories.Count((ThingCategoryDef c) => c == cat) > 1);
         });
         if (doubleCat != null)
         {
             yield return(string.Concat(new object[]
             {
                 this.defName,
                 " has duplicate thingCategory ",
                 doubleCat,
                 "."
             }));
         }
     }
     if (this.Fillage == FillCategory.Full && this.category != ThingCategory.Building)
     {
         yield return(this.defName + " gives full cover but is not a building.");
     }
     if (this.comps.Any((CompProperties c) => c.compClass == typeof(CompPowerTrader)) && this.drawerType == DrawerType.MapMeshOnly)
     {
         yield return(this.defName + " has PowerTrader comp but does not draw real time. It won't draw a needs-power overlay.");
     }
     if (this.equipmentType != EquipmentType.None)
     {
         if (this.techLevel == TechLevel.Undefined)
         {
             yield return(this.defName + " has no tech level.");
         }
         if (!this.comps.Any((CompProperties c) => c.compClass == typeof(CompEquippable)))
         {
             yield return("is equipment but has no CompEquippable");
         }
     }
     if (this.thingClass == typeof(Bullet) && this.projectile.damageDef == null)
     {
         yield return(this.defName + " is a bullet but has no damageDef.");
     }
     if (this.destroyOnDrop && !this.menuHidden)
     {
         yield return(this.defName + " has destroyOnDrop but not menuHidden.");
     }
     if (this.stackLimit > 1 && !this.drawGUIOverlay)
     {
         yield return(this.defName + " has stackLimit > 1 but also has drawGUIOverlay = false.");
     }
     if (this.damageMultipliers != null)
     {
         foreach (DamageMultiplier mult in this.damageMultipliers)
         {
             if ((from m in this.damageMultipliers
                  where m.damageDef == mult.damageDef
                  select m).Count <DamageMultiplier>() > 1)
             {
                 yield return(this.defName + " has multiple damage multipliers for damageDef " + mult.damageDef);
             }
         }
     }
     if (this.Fillage == FillCategory.Full && !this.IsEdifice())
     {
         yield return("fillPercent is 1.00 but is not edifice");
     }
     if (base.MadeFromStuff && this.constructEffect != null)
     {
         yield return(this.defName + " is madeFromStuff but has a defined constructEffect (which will always be overridden by stuff's construct animation).");
     }
     if (base.MadeFromStuff && this.stuffCategories.NullOrEmpty <StuffCategoryDef>())
     {
         yield return("madeFromStuff but has no stuffCategories.");
     }
     if (this.costList.NullOrEmpty <ThingCountClass>() && this.costStuffCount <= 0 && this.recipeMaker != null)
     {
         yield return("has a recipeMaker but no costList or costStuffCount.");
     }
     if (this.GetStatValueAbstract(StatDefOf.DeteriorationRate, null) > 1E-05f && !this.CanEverDeteriorate)
     {
         yield return("has >0 DeteriorationRate but can't deteriorate.");
     }
     if (this.drawerType == DrawerType.MapMeshOnly)
     {
         if (this.comps.Any((CompProperties c) => c.compClass == typeof(CompForbiddable)))
         {
             yield return("drawerType=MapMeshOnly but has a CompForbiddable, which must draw in real time.");
         }
     }
     if (this.smeltProducts != null && this.smeltable)
     {
         yield return("has smeltProducts but has smeltable=false");
     }
     if (this.equipmentType != EquipmentType.None && this.verbs.NullOrEmpty <VerbProperties>() && this.tools.NullOrEmpty <Tool>())
     {
         yield return("is equipment but has no verbs or tools");
     }
     if (this.graphicData != null && this.graphicData.shadowData != null)
     {
         if (this.castEdgeShadows)
         {
             yield return("graphicData defines a shadowInfo but castEdgeShadows is also true");
         }
         if (this.staticSunShadowHeight > 0f)
         {
             yield return("graphicData defines a shadowInfo but staticSunShadowHeight > 0");
         }
     }
     if (this.race != null && this.verbs != null)
     {
         int i;
         for (i = 0; i < this.verbs.Count; i++)
         {
             if (this.verbs[i].linkedBodyPartsGroup != null && !this.race.body.AllParts.Any((BodyPartRecord part) => part.groups.Contains(this.$this.verbs[i].linkedBodyPartsGroup)))
             {
                 yield return(string.Concat(new object[]
                 {
                     "has verb with linkedBodyPartsGroup ",
                     this.verbs[i].linkedBodyPartsGroup,
                     " but body ",
                     this.race.body,
                     " has no parts with that group."
                 }));
             }
         }
     }
     if (this.race != null && this.tools != null)
     {
         int i;
         for (i = 0; i < this.tools.Count; i++)
         {
             if (this.tools[i].linkedBodyPartsGroup != null && !this.race.body.AllParts.Any((BodyPartRecord part) => part.groups.Contains(this.$this.tools[i].linkedBodyPartsGroup)))
             {
                 yield return(string.Concat(new object[]
                 {
                     "has tool with linkedBodyPartsGroup ",
                     this.tools[i].linkedBodyPartsGroup,
                     " but body ",
                     this.race.body,
                     " has no parts with that group."
                 }));
             }
         }
     }
     if (this.building != null)
     {
         foreach (string err3 in this.building.ConfigErrors(this))
         {
             yield return(err3);
         }
     }
     if (this.apparel != null)
     {
         foreach (string err4 in this.apparel.ConfigErrors(this))
         {
             yield return(err4);
         }
     }
     if (this.comps != null)
     {
         for (int j = 0; j < this.comps.Count; j++)
         {
             foreach (string err5 in this.comps[j].ConfigErrors(this))
             {
                 yield return(err5);
             }
         }
     }
     if (this.race != null)
     {
         foreach (string e in this.race.ConfigErrors())
         {
             yield return(e);
         }
     }
     if (this.ingestible != null)
     {
         foreach (string e2 in this.ingestible.ConfigErrors(this))
         {
             yield return(e2);
         }
     }
     if (this.plant != null)
     {
         foreach (string e3 in this.plant.ConfigErrors())
         {
             yield return(e3);
         }
     }
     if (this.recipes != null && this.race != null)
     {
         foreach (RecipeDef r in this.recipes)
         {
             if (r.requireBed != this.race.FleshType.requiresBedForSurgery)
             {
                 yield return(string.Format("surgery bed requirement mismatch; flesh-type {0} is {1}, recipe {2} is {3}", new object[]
                 {
                     this.race.FleshType,
                     this.race.FleshType.requiresBedForSurgery,
                     r,
                     r.requireBed
                 }));
             }
         }
     }
     if (this.tools != null)
     {
         Tool dupeTool = this.tools.SelectMany(delegate(Tool lhs)
         {
             ThingDef $this = this.$this;
             return(from rhs in this.$this.tools
                    where lhs != rhs && lhs.Id == rhs.Id
                    select rhs);
         }).FirstOrDefault <Tool>();
         if (dupeTool != null)
         {
             yield return(string.Format("duplicate thingdef tool id {0}", dupeTool.Id));
         }
     }
 }