private void DoItemsLists(Rect inRect, ref float curY)
        {
            LordJob_FormAndSendCaravan lordJob_FormAndSendCaravan = (LordJob_FormAndSendCaravan)base.SelPawn.GetLord().LordJob;
            Rect  position = new Rect(0f, curY, (inRect.width - 10f) / 2f, inRect.height);
            float curY2    = 0f;

            GUI.BeginGroup(position);
            Widgets.ListSeparator(ref curY2, position.width, "ItemsToLoad".Translate());
            bool flag = false;

            for (int i = 0; i < lordJob_FormAndSendCaravan.transferables.Count; i++)
            {
                TransferableOneWay transferableOneWay = lordJob_FormAndSendCaravan.transferables[i];
                if (transferableOneWay.CountToTransfer > 0 && transferableOneWay.HasAnyThing)
                {
                    flag = true;
                    DoThingRow(transferableOneWay.ThingDef, transferableOneWay.CountToTransfer, transferableOneWay.things, position.width, ref curY2);
                }
            }
            if (!flag)
            {
                Widgets.NoneLabel(ref curY2, position.width);
            }
            GUI.EndGroup();
            Rect  position2 = new Rect((inRect.width + 10f) / 2f, curY, (inRect.width - 10f) / 2f, inRect.height);
            float curY3     = 0f;

            GUI.BeginGroup(position2);
            Widgets.ListSeparator(ref curY3, position2.width, "LoadedItems".Translate());
            bool flag2 = false;

            for (int j = 0; j < lordJob_FormAndSendCaravan.lord.ownedPawns.Count; j++)
            {
                Pawn pawn = lordJob_FormAndSendCaravan.lord.ownedPawns[j];
                if (!pawn.inventory.UnloadEverything)
                {
                    for (int k = 0; k < pawn.inventory.innerContainer.Count; k++)
                    {
                        Thing thing = pawn.inventory.innerContainer[k];
                        flag2 = true;
                        tmpSingleThing.Clear();
                        tmpSingleThing.Add(thing);
                        DoThingRow(thing.def, thing.stackCount, tmpSingleThing, position2.width, ref curY3);
                        tmpSingleThing.Clear();
                    }
                }
            }
            if (!flag2)
            {
                Widgets.NoneLabel(ref curY3, position.width);
            }
            GUI.EndGroup();
            curY += Mathf.Max(curY2, curY3);
        }
        private void AddToTransferables(Thing t)
        {
            TransferableOneWay transferableOneWay = TransferableUtility.TransferableMatching <TransferableOneWay>(t, this.transferables, TransferAsOneMode.PodsOrCaravanPacking);

            if (transferableOneWay == null)
            {
                transferableOneWay = new TransferableOneWay();
                this.transferables.Add(transferableOneWay);
            }
            transferableOneWay.things.Add(t);
        }
예제 #3
0
 private void DrawMarketValue(Rect rect, TransferableOneWay trad)
 {
     if (trad.HasAnyThing)
     {
         if (Mouse.IsOver(rect))
         {
             Widgets.DrawHighlight(rect);
         }
         Widgets.Label(rect, trad.AnyThing.MarketValue.ToStringMoney());
         TooltipHandler.TipRegion(rect, "MarketValueTip".Translate());
     }
 }
 private void OnDropToLoadThing(TransferableOneWay t, int count)
 {
     t.ForceTo(t.CountToTransfer - count);
     EndJobForEveryoneHauling(t);
     foreach (Thing thing in t.things)
     {
         Pawn pawn = thing as Pawn;
         if (pawn != null)
         {
             RemovePawnFromLoadLord(pawn);
         }
     }
 }
        public static int CountLeftToTransfer(Pawn pawn, TransferableOneWay transferable, Lord lord)
        {
            int result;

            if (transferable.CountToTransfer <= 0 || !transferable.HasAnyThing)
            {
                result = 0;
            }
            else
            {
                result = Mathf.Max(transferable.CountToTransfer - GatherItemsForCaravanUtility.TransferableCountHauledByOthers(pawn, transferable, lord), 0);
            }
            return(result);
        }
