Example #1
0
 static string fuelType(ThingDef d)
 {
     if (!d.HasComp(typeof(CompRefuelable)))
     {
         return("");
     }
     return(d.GetCompProperties <CompProperties_Refuelable>().fuelFilter.Summary);
 }
Example #2
0
 static string fuelToReload(ThingDef d)
 {
     if (!d.HasComp(typeof(CompRefuelable)))
     {
         return("");
     }
     return((d.GetCompProperties <CompProperties_Refuelable>().fuelCapacity / d.GetCompProperties <CompProperties_Refuelable>().FuelMultiplierCurrentDifficulty).ToString());
 }
Example #3
0
 static string fuelCapacity(ThingDef d)
 {
     if (!d.HasComp(typeof(CompRefuelable)))
     {
         return("");
     }
     return(d.GetCompProperties <CompProperties_Refuelable>().fuelCapacity.ToString());
 }
Example #4
0
 private static float GestationDaysEach(ThingDef d)
 {
     if (d.HasComp(typeof(CompEggLayer)))
     {
         CompProperties_EggLayer compProperties = d.GetCompProperties <CompProperties_EggLayer>();
         return(compProperties.eggLayIntervalDays / compProperties.eggCountRange.Average);
     }
     return(d.race.gestationPeriodDays / ((d.race.litterSizeCurve == null) ? 1f : Rand.ByCurveAverage(d.race.litterSizeCurve)));
 }
        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 static bool Includes(this ThingRequestGroup group, ThingDef def)
        {
            switch (group)
            {
            case ThingRequestGroup.Undefined:
                return(false);

            case ThingRequestGroup.Nothing:
                return(false);

            case ThingRequestGroup.Everything:
                return(true);

            case ThingRequestGroup.HaulableEver:
                return(def.EverHaulable);

            case ThingRequestGroup.HaulableAlways:
                return(def.alwaysHaulable);

            case ThingRequestGroup.FoodSource:
                return(def.IsNutritionGivingIngestible || def.thingClass == typeof(Building_NutrientPasteDispenser));

            case ThingRequestGroup.FoodSourceNotPlantOrTree:
                return((def.IsNutritionGivingIngestible && (def.ingestible.foodType & ~FoodTypeFlags.Plant & ~FoodTypeFlags.Tree) != FoodTypeFlags.None) || def.thingClass == typeof(Building_NutrientPasteDispenser));

            case ThingRequestGroup.Corpse:
                return(def.thingClass == typeof(Corpse));

            case ThingRequestGroup.Blueprint:
                return(def.IsBlueprint);

            case ThingRequestGroup.BuildingArtificial:
                return(def.IsBuildingArtificial);

            case ThingRequestGroup.BuildingFrame:
                return(def.IsFrame);

            case ThingRequestGroup.Pawn:
                return(def.category == ThingCategory.Pawn);

            case ThingRequestGroup.PotentialBillGiver:
                return(!def.AllRecipes.NullOrEmpty <RecipeDef>());

            case ThingRequestGroup.Medicine:
                return(def.IsMedicine);

            case ThingRequestGroup.Filth:
                return(def.filth != null);

            case ThingRequestGroup.AttackTarget:
                return(typeof(IAttackTarget).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.Weapon:
                return(def.IsWeapon);

            case ThingRequestGroup.Refuelable:
                return(def.HasComp(typeof(CompRefuelable)));

            case ThingRequestGroup.HaulableEverOrMinifiable:
                return(def.EverHaulable || def.Minifiable);

            case ThingRequestGroup.Drug:
                return(def.IsDrug);

            case ThingRequestGroup.Shell:
                return(def.IsShell);

            case ThingRequestGroup.HarvestablePlant:
                return(def.category == ThingCategory.Plant && def.plant.Harvestable);

            case ThingRequestGroup.Fire:
                return(typeof(Fire).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.Plant:
                return(def.category == ThingCategory.Plant);

            case ThingRequestGroup.Construction:
                return(def.IsBlueprint || def.IsFrame);

            case ThingRequestGroup.HasGUIOverlay:
                return(def.drawGUIOverlay);

            case ThingRequestGroup.Apparel:
                return(def.IsApparel);

            case ThingRequestGroup.MinifiedThing:
                return(typeof(MinifiedThing).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.Grave:
                return(typeof(Building_Grave).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.Art:
                return(def.HasComp(typeof(CompArt)));

            case ThingRequestGroup.ThingHolder:
                return(def.ThisOrAnyCompIsThingHolder());

            case ThingRequestGroup.ActiveDropPod:
                return(typeof(IActiveDropPod).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.Transporter:
                return(def.HasComp(typeof(CompTransporter)));

            case ThingRequestGroup.LongRangeMineralScanner:
                return(def.HasComp(typeof(CompLongRangeMineralScanner)));

            case ThingRequestGroup.AffectsSky:
                return(def.HasComp(typeof(CompAffectsSky)));

            case ThingRequestGroup.PsychicDroneEmanator:
                return(def.HasComp(typeof(CompPsychicDrone)));

            case ThingRequestGroup.WindSource:
                return(def.HasComp(typeof(CompWindSource)));

            case ThingRequestGroup.AlwaysFlee:
                return(def.alwaysFlee);

            default:
                throw new ArgumentException("group");
            }
        }
        public static bool Includes(this ThingRequestGroup group, ThingDef def)
        {
            switch (group)
            {
            case ThingRequestGroup.Undefined:
                return(false);

            case ThingRequestGroup.Nothing:
                return(false);

            case ThingRequestGroup.Everything:
                return(true);

            case ThingRequestGroup.HaulableEver:
                return(def.EverHaulable);

            case ThingRequestGroup.HaulableAlways:
                return(def.alwaysHaulable);

            case ThingRequestGroup.Plant:
                return(def.category == ThingCategory.Plant);

            case ThingRequestGroup.HarvestablePlant:
                if (def.category == ThingCategory.Plant)
                {
                    return(def.plant.Harvestable);
                }
                return(false);

            case ThingRequestGroup.FoodSource:
                if (!def.IsNutritionGivingIngestible)
                {
                    return(def.thingClass == typeof(Building_NutrientPasteDispenser));
                }
                return(true);

            case ThingRequestGroup.FoodSourceNotPlantOrTree:
                if (!def.IsNutritionGivingIngestible || (def.ingestible.foodType & ~FoodTypeFlags.Plant & ~FoodTypeFlags.Tree) == 0)
                {
                    return(def.thingClass == typeof(Building_NutrientPasteDispenser));
                }
                return(true);

            case ThingRequestGroup.HasGUIOverlay:
                return(def.drawGUIOverlay);

            case ThingRequestGroup.Corpse:
                return(def.thingClass == typeof(Corpse));

            case ThingRequestGroup.Blueprint:
                return(def.IsBlueprint);

            case ThingRequestGroup.Construction:
                if (!def.IsBlueprint)
                {
                    return(def.IsFrame);
                }
                return(true);

            case ThingRequestGroup.BuildingArtificial:
                return(def.IsBuildingArtificial);

            case ThingRequestGroup.BuildingFrame:
                return(def.IsFrame);

            case ThingRequestGroup.Pawn:
                return(def.category == ThingCategory.Pawn);

            case ThingRequestGroup.PotentialBillGiver:
                return(!def.AllRecipes.NullOrEmpty());

            case ThingRequestGroup.Medicine:
                return(def.IsMedicine);

            case ThingRequestGroup.Apparel:
                return(def.IsApparel);

            case ThingRequestGroup.MinifiedThing:
                return(typeof(MinifiedThing).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.Filth:
                return(def.filth != null);

            case ThingRequestGroup.AttackTarget:
                return(typeof(IAttackTarget).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.Weapon:
                return(def.IsWeapon);

            case ThingRequestGroup.Refuelable:
                return(def.HasComp(typeof(CompRefuelable)));

            case ThingRequestGroup.HaulableEverOrMinifiable:
                if (!def.EverHaulable)
                {
                    return(def.Minifiable);
                }
                return(true);

            case ThingRequestGroup.Drug:
                return(def.IsDrug);

            case ThingRequestGroup.Shell:
                return(def.IsShell);

            case ThingRequestGroup.Bed:
                return(def.IsBed);

            case ThingRequestGroup.Grave:
                return(typeof(Building_Grave).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.Art:
                return(def.HasComp(typeof(CompArt)));

            case ThingRequestGroup.ThingHolder:
                return(def.ThisOrAnyCompIsThingHolder());

            case ThingRequestGroup.ActiveDropPod:
                return(typeof(IActiveDropPod).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.Transporter:
                return(def.HasComp(typeof(CompTransporter)));

            case ThingRequestGroup.LongRangeMineralScanner:
                return(def.HasComp(typeof(CompLongRangeMineralScanner)));

            case ThingRequestGroup.AffectsSky:
                return(def.HasComp(typeof(CompAffectsSky)));

            case ThingRequestGroup.WindSource:
                return(def.HasComp(typeof(CompWindSource)));

            case ThingRequestGroup.AlwaysFlee:
                return(def.alwaysFlee);

            case ThingRequestGroup.Fire:
                return(typeof(Fire).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.ResearchBench:
                return(typeof(Building_ResearchBench).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.Facility:
                return(def.HasComp(typeof(CompFacility)));

            case ThingRequestGroup.AffectedByFacilities:
                return(def.HasComp(typeof(CompAffectedByFacilities)));

            case ThingRequestGroup.CreatesInfestations:
                return(def.HasComp(typeof(CompCreatesInfestations)));

            case ThingRequestGroup.WithCustomRectForSelector:
                return(def.hasCustomRectForSelector);

            case ThingRequestGroup.ProjectileInterceptor:
                return(def.HasComp(typeof(CompProjectileInterceptor)));

            case ThingRequestGroup.ConditionCauser:
                return(def.GetCompProperties <CompProperties_CausesGameCondition>() != null);

            case ThingRequestGroup.MusicalInstrument:
                return(typeof(Building_MusicalInstrument).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.Throne:
                return(typeof(Building_Throne).IsAssignableFrom(def.thingClass));

            case ThingRequestGroup.FoodDispenser:
                return(def.IsFoodDispenser);

            case ThingRequestGroup.Projectile:
                return(def.projectile != null);

            case ThingRequestGroup.MeditationFocus:
                return(def.HasComp(typeof(CompMeditationFocus)));

            case ThingRequestGroup.Chunk:
                if (!def.thingCategories.NullOrEmpty())
                {
                    if (!def.thingCategories.Contains(ThingCategoryDefOf.Chunks))
                    {
                        return(def.thingCategories.Contains(ThingCategoryDefOf.StoneChunks));
                    }
                    return(true);
                }
                return(false);

            default:
                throw new ArgumentException("group");
            }
        }
 static bool IsDrug(ThingDef d)
 {
     return(d.HasComp(typeof(CompDrug)));
 }
Example #9
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]);
                }
            }
        }