public static float MassUsage(List <ThingCount> thingCounts, IgnorePawnsInventoryMode ignoreInventory, bool includePawnsMass = false, bool ignoreSpawnedCorpsesGearAndInventory = false) { float num = 0f; for (int i = 0; i < thingCounts.Count; i++) { int count = thingCounts[i].Count; if (count <= 0) { continue; } Thing thing = thingCounts[i].Thing; Pawn pawn = thing as Pawn; if (pawn != null) { num = ((!includePawnsMass) ? (num + MassUtility.GearAndInventoryMass(pawn) * (float)count) : (num + pawn.GetStatValue(StatDefOf.Mass) * (float)count)); if (InventoryCalculatorsUtility.ShouldIgnoreInventoryOf(pawn, ignoreInventory)) { num -= MassUtility.InventoryMass(pawn) * (float)count; } continue; } num += thing.GetStatValue(StatDefOf.Mass) * (float)count; if (ignoreSpawnedCorpsesGearAndInventory) { Corpse corpse = thing as Corpse; if (corpse != null && corpse.Spawned) { num -= MassUtility.GearAndInventoryMass(corpse.InnerPawn) * (float)count; } } } return(Mathf.Max(num, 0f)); }
private float GetMass(Thing thing) { if (thing == null) { return(0f); } float num = thing.GetStatValue(StatDefOf.Mass, true); Pawn pawn = thing as Pawn; if (pawn != null) { if (InventoryCalculatorsUtility.ShouldIgnoreInventoryOf(pawn, this.ignorePawnInventoryMass)) { num -= MassUtility.InventoryMass(pawn); } } else if (this.ignoreSpawnedCorpseGearAndInventoryMass) { Corpse corpse = thing as Corpse; if (corpse != null && corpse.Spawned) { num -= MassUtility.GearAndInventoryMass(corpse.InnerPawn); } } return(num); }
private void TryDrawMassInfo(ref float curY, float width) { if (!SelPawnForGear.Dead && ShouldShowInventory(SelPawnForGear)) { Rect rect = new Rect(0f, curY, width, 22f); float num = MassUtility.GearAndInventoryMass(SelPawnForGear); Widgets.Label(rect, TranslatorFormattedStringExtensions.Translate(arg2: MassUtility.Capacity(SelPawnForGear).ToString("0.##"), key: "MassCarried", arg1: num.ToString("0.##"))); curY += 22f; } }
private void TryDrawMassInfo(ref float curY, float width) { if (!this.SelPawnForGear.Dead) { Rect rect = new Rect(0f, curY, width, 22f); float num = MassUtility.GearAndInventoryMass(this.SelPawnForGear); float num2 = MassUtility.Capacity(this.SelPawnForGear); Widgets.Label(rect, "MassCarried".Translate(num.ToString("0.##"), num2.ToString("0.##"))); curY += 22f; } }
private void TryDrawMassInfo(ref float curY, float width) { if (this.SelPawnForGear.Dead || !this.ShouldShowInventory(this.SelPawnForGear)) { return; } Rect rect = new Rect(0f, curY, width, 22f); float num = MassUtility.GearAndInventoryMass(this.SelPawnForGear); float num2 = MassUtility.Capacity(this.SelPawnForGear, null); Widgets.Label(rect, "MassCarried".Translate(new object[] { num.ToString("0.##"), num2.ToString("0.##") })); curY += 22f; }
public static float MassUsage(List <ThingStackPart> stackParts, IgnorePawnsInventoryMode ignoreInventory, bool includePawnsMass = false, bool ignoreCorpsesGearAndInventory = false) { float num = 0f; for (int i = 0; i < stackParts.Count; i++) { int count = stackParts[i].Count; if (count > 0) { Thing thing = stackParts[i].Thing; Pawn pawn = thing as Pawn; if (pawn != null) { if (includePawnsMass) { num += pawn.GetStatValue(StatDefOf.Mass, true) * (float)count; } else { num += MassUtility.GearAndInventoryMass(pawn) * (float)count; } if (InventoryCalculatorsUtility.ShouldIgnoreInventoryOf(pawn, ignoreInventory)) { num -= MassUtility.InventoryMass(pawn) * (float)count; } } else { num += thing.GetStatValue(StatDefOf.Mass, true) * (float)count; if (ignoreCorpsesGearAndInventory) { Corpse corpse = thing as Corpse; if (corpse != null) { num -= MassUtility.GearAndInventoryMass(corpse.InnerPawn) * (float)count; } } } } } return(Mathf.Max(num, 0f)); }
public static float FreeSpace(Pawn pawn) { return(Mathf.Max(MassUtility.Capacity(pawn, null) - MassUtility.GearAndInventoryMass(pawn), 0f)); }
public static float UnboundedEncumbrancePercent(Pawn pawn) { return(MassUtility.GearAndInventoryMass(pawn) / MassUtility.Capacity(pawn, null)); }
private bool TryGetValue(StatRequest req, out float value) { return(PawnOrCorpseStatUtility.TryGetPawnOrCorpseStat(req, (Pawn x) => MassUtility.GearAndInventoryMass(x), (ThingDef x) => 0f, out value)); }
private static float <TryGetValue> m__0(Pawn x) { return(MassUtility.GearAndInventoryMass(x)); }