예제 #6
0
 private void DrawEquippedWeapon(Rect rect, Rect iconRect, TransferableOneWay trad)
 {
     if (trad.HasAnyThing)
     {
         Pawn pawn = trad.AnyThing as Pawn;
         if (pawn != null && pawn.equipment != null && pawn.equipment.Primary != null)
         {
             ThingWithComps primary = pawn.equipment.Primary;
             Widgets.DrawHighlightIfMouseover(rect);
             Widgets.ThingIcon(iconRect, primary);
             TooltipHandler.TipRegion(rect, primary.LabelCap);
         }
     }
 }
        private bool ShouldShowCount(TransferableOneWay trad)
        {
            if (!trad.HasAnyThing)
            {
                return(true);
            }
            Pawn pawn = trad.AnyThing as Pawn;

            if (pawn != null && pawn.RaceProps.Humanlike)
            {
                return(trad.MaxCount != 1);
            }
            return(true);
        }
 private void DrawItemNutrition(Rect rect, TransferableOneWay trad)
 {
     if (trad.HasAnyThing && trad.ThingDef.IsNutritionGivingIngestible)
     {
         Widgets.DrawHighlightIfMouseover(rect);
         GUI.color = Color.green;
         Widgets.Label(rect, trad.ThingDef.GetStatValueAbstract(StatDefOf.Nutrition).ToString("0.##"));
         GUI.color = Color.white;
         if (Mouse.IsOver(rect))
         {
             TooltipHandler.TipRegion(rect, "ItemNutritionTip".Translate((1.6f * ThingDefOf.Human.race.baseHungerRate).ToString("0.##")));
         }
     }
 }
예제 #9
0
        private void AddToTransferables(Thing t, bool setToTransferMax = false)
        {
            TransferableOneWay transferableOneWay = TransferableUtility.TransferableMatching <TransferableOneWay>(t, this.transferables, TransferAsOneMode.PodsOrCaravanPacking);

            if (transferableOneWay == null)
            {
                transferableOneWay = new TransferableOneWay();
                this.transferables.Add(transferableOneWay);
            }
            transferableOneWay.things.Add(t);
            if (setToTransferMax)
            {
                transferableOneWay.AdjustTo(transferableOneWay.CountToTransfer + t.stackCount);
            }
        }
        private bool ShouldShowCount(TransferableOneWay trad)
        {
            bool result;

            if (!trad.HasAnyThing)
            {
                result = true;
            }
            else
            {
                Pawn pawn = trad.AnyThing as Pawn;
                result = (pawn == null || !pawn.RaceProps.Humanlike || trad.MaxCount != 1);
            }
            return(result);
        }
예제 #11
0
        private void AddToTransferables(Thing t, bool setToTransferMax = false)
        {
            TransferableOneWay transferableOneWay = TransferableUtility.TransferableMatching <TransferableOneWay>(t, this.transferables);

            if (transferableOneWay == null)
            {
                transferableOneWay = new TransferableOneWay();
                this.transferables.Add(transferableOneWay);
            }
            transferableOneWay.things.Add(t);
            if (setToTransferMax)
            {
                transferableOneWay.AdjustTo(transferableOneWay.MaxCount);
            }
        }
