Exemplo n.º 1
0
        private int GetCarriedCount(Bill_Production bill, ThingDef prodDef)
        {
            int num = 0;

            foreach (Pawn current in bill.Map.mapPawns.FreeColonistsSpawned)
            {
                Thing thing = current.carryTracker.CarriedThing;
                if (thing != null)
                {
                    int stackCount = thing.stackCount;
                    thing = thing.GetInnerIfMinified();
                    if (this.CountValidThing(thing, bill, prodDef))
                    {
                        num += stackCount;
                    }
                }
            }
            return(num);
        }
Exemplo n.º 2
0
        public virtual bool Allows(Thing t)
        {
            t = t.GetInnerIfMinified();
            bool result;

            if (!this.Allows(t.def))
            {
                result = false;
            }
            else
            {
                if (t.def.useHitPoints)
                {
                    float num = (float)t.HitPoints / (float)t.MaxHitPoints;
                    num = GenMath.RoundedHundredth(num);
                    if (!this.allowedHitPointsPercents.IncludesEpsilon(Mathf.Clamp01(num)))
                    {
                        return(false);
                    }
                }
                if (this.allowedQualities != QualityRange.All && t.def.FollowQualityThingFilter())
                {
                    QualityCategory p;
                    if (!t.TryGetQuality(out p))
                    {
                        p = QualityCategory.Normal;
                    }
                    if (!this.allowedQualities.Includes(p))
                    {
                        return(false);
                    }
                }
                for (int i = 0; i < this.disallowedSpecialFilters.Count; i++)
                {
                    if (this.disallowedSpecialFilters[i].Worker.Matches(t))
                    {
                        return(false);
                    }
                }
                result = true;
            }
            return(result);
        }
Exemplo n.º 3
0
 public virtual bool Allows(Thing t)
 {
     t = t.GetInnerIfMinified();
     if (!Allows(t.def))
     {
         return(false);
     }
     if (t.def.useHitPoints)
     {
         float f = (float)t.HitPoints / (float)t.MaxHitPoints;
         f = GenMath.RoundedHundredth(f);
         if (!allowedHitPointsPercents.IncludesEpsilon(Mathf.Clamp01(f)))
         {
             return(false);
         }
     }
     if (allowedQualities != QualityRange.All && t.def.FollowQualityThingFilter())
     {
         if (!t.TryGetQuality(out QualityCategory qc))
         {
             qc = QualityCategory.Normal;
         }
         if (!allowedQualities.Includes(qc))
         {
             return(false);
         }
     }
     for (int i = 0; i < disallowedSpecialFilters.Count; i++)
     {
         if (disallowedSpecialFilters[i].Worker.Matches(t) && t.def.IsWithinCategory(disallowedSpecialFilters[i].parentCategory))
         {
             return(false);
         }
     }
     return(true);
 }