Ejemplo n.º 1
0
 private void DoSpecialFilter(SpecialThingFilterDef sfDef, int nestLevel)
 {
     if (sfDef.configurable)
     {
         LabelLeft("*" + sfDef.LabelCap, sfDef.description, nestLevel);
         bool checkOn = filter.Allows(sfDef);
         bool flag    = checkOn;
         Widgets.Checkbox(new Vector2(LabelWidth, curY), ref checkOn, lineHeight, disabled: false, paintable: true);
         if (checkOn != flag)
         {
             filter.SetAllow(sfDef, checkOn);
         }
         EndLine();
     }
 }
 public virtual void CopyAllowancesFrom(ThingFilter other)
 {
     this.allowedDefs.Clear();
     foreach (ThingDef thingDef in ThingFilter.AllStorableThingDefs)
     {
         this.SetAllow(thingDef, other.Allows(thingDef));
     }
     this.disallowedSpecialFilters     = other.disallowedSpecialFilters.ListFullCopyOrNull <SpecialThingFilterDef>();
     this.allowedHitPointsPercents     = other.allowedHitPointsPercents;
     this.allowedHitPointsConfigurable = other.allowedHitPointsConfigurable;
     this.allowedQualities             = other.allowedQualities;
     this.allowedQualitiesConfigurable = other.allowedQualitiesConfigurable;
     this.thingDefs                   = other.thingDefs.ListFullCopyOrNull <ThingDef>();
     this.categories                  = other.categories.ListFullCopyOrNull <string>();
     this.tradeTagsToAllow            = other.tradeTagsToAllow.ListFullCopyOrNull <string>();
     this.tradeTagsToDisallow         = other.tradeTagsToDisallow.ListFullCopyOrNull <string>();
     this.thingSetMakerTagsToAllow    = other.thingSetMakerTagsToAllow.ListFullCopyOrNull <string>();
     this.thingSetMakerTagsToDisallow = other.thingSetMakerTagsToDisallow.ListFullCopyOrNull <string>();
     this.disallowedCategories        = other.disallowedCategories.ListFullCopyOrNull <string>();
     this.specialFiltersToAllow       = other.specialFiltersToAllow.ListFullCopyOrNull <string>();
     this.specialFiltersToDisallow    = other.specialFiltersToDisallow.ListFullCopyOrNull <string>();
     this.stuffCategoriesToAllow      = other.stuffCategoriesToAllow.ListFullCopyOrNull <StuffCategoryDef>();
     this.allowAllWhoCanMake          = other.allowAllWhoCanMake.ListFullCopyOrNull <ThingDef>();
     this.disallowWorsePreferability  = other.disallowWorsePreferability;
     this.disallowInedibleByHuman     = other.disallowInedibleByHuman;
     this.allowWithComp               = other.allowWithComp;
     this.disallowWithComp            = other.disallowWithComp;
     this.disallowCheaperThan         = other.disallowCheaperThan;
     this.disallowedThingDefs         = other.disallowedThingDefs.ListFullCopyOrNull <ThingDef>();
     if (this.settingsChangedCallback != null)
     {
         this.settingsChangedCallback();
     }
 }
Ejemplo n.º 3
0
 public virtual void CopyAllowancesFrom(ThingFilter other)
 {
     this.allowedDefs.Clear();
     foreach (ThingDef allStorableThingDef in ThingFilter.AllStorableThingDefs)
     {
         this.SetAllow(allStorableThingDef, other.Allows(allStorableThingDef));
     }
     this.disallowedSpecialFilters     = other.disallowedSpecialFilters.ListFullCopyOrNull();
     this.allowedHitPointsPercents     = other.allowedHitPointsPercents;
     this.allowedHitPointsConfigurable = other.allowedHitPointsConfigurable;
     this.allowedQualities             = other.allowedQualities;
     this.allowedQualitiesConfigurable = other.allowedQualitiesConfigurable;
     this.thingDefs                = other.thingDefs.ListFullCopyOrNull();
     this.categories               = other.categories.ListFullCopyOrNull();
     this.exceptedThingDefs        = other.exceptedThingDefs.ListFullCopyOrNull();
     this.exceptedCategories       = other.exceptedCategories.ListFullCopyOrNull();
     this.specialFiltersToAllow    = other.specialFiltersToAllow.ListFullCopyOrNull();
     this.specialFiltersToDisallow = other.specialFiltersToDisallow.ListFullCopyOrNull();
     this.stuffCategoriesToAllow   = other.stuffCategoriesToAllow.ListFullCopyOrNull();
     this.allowAllWhoCanMake       = other.allowAllWhoCanMake.ListFullCopyOrNull();
     if (this.settingsChangedCallback != null)
     {
         this.settingsChangedCallback();
     }
 }