예제 #12
0
        private void EndJobForEveryoneHauling(TransferableOneWay t)
        {
            List <Pawn> allPawnsSpawned = base.SelThing.Map.mapPawns.AllPawnsSpawned;

            for (int i = 0; i < allPawnsSpawned.Count; i++)
            {
                if (allPawnsSpawned[i].CurJobDef == JobDefOf.HaulToTransporter)
                {
                    JobDriver_HaulToTransporter jobDriver_HaulToTransporter = (JobDriver_HaulToTransporter)allPawnsSpawned[i].jobs.curDriver;
                    if (jobDriver_HaulToTransporter.Transporter == Transporter && jobDriver_HaulToTransporter.ThingToCarry != null && jobDriver_HaulToTransporter.ThingToCarry.def == t.ThingDef)
                    {
                        allPawnsSpawned[i].jobs.EndCurrentJob(JobCondition.InterruptForced);
                    }
                }
            }
        }
 private Toil AddCarriedThingToTransferables()
 {
     return(new Toil
     {
         initAction = delegate()
         {
             TransferableOneWay transferable = this.Transferable;
             if (!transferable.things.Contains(this.pawn.carryTracker.CarriedThing))
             {
                 transferable.things.Add(this.pawn.carryTracker.CarriedThing);
             }
         },
         defaultCompleteMode = ToilCompleteMode.Instant,
         atomicWithPrevious = true
     });
 }
        private Toil AddCarriedThingToTransferables()
        {
            Toil toil = new Toil();

            toil.initAction = delegate
            {
                TransferableOneWay transferable = Transferable;
                if (!transferable.things.Contains(pawn.carryTracker.CarriedThing))
                {
                    transferable.things.Add(pawn.carryTracker.CarriedThing);
                }
            };
            toil.defaultCompleteMode = ToilCompleteMode.Instant;
            toil.atomicWithPrevious  = true;
            return(toil);
        }
        public static TransferableOneWay TransferableMatchingDesperate(Thing thing, List <TransferableOneWay> transferables, TransferAsOneMode mode)
        {
            TransferableOneWay result;

            if (thing == null || transferables == null)
            {
                result = null;
            }
            else
            {
                for (int i = 0; i < transferables.Count; i++)
                {
                    TransferableOneWay transferableOneWay = transferables[i];
                    if (transferableOneWay.HasAnyThing)
                    {
                        if (transferableOneWay.things.Contains(thing))
                        {
                            return(transferableOneWay);
                        }
                    }
                }
                for (int j = 0; j < transferables.Count; j++)
                {
                    TransferableOneWay transferableOneWay2 = transferables[j];
                    if (transferableOneWay2.HasAnyThing)
                    {
                        if (TransferableUtility.TransferAsOne(thing, transferableOneWay2.AnyThing, mode))
                        {
                            return(transferableOneWay2);
                        }
                    }
                }
                for (int k = 0; k < transferables.Count; k++)
                {
                    TransferableOneWay transferableOneWay3 = transferables[k];
                    if (transferableOneWay3.HasAnyThing)
                    {
                        if (transferableOneWay3.ThingDef == thing.def)
                        {
                            return(transferableOneWay3);
                        }
                    }
                }
                result = null;
            }
            return(result);
        }
예제 #16
0
        private void AddToTransferables(Thing t)
        {
            TransferableOneWay transferableOneWay = TransferableUtility.TransferableMatching(t, transferables, TransferAsOneMode.PodsOrCaravanPacking);

            if (transferableOneWay == null)
            {
                transferableOneWay = new TransferableOneWay();
                transferables.Add(transferableOneWay);
            }
            if (transferableOneWay.things.Contains(t))
            {
                Log.Error("Tried to add the same thing twice to TransferableOneWay: " + t);
            }
            else
            {
                transferableOneWay.things.Add(t);
            }
        }
예제 #17
0
        private void DrawNutritionEatenPerDay(Rect rect, TransferableOneWay trad)
        {
            if (!trad.HasAnyThing)
            {
                return;
            }
            Pawn p = trad.AnyThing as Pawn;

            if (p == null || !p.RaceProps.EatsFood || p.Dead || p.needs.food == null)
            {
                return;
            }
            Widgets.DrawHighlightIfMouseover(rect);
            string       text = (p.needs.food.FoodFallPerTick * 60000f).ToString("0.##");
            DietCategory resolvedDietCategory = p.RaceProps.ResolvedDietCategory;

            if (resolvedDietCategory != DietCategory.Omnivorous)
            {
                text = text + " (" + resolvedDietCategory.ToStringHumanShort() + ")";
            }
            GUI.color = new Color(1f, 0.5f, 0f);
            Widgets.Label(rect, text);
            GUI.color = Color.white;
            TooltipHandler.TipRegion(rect, delegate()
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("NoDietCategoryLetter".Translate() + " - " + DietCategory.Omnivorous.ToStringHuman());
                DietCategory[] array = (DietCategory[])Enum.GetValues(typeof(DietCategory));
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i] != DietCategory.NeverEats && array[i] != DietCategory.Omnivorous)
                    {
                        stringBuilder.AppendLine();
                        stringBuilder.Append(array[i].ToStringHumanShort() + " - " + array[i].ToStringHuman());
                    }
                }
                return("NutritionEatenPerDayTip".Translate(new object[]
                {
                    ThingDefOf.MealSimple.GetStatValueAbstract(StatDefOf.Nutrition, null).ToString("0.##"),
                    stringBuilder.ToString(),
                    p.RaceProps.foodType.ToHumanString()
                }));
            }, trad.GetHashCode() ^ 385968958);
        }
        private static Thing FindThingToLoad(Pawn p, CompTransporter transporter)
        {
            LoadTransportersJobUtility.neededThings.Clear();
            List <TransferableOneWay> leftToLoad = transporter.leftToLoad;

            if (leftToLoad != null)
            {
                for (int i = 0; i < leftToLoad.Count; i++)
                {
                    TransferableOneWay transferableOneWay = leftToLoad[i];
                    if (transferableOneWay.CountToTransfer > 0)
                    {
                        for (int j = 0; j < transferableOneWay.things.Count; j++)
                        {
                            LoadTransportersJobUtility.neededThings.Add(transferableOneWay.things[j]);
                        }
                    }
                }
            }
            Thing result;

            if (!LoadTransportersJobUtility.neededThings.Any <Thing>())
            {
                result = null;
            }
            else
            {
                Thing thing = GenClosest.ClosestThingReachable(p.Position, p.Map, ThingRequest.ForGroup(ThingRequestGroup.HaulableEver), PathEndMode.Touch, TraverseParms.For(p, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, (Thing x) => LoadTransportersJobUtility.neededThings.Contains(x) && p.CanReserve(x, 1, -1, null, false), null, 0, -1, false, RegionType.Set_Passable, false);
                if (thing == null)
                {
                    foreach (Thing thing2 in LoadTransportersJobUtility.neededThings)
                    {
                        Pawn pawn = thing2 as Pawn;
                        if (pawn != null && (!pawn.IsColonist || pawn.Downed) && !pawn.inventory.UnloadEverything && p.CanReserveAndReach(pawn, PathEndMode.Touch, Danger.Deadly, 1, -1, null, false))
                        {
                            return(pawn);
                        }
                    }
                }
                LoadTransportersJobUtility.neededThings.Clear();
                result = thing;
            }
            return(result);
        }
예제 #19
0
 private void SubtractFromToLoadList(Thing t, int count)
 {
     if (leftToLoad != null)
     {
         TransferableOneWay transferableOneWay = TransferableUtility.TransferableMatchingDesperate(t, leftToLoad, TransferAsOneMode.PodsOrCaravanPacking);
         if (transferableOneWay != null)
         {
             transferableOneWay.AdjustBy(-count);
             if (transferableOneWay.CountToTransfer <= 0)
             {
                 leftToLoad.Remove(transferableOneWay);
             }
             if (!AnyInGroupHasAnythingLeftToLoad)
             {
                 Messages.Message("MessageFinishedLoadingTransporters".Translate(), parent, MessageTypeDefOf.TaskCompletion);
             }
         }
     }
 }
예제 #20
0
 private void DrawForagedFoodPerDay(Rect rect, TransferableOneWay trad)
 {
     if (trad.HasAnyThing)
     {
         Pawn p = trad.AnyThing as Pawn;
         if (p != null)
         {
             bool  skip;
             float foragedNutritionPerDay = ForagedFoodPerDayCalculator.GetBaseForagedNutritionPerDay(p, out skip);
             if (!skip)
             {
                 Widgets.DrawHighlightIfMouseover(rect);
                 GUI.color = ((foragedNutritionPerDay != 0f) ? Color.green : Color.gray);
                 Widgets.Label(rect, "+" + foragedNutritionPerDay.ToString("0.##"));
                 GUI.color = Color.white;
                 TooltipHandler.TipRegion(rect, () => "NutritionForagedPerDayTip".Translate(StatDefOf.ForagedNutritionPerDay.Worker.GetExplanationFull(StatRequest.For(p), StatDefOf.ForagedNutritionPerDay.toStringNumberSense, foragedNutritionPerDay)), trad.GetHashCode() ^ 0x74BEF43E);
             }
         }
     }
 }
예제 #21
0
        private void AddToTransferables(Thing t, bool setToTransferMax = false)
        {
            TransferableOneWay transferableOneWay = TransferableUtility.TransferableMatching(t, transferables, TransferAsOneMode.PodsOrCaravanPacking);

            if (transferableOneWay == null)
            {
                transferableOneWay = new TransferableOneWay();
                transferables.Add(transferableOneWay);
            }
            if (transferableOneWay.things.Contains(t))
            {
                Log.Error("Tried to add the same thing twice to TransferableOneWay: " + t);
                return;
            }
            transferableOneWay.things.Add(t);
            if (setToTransferMax)
            {
                transferableOneWay.AdjustTo(transferableOneWay.CountToTransfer + t.stackCount);
            }
        }
예제 #22
0
        public void AddToTheToLoadList(TransferableOneWay t, int count)
        {
            if (!t.HasAnyThing || t.CountToTransfer <= 0)
            {
                return;
            }
            if (this.leftToLoad == null)
            {
                this.leftToLoad = new List <TransferableOneWay>();
            }
            if (TransferableUtility.TransferableMatching <TransferableOneWay>(t.AnyThing, this.leftToLoad, TransferAsOneMode.PodsOrCaravanPacking) != null)
            {
                Log.Error("Transferable already exists.", false);
                return;
            }
            TransferableOneWay transferableOneWay = new TransferableOneWay();

            this.leftToLoad.Add(transferableOneWay);
            transferableOneWay.things.AddRange(t.things);
            transferableOneWay.AdjustTo(count);
        }
예제 #23
0
 public void AddToTheToLoadList(TransferableOneWay t, int count)
 {
     if (t.HasAnyThing && t.CountToTransfer > 0)
     {
         if (leftToLoad == null)
         {
             leftToLoad = new List <TransferableOneWay>();
         }
         if (TransferableUtility.TransferableMatching(t.AnyThing, leftToLoad, TransferAsOneMode.PodsOrCaravanPacking) != null)
         {
             Log.Error("Transferable already exists.");
         }
         else
         {
             TransferableOneWay transferableOneWay = new TransferableOneWay();
             leftToLoad.Add(transferableOneWay);
             transferableOneWay.things.AddRange(t.things);
             transferableOneWay.AdjustTo(count);
         }
     }
 }
        public int SubtractFromToLoadList(Thing t, int count, bool sendMessageOnFinished = true)
        {
            if (leftToLoad == null)
            {
                return(0);
            }
            TransferableOneWay transferableOneWay = TransferableUtility.TransferableMatchingDesperate(t, leftToLoad, TransferAsOneMode.PodsOrCaravanPacking);

            if (transferableOneWay == null)
            {
                return(0);
            }
            if (transferableOneWay.CountToTransfer <= 0)
            {
                return(0);
            }
            int num = Mathf.Min(count, transferableOneWay.CountToTransfer);

            transferableOneWay.AdjustBy(-num);
            if (transferableOneWay.CountToTransfer <= 0)
            {
                leftToLoad.Remove(transferableOneWay);
            }
            if (sendMessageOnFinished && !AnyInGroupHasAnythingLeftToLoad)
            {
                CompShuttle comp = parent.GetComp <CompShuttle>();
                if (comp == null || comp.AllRequiredThingsLoaded)
                {
                    if (Props.max1PerGroup)
                    {
                        Messages.Message("MessageFinishedLoadingTransporterSingle".Translate(), parent, MessageTypeDefOf.TaskCompletion);
                    }
                    else
                    {
                        Messages.Message("MessageFinishedLoadingTransporters".Translate(), parent, MessageTypeDefOf.TaskCompletion);
                    }
                }
            }
            return(num);
        }
예제 #25
0
        private void SubtractFromToLoadList(Thing t, int count)
        {
            if (this.leftToLoad == null)
            {
                return;
            }
            TransferableOneWay transferableOneWay = TransferableUtility.TransferableMatchingDesperate(t, this.leftToLoad);

            if (transferableOneWay == null)
            {
                return;
            }
            transferableOneWay.AdjustBy(-count);
            if (transferableOneWay.CountToTransfer <= 0)
            {
                this.leftToLoad.Remove(transferableOneWay);
            }
            if (!this.AnyInGroupHasAnythingLeftToLoad)
            {
                Messages.Message("MessageFinishedLoadingTransporters".Translate(), this.parent, MessageTypeDefOf.TaskCompletion);
            }
        }
예제 #26
0
        private void DrawDaysUntilRot(Rect rect, TransferableOneWay trad)
        {
            if (!trad.HasAnyThing)
            {
                return;
            }
            if (!trad.ThingDef.IsNutritionGivingIngestible)
            {
                return;
            }
            int num;

            if (!this.cachedTicksUntilRot.TryGetValue(trad, out num))
            {
                num = 2147483647;
                for (int i = 0; i < trad.things.Count; i++)
                {
                    CompRottable compRottable = trad.things[i].TryGetComp <CompRottable>();
                    if (compRottable != null)
                    {
                        num = Mathf.Min(num, DaysUntilRotCalculator.ApproxTicksUntilRot_AssumeTimePassesBy(compRottable, this.tile, null));
                    }
                }
                this.cachedTicksUntilRot.Add(trad, num);
            }
            if (num >= 36000000 || (float)num >= 3.6E+07f)
            {
                return;
            }
            Widgets.DrawHighlightIfMouseover(rect);
            float num2 = (float)num / 60000f;

            GUI.color = Color.yellow;
            Widgets.Label(rect, num2.ToString("0.#"));
            GUI.color = Color.white;
            TooltipHandler.TipRegion(rect, "DaysUntilRotTip".Translate());
        }
        protected override void DoItemsLists(Rect inRect, ref float curY)
        {
            CompTransporter transporter = Transporter;
            Rect            position    = new Rect(0f, curY, (inRect.width - 10f) / 2f, inRect.height);

            Text.Font = GameFont.Small;
            bool  flag  = false;
            float curY2 = 0f;

            GUI.BeginGroup(position);
            Widgets.ListSeparator(ref curY2, position.width, "ItemsToLoad".Translate());
            if (transporter.leftToLoad != null)
            {
                for (int i = 0; i < transporter.leftToLoad.Count; i++)
                {
                    TransferableOneWay t = transporter.leftToLoad[i];
                    if (t.CountToTransfer > 0 && t.HasAnyThing)
                    {
                        flag = true;
                        DoThingRow(t.ThingDef, t.CountToTransfer, t.things, position.width, ref curY2, delegate(int x)
                        {
                            OnDropToLoadThing(t, x);
                        });
                    }
                }
            }
            if (!flag)
            {
                Widgets.NoneLabel(ref curY2, position.width);
            }
            GUI.EndGroup();
            Rect  inRect2 = new Rect((inRect.width + 10f) / 2f, curY, (inRect.width - 10f) / 2f, inRect.height);
            float curY3   = 0f;

            base.DoItemsLists(inRect2, ref curY3);
            curY += Mathf.Max(curY2, curY3);
        }
예제 #28
0
        private static int TransferableCountHauledByOthers(Pawn pawn, TransferableOneWay transferable, Lord lord)
        {
            if (!transferable.HasAnyThing)
            {
                Log.Warning("Can't determine transferable count hauled by others because transferable has 0 things.");
                return(0);
            }
            List <Pawn> allPawnsSpawned = lord.Map.mapPawns.AllPawnsSpawned;
            int         num             = 0;

            for (int i = 0; i < allPawnsSpawned.Count; i++)
            {
                Pawn pawn2 = allPawnsSpawned[i];
                if (pawn2 != pawn && pawn2.CurJob != null && pawn2.CurJob.def == JobDefOf.PrepareCaravan_GatherItems && pawn2.CurJob.lord == lord)
                {
                    Thing toHaul = ((JobDriver_PrepareCaravan_GatherItems)pawn2.jobs.curDriver).ToHaul;
                    if (transferable.things.Contains(toHaul) || TransferableUtility.TransferAsOne(transferable.AnyThing, toHaul))
                    {
                        num += toHaul.stackCount;
                    }
                }
            }
            return(num);
        }
예제 #29
0
 private static Transferable <CacheTransferables> m__1(TransferableOneWay tr)
 {
     return(tr);
 }
예제 #30
0
        private void DrawMass(Rect rect, TransferableOneWay trad, float availableMass)
        {
            if (!trad.HasAnyThing)
            {
                return;
            }
            Thing anyThing = trad.AnyThing;
            Pawn  pawn     = anyThing as Pawn;

            if (pawn != null && !this.includePawnsMassInMassUsage && !MassUtility.CanEverCarryAnything(pawn))
            {
                return;
            }
            Widgets.DrawHighlightIfMouseover(rect);
            if (pawn == null || this.includePawnsMassInMassUsage)
            {
                float mass = this.GetMass(anyThing);
                if (pawn != null)
                {
                    float gearMass = 0f;
                    float invMass  = 0f;
                    gearMass = MassUtility.GearMass(pawn);
                    if (!InventoryCalculatorsUtility.ShouldIgnoreInventoryOf(pawn, this.ignorePawnInventoryMass))
                    {
                        invMass = MassUtility.InventoryMass(pawn);
                    }
                    TooltipHandler.TipRegion(rect, () => this.GetPawnMassTip(trad, 0f, mass - gearMass - invMass, gearMass, invMass), trad.GetHashCode() * 59);
                }
                else
                {
                    TooltipHandler.TipRegion(rect, "ItemWeightTip".Translate());
                }
                if (mass > availableMass)
                {
                    GUI.color = Color.red;
                }
                else
                {
                    GUI.color = TransferableOneWayWidget.ItemMassColor;
                }
                Widgets.Label(rect, mass.ToStringMass());
            }
            else
            {
                float cap      = MassUtility.Capacity(pawn, null);
                float gearMass = MassUtility.GearMass(pawn);
                float invMass  = (!InventoryCalculatorsUtility.ShouldIgnoreInventoryOf(pawn, this.ignorePawnInventoryMass)) ? MassUtility.InventoryMass(pawn) : 0f;
                float num      = cap - gearMass - invMass;
                if (num > 0f)
                {
                    GUI.color = Color.green;
                }
                else if (num < 0f)
                {
                    GUI.color = Color.red;
                }
                else
                {
                    GUI.color = Color.gray;
                }
                Widgets.Label(rect, num.ToStringMassOffset());
                TooltipHandler.TipRegion(rect, () => this.GetPawnMassTip(trad, cap, 0f, gearMass, invMass), trad.GetHashCode() * 59);
            }
            GUI.color = Color.white;
        }