Ejemplo n.º 4
0
 public virtual void CopyAllowancesFrom(ThingFilter other)
 {
     allowedDefs.Clear();
     foreach (ThingDef allDef in DefDatabase <ThingDef> .AllDefs)
     {
         SetAllow(allDef, other.Allows(allDef));
     }
     disallowedSpecialFilters     = other.disallowedSpecialFilters.ListFullCopyOrNull();
     allowedHitPointsPercents     = other.allowedHitPointsPercents;
     allowedHitPointsConfigurable = other.allowedHitPointsConfigurable;
     allowedQualities             = other.allowedQualities;
     allowedQualitiesConfigurable = other.allowedQualitiesConfigurable;
     thingDefs                   = other.thingDefs.ListFullCopyOrNull();
     categories                  = other.categories.ListFullCopyOrNull();
     tradeTagsToAllow            = other.tradeTagsToAllow.ListFullCopyOrNull();
     tradeTagsToDisallow         = other.tradeTagsToDisallow.ListFullCopyOrNull();
     thingSetMakerTagsToAllow    = other.thingSetMakerTagsToAllow.ListFullCopyOrNull();
     thingSetMakerTagsToDisallow = other.thingSetMakerTagsToDisallow.ListFullCopyOrNull();
     disallowedCategories        = other.disallowedCategories.ListFullCopyOrNull();
     specialFiltersToAllow       = other.specialFiltersToAllow.ListFullCopyOrNull();
     specialFiltersToDisallow    = other.specialFiltersToDisallow.ListFullCopyOrNull();
     stuffCategoriesToAllow      = other.stuffCategoriesToAllow.ListFullCopyOrNull();
     allowAllWhoCanMake          = other.allowAllWhoCanMake.ListFullCopyOrNull();
     disallowWorsePreferability  = other.disallowWorsePreferability;
     disallowInedibleByHuman     = other.disallowInedibleByHuman;
     allowWithComp               = other.allowWithComp;
     disallowWithComp            = other.disallowWithComp;
     disallowCheaperThan         = other.disallowCheaperThan;
     disallowedThingDefs         = other.disallowedThingDefs.ListFullCopyOrNull();
     if (settingsChangedCallback != null)
     {
         settingsChangedCallback();
     }
 }
Ejemplo n.º 5
0
 private bool Visible(ThingDef td)
 {
     if (td.menuHidden)
     {
         return(false);
     }
     if (forceHiddenDefs != null && forceHiddenDefs.Contains(td))
     {
         return(false);
     }
     if (parentFilter != null)
     {
         if (!parentFilter.Allows(td))
         {
             return(false);
         }
         if (parentFilter.IsAlwaysDisallowedDueToSpecialFilters(td))
         {
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 6
0
        public IEnumerable <ThingDef> PotentiallyMissingIngredients(Pawn billDoer, Map map)
        {
            for (int i = 0; i < ingredients.Count; i++)
            {
                IngredientCount ingredientCount = ingredients[i];
                bool            flag            = false;
                List <Thing>    list            = map.listerThings.ThingsInGroup(ThingRequestGroup.HaulableEver);
                for (int j = 0; j < list.Count; j++)
                {
                    Thing thing = list[j];
                    if ((billDoer == null || !thing.IsForbidden(billDoer)) && !thing.Position.Fogged(map) && (ingredientCount.IsFixedIngredient || fixedIngredientFilter.Allows(thing)) && ingredientCount.filter.Allows(thing))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    continue;
                }
                if (ingredientCount.IsFixedIngredient)
                {
                    yield return(ingredientCount.filter.AllowedThingDefs.First());

                    continue;
                }
                ThingDef thingDef = ingredientCount.filter.AllowedThingDefs.OrderBy((ThingDef x) => x.BaseMarketValue).FirstOrDefault((ThingDef x) => fixedIngredientFilter.Allows(x));
                if (thingDef != null)
                {
                    yield return(thingDef);
                }
            }
        }
Ejemplo n.º 7
0
        public IEnumerable <ThingDef> PotentiallyMissingIngredients(Pawn billDoer, Map map)
        {
            int      i = 0;
            ThingDef def;

            while (true)
            {
                if (i >= ingredients.Count)
                {
                    yield break;
                }
                IngredientCount ing       = ingredients[i];
                bool            foundIng  = false;
                List <Thing>    thingList = map.listerThings.ThingsInGroup(ThingRequestGroup.HaulableEver);
                for (int j = 0; j < thingList.Count; j++)
                {
                    Thing thing = thingList[j];
                    if ((billDoer == null || !thing.IsForbidden(billDoer)) && !thing.Position.Fogged(map) && (ing.IsFixedIngredient || fixedIngredientFilter.Allows(thing)) && ing.filter.Allows(thing))
                    {
                        foundIng = true;
                        break;
                    }
                }
                if (!foundIng)
                {
                    if (ing.IsFixedIngredient)
                    {
                        yield return(ing.filter.AllowedThingDefs.First());

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                    def = (from x in ing.filter.AllowedThingDefs
                           orderby x.BaseMarketValue
                           select x).FirstOrDefault((ThingDef x) => ((_003CPotentiallyMissingIngredients_003Ec__Iterator1) /*Error near IL_0190: stateMachine*/)._0024this.fixedIngredientFilter.Allows(x));
                    if (def != null)
                    {
                        break;
                    }
                }
                i++;
            }
            yield return(def);

            /*Error: Unable to find new state assignment for yield return*/;
        }